Created
February 17, 2018 15:12
-
-
Save aofleejay/c055fd3f2327215d2e617bcacebd798f to your computer and use it in GitHub Desktop.
Config store with redux-persist
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 } from 'redux' | |
import { persistStore, persistReducer } from 'redux-persist' | |
import storage from 'redux-persist/lib/storage' | |
import rootReducer from '../reducers' | |
const persistConfig = { | |
key: 'root', | |
storage, | |
} | |
const persistedReducer = persistReducer(persistConfig, rootReducer) | |
export default () => { | |
let store = createStore(persistedReducer) | |
let persistor = persistStore(store) | |
return { store, persistor } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment