Last active
July 8, 2017 09:07
-
-
Save mihir0x69/5761e5bc6e2b2f9fc28fe66331714d25 to your computer and use it in GitHub Desktop.
React hot loader v3
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 { AppContainer } from 'react-hot-loader' | |
import { render } from 'react-dom' | |
import App from './app' | |
const renderApp = (Root) => ( | |
render( | |
<AppContainer> | |
<Root /> | |
</AppContainer>, | |
document.getElementById('app-root') | |
) | |
) | |
renderApp(App) | |
if (module.hot) { | |
module.hot.accept('./app', () => { | |
const NewApp = require('./app').default | |
renderApp(NewApp) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment