SHARE
TWEET

Untitled

a guest Mar 20th, 2019 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import { createStore } from 'redux'
  2. import { persistStore, persistReducer } from 'redux-persist'
  3. import storage from 'redux-persist/lib/storage' // defaults to localStorage for web and AsyncStorage for react-native
  4. import hardSet from 'redux-persist/lib/stateReconciler/hardSet'
  5.  
  6. import rootReducer from './reducers'
  7.  
  8. const persistConfig = {
  9.     key: 'root',
  10.     storage,
  11.     whitelist: ['visibilityFilter'] // navigation will not be persisted
  12. }
  13.  
  14. const persistedReducer = persistReducer(persistConfig, rootReducer)
  15.  
  16. export default () => {
  17.     let store = createStore(persistedReducer);
  18.     let persistor = persistStore(store);
  19.     return { store, persistor }
  20. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top