Create a nested router possible? #334
-
The documentation shows how to create nested routes. Is it already possible to nest routers? If so, how? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
From my understanding, the general idea of the Usually, what you would do is just define all your routes in one |
Beta Was this translation helpful? Give feedback.
-
Nested routes are not the same as nested |
Beta Was this translation helpful? Give feedback.
-
It's Ok. Amy Baudom |
Beta Was this translation helpful? Give feedback.
From my understanding, the general idea of the
Router
component is that you only have one in your app. If you were to nest them, which router would control which page transition? I'm struggling to think of a use case in which you would ever need more than one router, what exactly do you have in mind?Usually, what you would do is just define all your routes in one
enum
(as is documented) and then provide that to the router. Then, it will automatically pick up any links in your app to internal pages (e.g. an anchor element withhref = "about"
) and prevent the default browser behavior of loading the new page, instead just replacing theView
, reducing the number of requests that need to be m…