From d9ea80fd4322d699cc2d18fc492175fc43c81ca2 Mon Sep 17 00:00:00 2001 From: Daniel Ternyak Date: Fri, 13 Oct 2017 17:50:34 -0700 Subject: [PATCH] Minimal HMR (#294) * Move Root Component to root level * remove Root export from components directory * support Root HMR --- common/{components/Root/index.tsx => Root.tsx} | 0 common/components/index.ts | 1 - common/index.tsx | 13 ++++++++----- 3 files changed, 8 insertions(+), 6 deletions(-) rename common/{components/Root/index.tsx => Root.tsx} (100%) diff --git a/common/components/Root/index.tsx b/common/Root.tsx similarity index 100% rename from common/components/Root/index.tsx rename to common/Root.tsx diff --git a/common/components/index.ts b/common/components/index.ts index ff1aa68b..becccd45 100644 --- a/common/components/index.ts +++ b/common/components/index.ts @@ -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'; diff --git a/common/index.tsx b/common/index.tsx index 4291abe0..1ff384fb 100644 --- a/common/index.tsx +++ b/common/index.tsx @@ -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( - , - document.getElementById('app') -); +const appEl = document.getElementById('app'); + +render(, appEl); if (module.hot) { module.hot.accept('reducers', () => configuredStore.replaceReducer(require('reducers')) ); + + module.hot.accept('./Root', () => { + render(, appEl); + }); }