Skip to content

Instantly share code, notes, and snippets.

@AllGistsEqual
Created May 1, 2020 14:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AllGistsEqual/5df8ca25ef15bf01f496ea32bb1eb1cc to your computer and use it in GitHub Desktop.
Save AllGistsEqual/5df8ca25ef15bf01f496ea32bb1eb1cc to your computer and use it in GitHub Desktop.
import { applyMiddleware, createStore } from 'redux'
import { persistStore, persistReducer } from 'redux-persist'
import { AsyncStorage } from 'react-native'
import rootReducer from './reducers/rootReducer'
import middleware from './middleware'
const persistConfig = {
key: 'root',
storage: AsyncStorage,
}
const persistedReducer = persistReducer(persistConfig, rootReducer)
const store = createStore(
persistedReducer,
applyMiddleware(
...middleware,
),
)
export const persistor = persistStore(store)
export default store
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment