Feature for easy to implement.
npm install redux-simple-localstorage1
import {applyMiddleware, compose, createStore} from "redux"
import reducer from './reducers/index.js'
import logger from 'redux-logger'
import thunk from 'redux-thunk'
import { saveStore, initial } from 'redux-simple-localstorage1'
let finalCreateStore = compose(
applyMiddleware(thunk, logger(), saveStore('reduxStore'))
)(createStore);
export function configureStore(initialState){
return finalCreateStore(reducer, initial(initialState))
}
- saveStore
saveStore('Choose a name for LocalStorage key.');
- initial
initial('Just pass the initialState of your application.')
Your store is now saved in the LocalStorage.