Save global var in SolidJS
Hi everyone, I m new with SolidJS and I'm trying to make an event handler but I have some difficulty.
Is it possible to define a global variable in the client to save a User connection token and reuse it on every component as i want. For now i only know do it by pass it on params of all my components one by one.
Does it existe a best way to do that
Thanks in advance
2 Replies
Sounds like a job for context:
https://www.solidjs.com/tutorial/stores_context?solved
If the event handler is used outside of JSX
from
could be useful.
https://playground.solidjs.com/anonymous/442a1e83-a1fd-4111-9511-f667b5bcacbf
https://playground.solidjs.com/anonymous/16df5e56-2f0c-410f-a248-e95d9d483029SolidJS
Solid is a purely reactive library. It was designed from the ground up with a reactive core. It's influenced by reactive principles developed by previous libraries.
Solid Playground
Quickly discover what the solid compiler will generate from your JSX template
Solid Playground
Quickly discover what the solid compiler will generate from your JSX template
Oh well, thank you very much