Created
July 9, 2017 21:58
-
-
Save barberdt/9fb958aee519e16819bfbf9c25934db5 to your computer and use it in GitHub Desktop.
react-hot-loader
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 { AppContainer } from 'react-hot-loader'; | |
import Test from './components/Test'; | |
global.document.addEventListener('DOMContentLoaded', () => { | |
ReactDOM.render( | |
<AppContainer> | |
<Test /> | |
</AppContainer>, | |
global.document.getElementById('container'), | |
); | |
}); | |
if (module.hot) { | |
module.hot.accept('./components/Test', () => { | |
// eslint-disable-next-line | |
const NextTest = require('./components/Test').default; | |
ReactDOM.render( | |
<AppContainer> | |
<NextTest /> | |
</AppContainer>, | |
global.document.getElementById('container'), | |
); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment