problem description
if you modify the router, the browser will refresh, and the rest will be hot replaced. This is the result of the present
search for things related to hot replacement plug-ins. I would like to ask what is the intention of the first parameter of these two parameters
the environmental background of the problems and what methods you have tried
here, it doesn"t go into details ( https://github.com/brickspert.)
and why the callback function can"t use getRouter () directly but require again
related codes
/ / Please paste the code text below (do not replace the code with pictures)
import React, {Component} from "react";
import ReactDOM from" react-dom";
import {AppContainer} from "react-hot-loader";
import getRouter from". / src/router";
const boot = (elements) = > {
ReactDOM.render(
<AppContainer>
{elements}
</AppContainer>
, document.getElementById("app"));
}
let rs = getRouter ();
boot (rs);
if (module.hot) {
module.hot.accept("./src/router", ()=> {
boot(require("./src/router").default())
});
}