21 lines
590 B
JavaScript
21 lines
590 B
JavaScript
|
import { AsyncStorage } from "react-native";
|
||
|
import { persistReducer, persistStore } from "redux-persist";
|
||
|
import { createStore, applyMiddleware } from "redux";
|
||
|
import thunk from 'redux-thunk';
|
||
|
import rootReducer from "./reducers";
|
||
|
|
||
|
|
||
|
|
||
|
const persistConfig = {
|
||
|
key: 'root',
|
||
|
storage: AsyncStorage,
|
||
|
whitelist: [],
|
||
|
blacklist: []
|
||
|
};
|
||
|
|
||
|
const persistedReducer = persistReducer(persistConfig, rootReducer);
|
||
|
const middlewares = [thunk];
|
||
|
const store = createStore(persistedReducer, applyMiddleware(...middlewares));
|
||
|
let persistor = persistStore(store);
|
||
|
|
||
|
export { store, persistor };
|