React will update state throughout the user’s session. localStorage won’t change.When the user ends their session, save whatever the state is at that time to localStorage, making it available for hydrating in the next session.
Is this safe/reliable to defer saving until then? What if browser crashes? I guess that's why onbeforeunload is needed. Hopefully onbeforeunload is reliable and can't be skipped (unless browser crashes?).
