I want to save current state of Redux store. There are two options: Local Storage or Cookies. I want to save it in to cookies. First, I save curret state to cookie like that:
this.props.cookies.set('cp', store.getState());
Then to load saved state in reducer I am using this initial state.
let initialState = {}
if (cookies.get('cp')) {
initialState = cookies.get('cp');
} else {
initialState = {
user: {
loggedIn: false,
},
}
}
Is this a good or bad way to save state?