Replies: 3 comments 14 replies
-
I tried this too.... not working...
|
Beta Was this translation helpful? Give feedback.
-
Local Storage is preserved. I think you are talking about |
Beta Was this translation helpful? Give feedback.
-
Hello, you can handle that with some hooks.
But if you want to detect the browser/tab closing events you can use the useBeforeUnload hook via the "react-use" library An example from my code:
cheers ✌ |
Beta Was this translation helpful? Give feedback.
-
Summary
This might be the wrong of thinking... but I am trying to use the localStorage to keep a sessionId.... then check if the sessionId still valid on the browser, and if not, then trigger a function....
The localStore is supposed to eliminate all information once the tab is closed, but if the the tab is closed, how can you check for an item at the localStore?
What would be the best way to do this?
So far I got this, but this isn't doing anything:
^^^ Oh yes, besides this doing nothing when the tab is closed, it also keeps changing the value of the sessionId on every refresh, which doesn't help keep track of the session..
Additional information
No response
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions