TanStackT
TanStack7mo ago
1 reply
broad-emerald

Dynamic Route + Static Match

What would be the best practice to use dynamic routing but also have specific logic for a specific route?

For instance, /$branch/$step maintains top level logic and layout, but I want to do something special if route is /foo/*? I was hoping to separate the logic from the /$branch/$step file.

I have tried /_foo route but get an invariant error at runtime. Ref. https://tanstack.com/router/latest/docs/framework/react/routing/routing-concepts#pathless-layout-routes
image.png
image.png
image.png
TanStack Router supports a number of powerful routing concepts that allow you to build complex and dynamic routing systems with ease. Each of these concepts is useful and powerful, and we'll dive into...
Routing Concepts | TanStack Router React Docs
Was this page helpful?