Created
August 29, 2018 18:33
-
-
Save kllaudyo/7bb33ce49d6bc2a02a502686ec02df5e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createStore, applyMiddleware } from 'redux'; | |
import { composeWithDevTools } from 'redux-devtools-extension'; | |
import thunk from 'redux-thunk'; | |
import reducer from "../reducers"; | |
const store = createStore( | |
reducer, | |
(localStorage['store']) ? | |
JSON.parse(localStorage['store']) : | |
{}, | |
composeWithDevTools( | |
applyMiddleware (thunk) | |
) | |
); | |
store.subscribe(()=> localStorage['store'] = JSON.stringify(store.getState())); | |
export default store; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment