Skip to content

Instantly share code, notes, and snippets.

@mihir0x69
Last active July 8, 2017 09:07
Show Gist options
  • Save mihir0x69/5761e5bc6e2b2f9fc28fe66331714d25 to your computer and use it in GitHub Desktop.
Save mihir0x69/5761e5bc6e2b2f9fc28fe66331714d25 to your computer and use it in GitHub Desktop.
React hot loader v3
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