DEV Community

Discussion on: HowTo: Custom React localStorage Hook ⚓

Collapse
 
sanderdebr profile image
sanderdebr • Edited

True thanks for the tip! Hooking this up to, for example, a useReducer() hook would ensure a global state like that, but I thought it would be outside of this tutorial.

Collapse
 
miketalbot profile image
Mike Talbot ⭐ • Edited

Ah I was thinking of adding and event handler for window 'storage' event using useEffect and then refreshing the value if it changed.