【问题标题】:Url Params in React with React RouterReact 与 React Router 中的 Url 参数
【发布时间】:2016-08-26 00:14:51
【问题描述】:

有谁知道在使用 React Router 时如何在 React 中获取 URL 参数?

我正在尝试做这样的事情:

filterList(key) {
   if (key===this.props.location.query){
    return Blogstore.state.blog
   }

与链接末尾的唯一键匹配:

http://localhost:8080/blogshow/-KGYsxaXyMiej5cgU5A7

【问题讨论】:

    标签: reactjs react-router


    【解决方案1】:

    答案是:

    this.props.routeParams.key
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-10
      • 2018-04-27
      • 2020-01-11
      • 1970-01-01
      相关资源
      最近更新 更多