react-router链接和路由问题

时间:2017-11-01 04:45:19

标签: reactjs react-router

听到我将链接参数传递给路由器

<Link to={'/brokerageListEdit/'+row.id} className="btn btn-warning">
   <span className="glyphicon glyphicon-pencil"></span>
</Link> 

听说我在路由器中收到了这个参数

<Route path='brokerageListEdit/:id' component={requireAuth(BrokerageListEdit)}/>

当我点击链接时,我发现了这个错误 bundle.js:3274警告:[react-router]位置“/ brokerageListEdit / 7”与任何路线都不匹配

react-router version - 2.5.0

1 个答案:

答案 0 :(得分:0)

只需编写完整的配置:

  <Router>
    <Route path="/" component={App}>
      <IndexRoute component={Home}/>
      <Route path='brokerageListEdit/:id' component={requireAuth(BrokerageListEdit)}/>
    </Route>
  </Router>
  • 被修改