Pass props from Component to props.children
function Child (props) { return <div class={props.class}>child</div> }
function Parent (props) {
// I want parent to be able to customize the props passed to children here
// like for example the css class
return <div>{ props.children }</div>
}
function App () {
return (
<Parent>
<Child />
</Parent>
)
}function Child (props) { return <div class={props.class}>child</div> }
function Parent (props) {
// I want parent to be able to customize the props passed to children here
// like for example the css class
return <div>{ props.children }</div>
}
function App () {
return (
<Parent>
<Child />
</Parent>
)
}Things that I have tried and do not work:
function Parent (props) {
return <div>{ props.children({ class: "test" }) }</div>
}function Parent (props) {
return <div>{ props.children({ class: "test" }) }</div>
}function Parent (props) {
return <div><Dynamic component={props.children} class="test" /></div>
}function Parent (props) {
return <div><Dynamic component={props.children} class="test" /></div>
}