Nested routes in react-router

后端 未结 3 652
青春惊慌失措
青春惊慌失措 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条回答
  •  半阙折子戏
    2020-12-14 01:54

    The configuration isn't about the routing (despite the name) but more about the layouts driven by paths.

    So, with this configuration:

    
      
    
    

    It is saying that dashboard-child is to be embedded inside dashboard. How this works is that if dashboard has something like this:

    Dashboard

    and dashboard-child has:

    I'm a child of dashboard.

    Then for the path dashboard there is no embedded child due to no matching path, resulting in this:

    Dashboard

    And for the path dashboard/dashboard-child the embedded child has a matching path, resulting in this:

    Dashboard

    I'm a child of dashboard.

提交回复
热议问题