Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update "Cloning ReactElement" documentation to include info on React.cloneElement #3432

Closed
mheiber opened this issue Mar 17, 2015 · 2 comments

Comments

@mheiber
Copy link
Contributor

mheiber commented Mar 17, 2015

The documentation for "Cloning ReactElement" uses React.cloneWithProps and recommends the following method for preserving key:

If you wish to preserve the key, add it to the `extraProps` object

I suggest including React.cloneElement here instead of recommending to add key to the extraProps object.

@sophiebits
Copy link
Collaborator

Good idea, thanks. Want to send a pull request?

@mheiber
Copy link
Contributor Author

mheiber commented Mar 17, 2015

Sure.
On Mar 16, 2015 9:46 PM, "Ben Alpert" notifications@github.com wrote:

Good idea, thanks. Want to send a pull request?

Reply to this email directly or view it on GitHub
#3432 (comment).

mheiber added a commit to mheiber/react that referenced this issue Mar 18, 2015
Updated documentation to reflect that using React.cloneElement is the new way to copy an element and preserve `key` and `ref`.
fixes facebook#3432
mheiber added a commit to mheiber/react that referenced this issue Mar 21, 2015
Update documentation to reflect that React.cloneElement is
preferred.

fixes facebook#3432

Also change wording so that it is clear that `cloneWithProps`
doesn't mutate props.
sophiebits pushed a commit that referenced this issue Apr 23, 2015
Updated documentation to reflect that using React.cloneElement is the new way to copy an element and preserve `key` and `ref`.

Fixes #3432, closes #3447.

(cherry picked from commit 39442aa)
framp pushed a commit to framp/react that referenced this issue May 26, 2015
Updated documentation to reflect that using React.cloneElement is the new way to copy an element and preserve `key` and `ref`.

Fixes facebook#3432, closes facebook#3447.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants