-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
35 lines (30 loc) · 820 Bytes
/
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
import React from 'react';
import ReactDOM from 'react-dom';
import { createBrowserHistory } from 'history';
import { AppContainer } from 'react-hot-loader';
import { BrowserRouter } from 'react-router-dom';
import Hydrate from 'Core/components/Hydrate';
import App from './App';
const history = createBrowserHistory();
const { IS_CLIENT } = process.env;
if (IS_CLIENT) {
history.location = window.location;
}
const render = App =>
ReactDOM.hydrate(
<AppContainer>
<BrowserRouter forceRefresh>
<Hydrate>
<App history={history} />
</Hydrate>
</BrowserRouter>
</AppContainer>,
document.getElementById('root')
);
if (process.env.NODE_ENV === 'development' && module.hot) {
module.hot.accept('./App.jsx', () => {
const Main = require('./App').default;
render(Main);
});
}
render(App);