Closed paulpatarinski closed 6 years ago
Is there a way to pass a React component as a child?
Example :
const ReactComponent = () => <PreactComponent><div class="childPassedInFromReact"></div></PreactComponent> const PreactComponent = ({reactChild}) => <div>{reactChild}</div>
where reactChild could be an html element or a React component
Works the same way as it does for react:
react
function Foo(props) { return <div>{props.children}</div> } // Usage const rendered = ( <Foo> <MyReactChild /> </Foo> );
Is there a way to pass a React component as a child?
Example :
where reactChild could be an html element or a React component