SolidJSS
SolidJSโ€ข4y agoโ€ข
5 replies
Max

Conditional rendering approach

Hi, it's often the case there is a need to conditionally render components given data that may be undefined.

Given how Solid handles reactivity it seems it is not type safe to use boolean evaluation or ternary statement to conditionally render something. The Show component seems to solve this issue but will only provide a callback to render children of keyed is true, I am unsure of the consequences of using keyed. Please see the example below which should illustrate the question fairly clearly.

Thanks, any information would be cool.

https://playground.solidjs.com/anonymous/f6cab1e1-3349-450c-b786-d082187ff209
Quickly discover what the solid compiler will generate from your JSX template
Was this page helpful?