Skip to content

Add subroute to route in same file with file based routing #1381

Answered by SeanCassiere
wolflu05 asked this question in Q&A
Discussion options

You must be logged in to vote

Your suggested method wouldn't be possible with TSR's file-based routing, since it relies on each file corresponding to a route's configuration.
To get the kind of workflow you mentioned above, you'd have to fallback on code-based routing.

What I can suggest to clear up your file-explorer a bit is to make use of the route groups feature in file-based routing, and segment your routes by folders.

You can use the route group feature by moving the related routes (or just ones you think are part of a group) into a folder with the name surrounded by parenthesis.

src/routes/
  index.tsx

  (user-routes)/
    users.$userId.tsx
    users.index.tsx

  (movies)/
    ...

Reference: https://tanstack.…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@wolflu05
Comment options

Answer selected by wolflu05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants