1
I have three rooms:
import { combineReducers } from 'redux';
import formularios from './formReducer';
import userLogin from './userReducer';
import errorReducer from './errorReducer';
export default combineReducers({
formReducer: formularios,
userReducer: userLogin,
errorReducer: errorReducer
});
Problem
They work properly, but if I refresh the page, it returns the state of the store to the initial state, so I lose the user data, would it work anyway? As I would save the data of the logged-in user, I managed with localStorage and sessionStorage, but it would be the best practice?
Obs: It’s my first time here, if any information is missing, please inform me, I’m learning to use the tool.
Yes, that is the expected behavior. As for "how to store", it depends on the case. It may be local Storage, and there are also packages you can use like the Redux-persist or Redux-Storage. I recommend taking a look to see if it makes sense in your case
– Rafael Tavares
Thanks @Rafaeltavares, I read about the Redux-persist, will meet my need, simple and objective answer, thank you.
– Pedro Miguel