-
Notifications
You must be signed in to change notification settings - Fork 0
/
store.js
21 lines (16 loc) · 762 Bytes
/
store.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import { createStore, applyMiddleware } from 'redux'
import { persistReducer } from 'redux-persist'
import { composeWithDevTools } from 'redux-devtools-extension'
import thunkMiddleware from 'redux-thunk'
import storage from 'redux-persist/lib/storage' // defaults to localStorage for web and AsyncStorage for react-native
import rootReducer from './reducers';
const persistConfig = {
key: 'root',
storage,
}
const persistedReducer = persistReducer(persistConfig, rootReducer)
const exampleInitialState = {}
// A create store function for `withReduxStore` context wrapper
export function initializeStore (initialState = exampleInitialState) {
return createStore(persistedReducer, initialState, composeWithDevTools(applyMiddleware(thunkMiddleware)))
}