/
client.js
32 lines (26 loc) · 888 Bytes
/
client.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
import React from 'react';
import { AppContainer } from 'react-hot-loader';
import { render } from 'react-dom';
import configureStore from './common/store/configureStore';
import Root from './common/components/Root';
const { hash, pathname, search } = window.location;
const url = pathname + search + hash;
configureStore({ url }).then( store => {
render(
<AppContainer>
<Root store={ store } />
</AppContainer>,
document.querySelector( '.app' )
);
if ( __DEVELOPMENT__ && module.hot ) {
module.hot.accept([ './common/components/Root', './common/store/configureStore' ], () => {
const NextRoot = require( './common/components/Root' ).default;
render(
<AppContainer>
<NextRoot store={ store } />
</AppContainer>,
document.querySelector( '.app' )
);
});
}
}).catch( console.error.bind( console ));