简单的问题。
当我处于例如/dashboard
路由器,我点击<Link to="/users/:userID" >
路由器并尝试返回/dashboard
它对葡萄酒有效,但是从什么时候开始/users/:userID
我导航到另一个路由器/users/:userID
路由器并尝试返回我需要单击后退按钮两次,知道为什么吗?
e.g.
/dashboard -> /users/1 并返回(需要点击 1 次)
/dashboard -> /users/1 -> /users/2 并返回 /users/1(点击 2 次
需要)
这是我在 App.js 中的路线
<Route path='/users/:userId' render={()=><User/>} />
这是我的 User.jsx render()
render() {
let movie = this.props.thisUserIdData;
const { match } = this.props;
console.log(match);
return (
<div> .... </div>
)
}
和 componentDidMount()
componentDidMount() {
this.loadData(this.props.match.params.userId);
//using redux and axios to get data
}
我有类似的嵌套情况onClick
action.
例如:
<div onClick={() => push(`/user/${id}`)}>
<button onClick={() => push(`/user/${id}`)}>to user</button>
</div>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)