Test.jsx
function Parent({ children }) {
return <div>{children("Test")}</div>
}
function Test() {
return (
<Parent>
{ test => <div>{test}></div> }
</Parent>
)
}
Get an error saying children is not a function
, But I see other examples on the internet saying this works. Anyone know why? On Preact X.
CodePudding user response:
Have you tried this one?
function Test() {
return (
<Parent children={test => <div>{test}></div>}/>
)
}