Skip to content

Instantly share code, notes, and snippets.

@ORESoftware
Created February 23, 2020 22:49
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save ORESoftware/d788666643484284a9ec01910d9d7f28 to your computer and use it in GitHub Desktop.
Our index.jsx file
import Root from './root.jsx'
ReactDOM.render(
<Root/>,
document.getElementById('app')
);
if (module.hot) {
// this is necessary for HMR, the only thing we need for the whole app which is nice
module.hot.accept('./root.jsx', () => {
const NextRootContainer = require('./root.jsx').default;
ReactDOM.render(<NextRootContainer/>, document.getElementById('app'));
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment