LEE.SANG.MIN
LEE.SANG.MIN

Reputation: 151

persist token even after the browser tab is closed

The login token is being archived using local storage in the react. I want to keep the token intact even if I remove the browser's tab and delete the login information by removing the token when I remove the browser itself. Session storage cannot be used because information disappears when a tab is deleted Does anyone know how to do this?

Upvotes: 0

Views: 1977

Answers (1)

Prateek Thapa
Prateek Thapa

Reputation: 4938

Use localStorage instead. The API is the same. And it persists even after the tab is closed.

You could read the docs here => https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage

Upvotes: 1

Related Questions