Skip to content

Instantly share code, notes, and snippets.

@cezarderevlean
Created October 25, 2017 08:03
Show Gist options
  • Save cezarderevlean/7bb60e752843becd84d00d062600637f to your computer and use it in GitHub Desktop.
Save cezarderevlean/7bb60e752843becd84d00d062600637f to your computer and use it in GitHub Desktop.
HMR index example
import React from 'react';
import ReactDOM from 'react-dom';
import { AppContainer } from 'react-hot-loader';
import App from './app/App.jsx';
import './styles/main.scss';
const render = Component => {
ReactDOM.render(
<AppContainer>
<Component />
</AppContainer>,
document.getElementById('root')
);
};
render(App);
if (module.hot) {
module.hot.accept('./app/App.jsx', () => { render(App); });
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment