@@ -3,39 +3,21 @@ import React from 'react';
3
3
import ReactDOM from 'react-dom' ;
4
4
import { Provider } from 'react-redux' ;
5
5
import { ConnectedRouter } from 'react-router-redux' ;
6
- import { AppContainer } from 'react-hot-loader' ;
7
6
import createHistory from 'history/createBrowserHistory' ;
8
7
import configureStore from 'store' ;
9
8
import App from 'containers/App' ;
10
9
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.
18
11
const initialState = window . __INITIAL_STATE__ ;
12
+ const history = createHistory ( ) ;
19
13
const store = configureStore ( initialState , history ) ;
20
14
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