Nested routes #9814
-
I have 2 route files in my project
Both of these routes work on their own but if I have both of them then only the /company-ad/13 works. When I go to the /company-ad/11/project/2 it open the /company-ad/13, the url is still /company-ad/11/project/2 but the page contents is of the /company-ad/13. But then when I remove the company-ad.$id file the route with the project works fine. What I assume the reason for this is because it get the one it matches first. But is this the intended logic? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
Beta Was this translation helpful? Give feedback.
company-ad.$id
is actually a layout route, not a leaf route. In order for any sub-routes to render their components, you either need to<Outlet>
somewhere insidecompany-ad.$id
, which is where the leaf route will rendercompany-ad.$id
tocompany-ad.$id._index
so it is no longer treated as a layout route.