Unable to click in ui after component get rendered in react

Viewed 56

I am working with react. when I make changes in a file, after saving the file, my component gets rendered but I am not able to click/interact with the webpage. I need to refresh it again then only I can interact with the webpage. index.js file.

import React from "react";
import ReactDOM from "react-dom";
import { Provider } from "react-redux";
import { BrowserRouter } from "react-router-dom";
import store from "./helpers/store";
import * as serviceWorker from "./serviceWorker";
import { App } from "./app";

ReactDOM.render(
  <Provider store={store}>
    <BrowserRouter>
      <App />
    </BrowserRouter>
  </Provider>,
  document.getElementById("root")
);

if (module.hot) {
  module.hot.accept();
}

serviceWorker.unregister();
1 Answers

Try this:

module.hot.accept('./App.js', () => {
  const NextApp = require('./App.js').default;
  ReactDOM.render(<NextApp />);
});
Related