mirror of https://gitlab.com/ceda_ei/sonzai.git
18 lines
482 B
JavaScript
18 lines
482 B
JavaScript
|
import { createStore } from "redux";
|
||
|
import { persistStore, persistReducer } from "redux-persist";
|
||
|
import AsyncStorage from "@react-native-community/async-storage";
|
||
|
import rootReducer from "./reducers";
|
||
|
|
||
|
const persistConfig = {
|
||
|
key: "root",
|
||
|
storage: AsyncStorage,
|
||
|
};
|
||
|
|
||
|
const persistedReducer = persistReducer(persistConfig, rootReducer);
|
||
|
|
||
|
export default () => {
|
||
|
const store = createStore(persistedReducer);
|
||
|
const persistor = persistStore(store);
|
||
|
return { store, persistor };
|
||
|
};
|