-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathstore.js
26 lines (24 loc) · 913 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
import {createStore, applyMiddleware} from 'redux';
import {persistReducer, persistStore} from 'redux-persist';
import storage from '@react-native-community/async-storage';
import createSagaMiddleware from 'redux-saga';
import autoMergeLevel2 from 'redux-persist/lib/stateReconciler/autoMergeLevel2';
import saga from './redux/sagas/index';
import rootReducer from './redux/reducers/index';
import immutableTransform from 'redux-persist-transform-immutable';
const sagaMiddleware = createSagaMiddleware();
const persistConfig = {
key: 'root',
storage: storage,
stateReconciler: autoMergeLevel2,
transforms: [immutableTransform()],
blacklist: ['notifications'],
};
const persistReducerr = persistReducer(persistConfig, rootReducer);
export const store = createStore(
persistReducerr,
{},
applyMiddleware(sagaMiddleware),
);
export const persistor = persistStore(store);
sagaMiddleware.run(saga);