Last active
March 2, 2017 09:49
-
-
Save JimmyLv/bb15ea721c21ad739b0b4a6acddcf6c3 to your computer and use it in GitHub Desktop.
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 { AppContainer } from 'react-hot-loader'; | |
| // AppContainer is a necessary wrapper component for HMR | |
| import App from './components/App'; | |
| const render = (Component) => { | |
| ReactDOM.render( | |
| <AppContainer> | |
| <Component/> | |
| </AppContainer>, | |
| document.getElementById('root') | |
| ); | |
| }; | |
| render(App); | |
| // Hot Module Replacement API | |
| if (module.hot) { | |
| module.hot.accept('./components/App', () => { | |
| render(App) | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment