React.cloneElementとは

Mar 14, 2019 15:03 · 135 words · 1 minute read

  • 子要素にpropsを渡すための仕組み
  • Reactではmutableを嫌うため、VDOMをimmutableに扱うための仕組み
  • 既存の子要素そのままではなく、propsが渡されたコピーを生成する

ドキュメント

The resulting element will have the original element’s props with the new props merged in shallowly. New children will replace existing children

tweet Share