CreateLocalStorage hook problem with reactivity
I'm trying to make a custom hook that exposes a signal and uses the LocalStore of the browser.
the problem is this don't seem to work with reactivity.
9 Replies
Are there any erorrs in the console?
nop, it's strange..
Can you show where you used the reactivity?
hmm i lost that files cause i implemented the functionality in another way
but was something like
Was it maybe an effect outside of a reactive root?
I have some code that works but something like this don't work when the button redirection to a new page, it was strange
could be
something like this but with navigations of solid-router to new pages when clicking the buttons and showing the name and id in another component
but to simplify
something like this
Your example works for me: https://playground.solidjs.com/anonymous/14716ef3-f675-4120-96ed-d634449f1d4a
Solid Playground
Quickly discover what the solid compiler will generate from your JSX template
So I assume there's a different issue.
yep, i think it can be something related to router or something like that
The app i'm doing is very similar but:
There's an appbar component that always will show the name and id if there's one in the localStorage.
There's a page to select name (that selects the id of that name) , here there are several items to select a name
And when selecting a name it redirects to a subpage of user configuration
When i have time I'll try to replicate the app (very simple) but with all the components and with solid-router
The thing that fails in the app is that the appbar component mentioned before don't change when selecting one item in the select names page
In the app that I'm doing the id don't really need to be shown in the appbar so I created a version of the hook that I think is a singleton
this is the code that I have now working only for names the id I get directly from the localStorage.