S
SolidJS•4mo ago
vae

Can you use hooks conditionally?

Can you use hooks (like useContext, etc.) in SolidJS conditionally, like after a guard clause, or is it like React, where you cannot? Thanks.
3 Replies
bigmistqke
bigmistqke•4mo ago
There are no real hooks in solidjs, like react has. Hooks are just regular functions, there are no hook rules, so you can use conditionals. But a component only runs once, so it will not be reactive if u use it in a conditional in the component-body.
vae
vaeOP•4mo ago
Ah that makes sense. Ooh good shout, didn't think about that! Thanks so so much for the speedy answer 😄 ❤️
bigmistqke
bigmistqke•4mo ago
U are welcome!!
Want results from more Discord servers?
Add your server