4 hours later…
11:52
const NestedChild = ({ age }) => { return <p>Nested child {age}</p>; }; const Child = (props) => { return <p>Child {props.children}</p>; }; const Parent = ({ children }) => { const newChildren = React.Children.map(children, (child) => React.cloneElement(child, { age: 1 }) ); return <div>{newChildren}</div>; }; export default function App() { return ( <div className="App"> <Parent> <Child> <NestedChild /> </Child> </Parent> </div>
« first day (4432 days earlier) ← previous day next day → last day (741 days later) »