-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
40 lines (36 loc) · 1.24 KB
/
index.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
37
38
39
40
import React from 'react';
import ReactDOM from 'react-dom';
import { BrowserRouter } from 'react-router-dom';
import { Provider } from 'react-redux';
import { PersistGate } from 'redux-persist/integration/react';
import { compose, lifecycle } from 'recompose';
import * as serviceWorker from './serviceWorker';
import './index.css';
import App from './layouts/App';
import { store, persistor } from './store/store';
import * as appOperations from './modules/app/appOperations';
import Loader from './components/Loader/Loader';
const InitAppComponent = () => (
<Provider store={store}>
<PersistGate loading={<Loader />} persistor={persistor}>
<BrowserRouter>
<App />
</BrowserRouter>
</PersistGate>
</Provider>
);
const InitApp = compose(
lifecycle({
componentDidMount() {
store.dispatch(appOperations.init());
},
}),
)(InitAppComponent);
ReactDOM.render(
<InitApp />,
document.getElementById('root'), // eslint-disable-line
);
// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: http://bit.ly/CRA-PWA
serviceWorker.unregister();