For https://reactjs.org/docs/react-api.html#reactchildrenmap to help illustrate as to what it does, can we kindly add an example for something like this.
const Value = ({ value }) => <p>{value}</p>
const PropsInjector = ({ children }) => React.Children.map(children, child => {
return React.cloneElement(child, { value: 'some_value' });
});
const App = () => (
<PropsInjector>
<Value />
<Value />
</PropsInjector>
)
I don't know if this might be an acceptable example for React.Children.map, but I would love to hear some feedback if possible.
The current documentation doesn't have a an example on how React.Children.map can be used & it doesn't make sense for someone like me
As per docs: React.Children.map(children, function[(thisArg)])
For someone like me I got very confused function[(thisArg)] when I read this & didn't know on how I could use it.
I am more then happy to make a PR for adding this example & or any better example if someone can suggest.
For https://reactjs.org/docs/react-api.html#reactchildrenmap to help illustrate as to what it does, can we kindly add an example for something like this.
I don't know if this might be an acceptable example for
React.Children.map, but I would love to hear some feedback if possible.The current documentation doesn't have a an example on how
React.Children.mapcan be used & it doesn't make sense for someone like meAs per docs:
React.Children.map(children, function[(thisArg)])I am more then happy to make a PR for adding this example & or any better example if someone can suggest.