-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAppWrapper.js
36 lines (30 loc) · 1.02 KB
/
AppWrapper.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
31
32
33
34
35
36
import App from "./App";
import user from "./reducers/user";
import activities from "./reducers/activities";
import organizers from "./reducers/organizers";
import { Provider } from "react-redux";
import { configureStore, combineReducers } from "@reduxjs/toolkit";
// redux-persist imports
import { persistStore, persistReducer } from "redux-persist";
import { PersistGate } from "redux-persist/integration/react";
import AsyncStorage from "@react-native-async-storage/async-storage";
const reducers = combineReducers({ user, activities, organizers });
const persistConfig = {
key: "lespetitsexplorateurs",
storage: AsyncStorage,
};
const store = configureStore({
reducer: persistReducer(persistConfig, reducers),
middleware: (getDefaultMiddleware) =>
getDefaultMiddleware({ serializableCheck: false }),
});
const persistor = persistStore(store);
export default function AppWrapper() {
return (
<Provider store={store}>
<PersistGate persistor={persistor}>
<App />
</PersistGate>
</Provider>
);
}