S
SolidJS•5mo 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•5mo 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•5mo ago
Ah that makes sense. Ooh good shout, didn't think about that! Thanks so so much for the speedy answer 😄 ❤️
bigmistqke
bigmistqke•5mo ago
U are welcome!!
Want results from more Discord servers?
Add your server