Default children route
I have a root to edit my office
/offices/$id/edit
This root as 3 children roots:
The goal is to show the right form depending of the route (this children are rendered in an <Outlet />
).
How do I make it so that the OfficeEditDescriptionRoute
is the default children route, so that when the user is on /offices/$id/edit
, the Description Route is shown. The other route would be shown based on the path (with the use of navigation).
Thanks5 Replies
firm-tan•2y ago
code based or file based routing?
ideally provide a minimal complete example by forking one of the existing examples on stackblitz
stormy-goldOP•2y ago
I use the code based method.
Every child component is using this format:
The parent root is :
Not sure how StackBlitz works sorry
firm-tan•2y ago
StackBlitz
Router Basic Example - StackBlitz
Run official live example code for Router Basic, created by Tanstack on StackBlitz
firm-tan•2y ago
click on fork and apply your changes
then paste the link here
isn't it enough to define the description route as the index route ?
stormy-goldOP•2y ago
@Manuel Schiller Hi,
Yes it does indeed, I wanted to have the path as
/description
and also be the index if the path is the same as the parent, but I settled for only be the index route.
Thanks !