首页 > 其他 > 详细

React 项目使用 React-router-dom 4.0 以上版本时使用 HashRouter 怎么控制 history

时间:2018-10-29 10:01:59      阅读:254      评论:0      收藏:0      [点我收藏+]
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} />

注意引入的 HashRouter 改变成 Router

React 项目使用 React-router-dom 4.0 以上版本时使用 HashRouter 怎么控制 history

原文:https://www.cnblogs.com/zhourongcode/p/9868470.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!