@@ -3,39 +3,21 @@ import React from 'react';
33import ReactDOM from 'react-dom' ;
44import { Provider } from 'react-redux' ;
55import { ConnectedRouter } from 'react-router-redux' ;
6- import { AppContainer } from 'react-hot-loader' ;
76import createHistory from 'history/createBrowserHistory' ;
87import configureStore from 'store' ;
98import App from 'containers/App' ;
109
11- const history = createHistory ( ) ;
12-
13- // The root element of your app
14- const rootElement = document . getElementById ( 'app' ) ;
15-
16- // Creates the Redux store based on the initial state passed down by the server
17- // rendering.
10+ // Hydrate the redux store from server state.
1811const initialState = window . __INITIAL_STATE__ ;
12+ const history = createHistory ( ) ;
1913const store = configureStore ( initialState , history ) ;
2014
21- const render = ( Component ) => {
22- ReactDOM . hydrate (
23- < Provider store = { store } >
24- < AppContainer >
25- < ConnectedRouter history = { history } >
26- < Component />
27- </ ConnectedRouter >
28- </ AppContainer >
29- </ Provider > ,
30- rootElement
31- ) ;
32- } ;
33-
34- render ( App ) ;
35-
36- if ( module . hot ) {
37- // We need to re-require the main App module.
38- module . hot . accept ( '../common/js/containers/App' , ( ) => {
39- render ( require ( '../common/js/containers/App' ) . default ) ;
40- } ) ;
41- }
15+ // Render the application
16+ ReactDOM . hydrate (
17+ < Provider store = { store } >
18+ < ConnectedRouter history = { history } >
19+ < App />
20+ </ ConnectedRouter >
21+ </ Provider > ,
22+ document . getElementById ( 'app' )
23+ ) ;
0 commit comments