Last active
July 25, 2016 22:34
-
-
Save loopmode/9b4903195a4984d36032a7ffac690e88 to your computer and use it in GitHub Desktop.
index.js with HMR for create-react-app - https://medium.com/@sheepsteak/adding-hot-module-reloading-to-create-react-app-e053fadf569d#.2q2q1mvxs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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