Minimal HMR (#294)

* Move Root Component to root level

* remove Root export from components directory

* support Root HMR
This commit is contained in:
Daniel Ternyak 2017-10-13 17:50:34 -07:00 committed by GitHub
parent edf7e36836
commit d9ea80fd43
3 changed files with 8 additions and 6 deletions

View File

@ -1,6 +1,5 @@
export { default as Header } from './Header';
export { default as Footer } from './Footer';
export { default as Root } from './Root';
export { default as BalanceSidebar } from './BalanceSidebar';
export { default as PaperWallet } from './PaperWallet';
export { default as AlphaAgreement } from './AlphaAgreement';

View File

@ -3,20 +3,23 @@ import 'assets/styles/etherwallet-master.less';
import 'font-awesome/scss/font-awesome.scss';
import React from 'react';
import { render } from 'react-dom';
import { Root } from './components';
import Root from './Root';
import createHistory from 'history/createBrowserHistory';
import { configuredStore } from './store';
import 'sass/styles.scss';
const history = createHistory();
render(
<Root store={configuredStore} history={history} />,
document.getElementById('app')
);
const appEl = document.getElementById('app');
render(<Root store={configuredStore} history={history} />, appEl);
if (module.hot) {
module.hot.accept('reducers', () =>
configuredStore.replaceReducer(require('reducers'))
);
module.hot.accept('./Root', () => {
render(<Root store={configuredStore} history={history} />, appEl);
});
}