Skip to content

Instantly share code, notes, and snippets.

@loopmode
Last active July 25, 2016 22:34
Show Gist options
  • Save loopmode/9b4903195a4984d36032a7ffac690e88 to your computer and use it in GitHub Desktop.
Save loopmode/9b4903195a4984d36032a7ffac690e88 to your computer and use it in GitHub Desktop.
// https://medium.com/@sheepsteak/adding-hot-module-reloading-to-create-react-app-e053fadf569d#.2q2q1mvxs
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import './index.css';
const rootEl = document.getElementById('root');
ReactDOM.render(
<App />,
rootEl
);
if (module.hot) {
module.hot.accept('./App', () => {
const NextApp = require('./App').default;
ReactDOM.render(
<NextApp />,
rootEl
);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment