T
TanStack15mo ago
fair-rose

Layout for dynamic params

I'm trying to get a route layout to match two dynamics params pages, I'm trying creating a _layoute.tsx page inside the outer $id params but it doesn't seems working /search $id _layoute.tsx $secondId
No description
2 Replies
robust-apricot
robust-apricot15mo ago
Layout routes require a route configuration (_layout.tsx) and a folder/prefixed segment with routes in it. You can achieve this using a nested or flat file structure.
// nested
src/routes
out-layout.tsx // localhost/out-layout
_layout.tsx
_layout/
in-layout.tsx // localhost/in-layout
// nested
src/routes
out-layout.tsx // localhost/out-layout
_layout.tsx
_layout/
in-layout.tsx // localhost/in-layout
// flat
src/routes
out-layout.tsx // localhost/out-layout
_layout.tsx
_layout.in-layout.tsx // localhost/in-layout
// flat
src/routes
out-layout.tsx // localhost/out-layout
_layout.tsx
_layout.in-layout.tsx // localhost/in-layout
https://tanstack.com/router/latest/docs/framework/react/guide/routing-concepts#pathless--layout-routes
Routing Concepts | TanStack Router React Docs
TanStack Router supports a number of powerful routing concepts that allow you to build complex and dynamic routing systems with ease. The Root Route
robust-apricot
robust-apricot15mo ago
If you need further help with using layout routes, please create a reproduction on Stackblitz and post it here. Router stackblitz starter
StackBlitz
Router Quickstart File Based Example - StackBlitz
Run official live example code for Router Quickstart File Based, created by Tanstack on StackBlitz

Did you find this page helpful?