Nested routes in react-router

后端 未结 3 645
青春惊慌失措
青春惊慌失措 2020-12-14 01:03

I\'m setting up some nested routes within React-Router (v0.11.6 is what I\'m working against) but whenever I try and access one of the nested routes it triggers the parent r

3条回答
  •  萌比男神i
    2020-12-14 01:44

    Here's an update to @bjfletcher's answer for react-router 1.0.0. As noted in the upgrade guide:

    RouteHandler is gone. Router now automatically populates this.props.children of your components based on the active route.

    So instead of

    Dashboard

    you would use:

    Dashboard

    {this.props.children}

提交回复
热议问题