From 9983c19c897ec4d7526120c0826c705ee69d0c24 Mon Sep 17 00:00:00 2001 From: Chris Shepherd Date: Sat, 23 Jul 2016 13:00:00 +0100 Subject: [PATCH] Adds simple HMR --- template/src/index.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/template/src/index.js b/template/src/index.js index 54c5ef1a427..cfcebe3196e 100644 --- a/template/src/index.js +++ b/template/src/index.js @@ -3,7 +3,19 @@ import ReactDOM from 'react-dom'; import App from './App'; import './index.css'; +const rootEl = document.getElementById('root'); + ReactDOM.render( , - document.getElementById('root') + rootEl ); + +if (module.hot) { + module.hot.accept('./App', () => { + const NextApp = require('./App').default; + ReactDOM.render( + , + rootEl + ); + }); +}