Use React Hot Loader 3 instead of React Transform

This commit is contained in:
Ken-Håvard Lieng 2017-04-12 00:00:59 +02:00
parent ee42e5300a
commit ee43d2fe27
5 changed files with 48 additions and 47 deletions

View file

@ -2,6 +2,7 @@ import React from 'react';
import { render } from 'react-dom';
import { browserHistory } from 'react-router';
import { syncHistoryWithStore, replace } from 'react-router-redux';
import { AppContainer } from 'react-hot-loader';
import 'react-virtualized/styles.css';
import configureStore from './store';
@ -50,7 +51,17 @@ handleSocket(socket, store);
const routes = createRoutes();
const history = syncHistoryWithStore(browserHistory, store);
render(
<Root store={store} routes={routes} history={history} />,
document.getElementById('root')
);
const renderRoot = () => {
render(
<AppContainer>
<Root store={store} routes={routes} history={history} />
</AppContainer>,
document.getElementById('root')
);
};
renderRoot();
if (module.hot) {
module.hot.accept('./routes', () => renderRoot());
}