目前传参方式:
<Link to={`/topics/${topic.id}`}>{topic.title}</Link>
1、请问传参方式是否正确?
然后跳到下个页面,地址栏为:
http://localhost:8080/topics/33119
本以为this.props.params.id这样能获取参数,但貌似不行。
2、如何获取地址栏参数?
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
已解决,跟react-router还是有些区别的,自问自答:
1、路由配置
2、跳转前页面
3、跳转后页面topics获取参数
根据 router 的地址来决定 id