路径参数名称在React-Router-dom中如何处理?
home/user/:id/friends/:id
function SomeComponent() {
const { id } = useParams();
}
这里将使用哪个ID
?有名字冲突。
home/user/:id/friends/:id
function SomeComponent() {
const { id } = useParams();
}
Which id
will be used here? There are name conflicts.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
路径的最后一个参数是任何组件都会看到的值。
这对于测试是微不足道的。
示例:
不要在每个路径字符串中使用相同的路径参数,路线。
The last parameter of the path is the value that any component will see.
This is trivial to test.
Example:
Don't use the same path parameter twice in the same path string per route.