You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I was using your module (thanks by the way :-) ) and I encountered a problem. I was in a situation where one component was updating localstorage and another one was 'watching' it. And if localstorage was updated, the watching component needed to rerender with the new data.
But the way the hook is written, it doesn't 'watch' localstorage.
So in my project, I modified your hook and added the following effect:
This way, the state is updated when localstorage changes, and each component using the hook rerenders with the new data. For me it works perfectly, but perhaps you might see a downside (besides added complexity and extra calls to localStorage).
It could also be hidden behind an option.
So anyhow, do want you want with it :-) but I just wanted to let you know what I've done to solve my problem :-)
The text was updated successfully, but these errors were encountered:
Hi, I was using your module (thanks by the way :-) ) and I encountered a problem. I was in a situation where one component was updating localstorage and another one was 'watching' it. And if localstorage was updated, the watching component needed to rerender with the new data.
But the way the hook is written, it doesn't 'watch' localstorage.
So in my project, I modified your hook and added the following effect:
This way, the state is updated when localstorage changes, and each component using the hook rerenders with the new data. For me it works perfectly, but perhaps you might see a downside (besides added complexity and extra calls to localStorage).
It could also be hidden behind an option.
So anyhow, do want you want with it :-) but I just wanted to let you know what I've done to solve my problem :-)
The text was updated successfully, but these errors were encountered: