How to store redux store to localstorage and get it when page refreshed

The issue where the page refresh causes an automatic logout typically occurs because the token is not being persisted across page reloads. in react redux How can i fix it?
2 Replies
John Patrick Onyango
like @b1mind said, it's not recommended to store JWT in local storage, but if you have to just check for your token within local storage before initializing your state, if it does exist set it as the initial value of state in your redux slice