Skip to content

Instantly share code, notes, and snippets.

@JimmyLv
Last active March 2, 2017 09:49
Show Gist options
  • Select an option

  • Save JimmyLv/bb15ea721c21ad739b0b4a6acddcf6c3 to your computer and use it in GitHub Desktop.

Select an option

Save JimmyLv/bb15ea721c21ad739b0b4a6acddcf6c3 to your computer and use it in GitHub Desktop.
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