T
TanStack4mo ago
fair-rose

Layout only files

Hey guys, here is my test of files/folders structure for my auth part. My goal is to have: - /login (login page) - /active/{generate/check/post} - /password/{generate/check/reset} But i'm a bit annoyed because actually there is a route for /activate and /password, but both password.tsx and activate.tsx are only here to define a base layout of the related folder. I don't want to give a route to those files. How can I achieve this ?
No description
4 Replies
fair-rose
fair-roseOP4mo ago
login.tsx is a real page, not a layout. I also feel that the 2 other files can confuse because we can think "oh its the activate page", where it is only a layout Would be awesome if I can have special suffix or something to define layout only files
genetic-orange
genetic-orange4mo ago
not clear to me what you want to do here you need to distinguish e.g. check from activate vs. check from password
other-emerald
other-emerald4mo ago
I think some quick pointers here to help: - if you use _ in front of a file you can then nest items inside a directory with same name and they will use the layout (i.e. _full-page.tsx and _full-page/foobar.tsx - if you use () the router will bypass the directory completely as its only used for organization - if your use - i.e. -components/ anything inside will not be apart of the routes more details here: https://tanstack.com/router/latest/docs/framework/react/routing/file-based-routing#directory-routes
File-Based Routing | TanStack Router React Docs
Most of the TanStack Router documentation is written for file-based routing and is intended to help you understand in more detail how to configure file-based routing and the technical details behind h...
other-emerald
other-emerald4mo ago
So FYI based on your question just prefix with _

Did you find this page helpful?