render(() => { <Component />, element }) throws an error when including props
render(() => { <Component />, element })
This works if I only reference the component as <Component />
However, I get an error when using <Component id='xyz' />
Error: Uncaught TypeError: Cannot read properties of undefined (reading 'firstChild')
2 Replies
Hmm, you don't need the curly braces
https://www.solidjs.com/docs/latest/api#render
element
is the second argument to the render
functionIf I don't use curly braces, I have to pass the argument as just a name (i.e. "Component"), not the component itself (i.e. <Component />). If I only pass the name, how can I include props?
I stand corrected... I removed the curly braces to write the following:
render(() => <Component id='xyz'/>, element )
and it worked. Thanks @._rb !