首页 > 其他 > 详细

hash history cannot push state it is ignored

时间:2020-01-13 12:01:13      阅读:116      评论:0      收藏:0      [点我收藏+]

react-router4.x有三种模式:

BrowserRouter
HashRouter
MemoryRouter

在使用HashRouter进行开发过程中,会遇到这个问题

Warning: hash history cannot push state it is ignored

hash模式下不能进行push state操作,解决办法是使用1,不使用2

this.props.history.push({ pathname: `${url}`, state: { nodeType: nodeType }}) //1
this.props.history.push(`${url}`, { nodeType: nodeType })  //2

hash history cannot push state it is ignored

原文:https://www.cnblogs.com/GraceY/p/12186592.html

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