Created
July 31, 2016 20:10
-
-
Save banjeremy/9c7fcdef588f239779ae4c7efa1e1dd7 to your computer and use it in GitHub Desktop.
HMR for create-react-app
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
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