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
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.
Ah that makes sense. Ooh good shout, didn't think about that! Thanks so so much for the speedy answer đ
â¤ď¸
U are welcome!!