-
Notifications
You must be signed in to change notification settings - Fork 7
/
store.js
30 lines (25 loc) · 935 Bytes
/
store.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import ExpoFileSystemStorage from "redux-persist-expo-filesystem"
//import autoMergel1 from 'redux-persist/lib/stateReconciler/autoMergeLevel1'
import { createStore, applyMiddleware} from "redux";
import { createLogger } from "redux-logger";
import { persistStore, persistReducer } from "redux-persist";
import rootReducer from "./reducers";
//middleware for persistent storage
const persistConfig = {
key: "root",
storage: ExpoFileSystemStorage,
whitelist: ["saveComponents", "currentUser", "miscData"],
blacklist: ["basicComponents"],
keyPrefix: '',
//stateReconciler: autoMergel1,
//version: 1
};
const persistentReducer = persistReducer(persistConfig, rootReducer);
const DEBUG = false;
const middlewares = [DEBUG && createLogger()].filter(Boolean);
const store = createStore(persistentReducer,{}, applyMiddleware(...middlewares));
const persistor = persistStore(store);
export default {
store,
persistor
};