美文网首页
react-router 中 path 和 url 的关系

react-router 中 path 和 url 的关系

作者: xcyzjs | 来源:发表于2020-09-16 13:37 被阅读0次
// jsx
let match = useRouteMatch()
console.log(match)
    // isExact: true
    // params: {topicId: "6"}
    // path: "/topics/:topicId"
    // url: "/topics/6"
  • 在动态路由中
    其中, path 指的是路由的名称, 路径;
    url 指的是当前页面真实的地址, 也就是地址栏中显示的 url

  • 在非动态路由中, 二者是一样的

相关文章

网友评论

      本文标题:react-router 中 path 和 url 的关系

      本文链接:https://www.haomeiwen.com/subject/xrgcyktx.html