Browse Source

[Beta] Update text with cloneElement (#5268)

main
Dhaval Laiya 2 years ago
committed by GitHub
parent
commit
15e5baca67
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      beta/src/content/apis/react/cloneElement.md

2
beta/src/content/apis/react/cloneElement.md

@ -689,6 +689,6 @@ Usually, you'll return the element from your component or make it a child of ano
* Cloning an element **does not modify the original element.** * Cloning an element **does not modify the original element.**
* You should only **pass children as multiple arguments to `createElement` if they are all statically known,** like `cloneElement(element, null, child1, child2, child3)`. If your children are dynamic, pass the entire array as the third argument: `cloneElement(element, null, listItems)`. This ensures that React will [warn you about missing `key`s](/learn/rendering-lists#keeping-list-items-in-order-with-key) for any dynamic lists. For static lists this is not necessary because they never reorder. * You should only **pass children as multiple arguments to `cloneElement` if they are all statically known,** like `cloneElement(element, null, child1, child2, child3)`. If your children are dynamic, pass the entire array as the third argument: `cloneElement(element, null, listItems)`. This ensures that React will [warn you about missing `key`s](/learn/rendering-lists#keeping-list-items-in-order-with-key) for any dynamic lists. For static lists this is not necessary because they never reorder.
* `cloneElement` makes it harder to trace the data flow, so **try the [alternatives](/#alternatives) instead.** * `cloneElement` makes it harder to trace the data flow, so **try the [alternatives](/#alternatives) instead.**

Loading…
Cancel
Save