add hot reload support
Change-Id: I29cf167e3ec96ffa046d454863f4dbf0eebcd9f4
diff --git a/client/src/index.js b/client/src/index.js
index b39e2f5..f4c1f23 100644
--- a/client/src/index.js
+++ b/client/src/index.js
@@ -3,15 +3,25 @@
import './index.scss';
import App from './App';
//import * as serviceWorker from './serviceWorker';
+const rootEl = document.getElementById('root');
+const render = Component =>
ReactDOM.render(
<React.StrictMode>
- <App />
+ <Component />
</React.StrictMode>,
- document.getElementById('root')
+ rootEl
);
// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: https://bit.ly/CRA-PWA
//serviceWorker.unregister();
+render(App)
+if (module.hot) module.hot.accept('./App', () => {
+ try {
+ render(App)
+ } catch (e) {
+ location.reload()
+ }
+})
\ No newline at end of file