If you mean across page loads (or app loads in React Native), you can use the addCallback
helper function to write it to persistent storage.
Use the setGlobal
helper function to set the state from localStorage
, and use addCallback
to write to localStorage
on state change.