不添加 history 时,来回点击 Link 会在控制台报错如下
Warning: Hash history cannot PUSH the same path; a new entry will not be added to the history stack
解决方案是安装使用 history 模块
import createBrowserHistory from "history/createBrowserHistory";
const customHistory = createBrowserHistory();
<Router history = {customHistory} />