Last active
September 25, 2018 13:19
-
-
Save superhighfives/3e9f0f3d2770993ca5e7270863872803 to your computer and use it in GitHub Desktop.
Hot reloading with create-react-app
This file contains hidden or 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