-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
42 lines (35 loc) · 1.18 KB
/
Copy pathApp.js
File metadata and controls
42 lines (35 loc) · 1.18 KB
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
37
38
39
40
41
42
import React from "react";
import { Provider } from "react-redux";
import { createStore, applyMiddleware, compose } from "redux";
import logger from "redux-logger";
import thunkMiddleware from "redux-thunk";
import { persistStore, persistReducer } from "redux-persist";
import storage from "redux-persist/lib/storage";
import { PersistGate } from "redux-persist/integration/react";
import reducer from "./js/reducers";
import RootNavigator from "./js/navigators/RootNavigator";
const persistConfig = {
key: "root",
storage,
timeout: null,
};
const persistedReducer = persistReducer(persistConfig, reducer);
function configureStore(initialState) {
const enhancer = compose(applyMiddleware(thunkMiddleware, logger));
return createStore(persistedReducer, initialState, enhancer);
}
const store = configureStore({});
const persistor = persistStore(store);
// Uncomment in case you want to delete state from persistant storage.
// persistor.purge();
export default class App extends React.Component {
render() {
return (
<Provider store={store}>
<PersistGate loading={null} persistor={persistor}>
<RootNavigator />
</PersistGate>
</Provider>
);
}
}