Based on this requirement: Users remain logged in only as long as they have their browser open. Is there any recommendation for an SPA to not store JWT tokens in memory?
//app.js
const reducer = (state, action = null) => {
switch (action.type) {
case "SET_TOKEN":
return {
...state,
token: action.token,
};
.............
//login.js
const token = await login(
email.value,
password.value
);
dispatch({ type: "SET_TOKEN", token });