composition react code example
Example: component composition in react
function ChildComponent(props) { return ( <div> {props.children} </div> );}function ParentComponent() { return ( <ChildComponent> <h1> Hello readers </h1> <p> Follow me on Medium! </p> </ChildComponent> );}ReactDOM.render( <ParentComponent />, document.getElementById('root'));