react icon indicating copy to clipboard operation
react copied to clipboard

React.cloneElement docs are a bit light

Open glenjamin opened this issue 10 years ago • 5 comments

The old cloneWithProps has a nice example, but mentions that it's deprecated in favour of React.cloneElement - https://facebook.github.io/react/docs/clone-with-props.html

Meanwhile https://facebook.github.io/react/docs/top-level-api.html#react.cloneelement is pretty terse, and links to a blog post from 0.13rc2 which has a decent example.

I'm proposing adding a guide page about "modifying" child properties which has a very similar example to the old cloneWithProps page, and then linking to it from there and the cloneElement API docs.

Seem reasonable? I can put together a PR if so.

glenjamin avatar Jun 01 '16 17:06 glenjamin

+1

barbu110 avatar Jun 01 '16 17:06 barbu110

Added this to #8060.

gaearon avatar Oct 23 '16 14:10 gaearon

is someone working on this or can i take a stab at it?

madhug avatar Oct 29 '16 16:10 madhug

@madhug Definitely, you can take it! I imagine this as a single guide that combines how you'd use cloneElement and React.Children helpers.

gaearon avatar Oct 29 '16 16:10 gaearon

Cool thanks! I'll start working on it this weekend!

madhug avatar Oct 29 '16 17:10 madhug