You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/router/framework/react/routing/routing-concepts.md
+44Lines changed: 44 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -318,6 +318,50 @@ The following table shows which component will be rendered based on the URL:
318
318
- The `posts.$postId.tsx` route is nested as normal under the `posts.tsx` route and will render `<Posts><Post>`.
319
319
- The `posts_.$postId.edit.tsx` route **does not share** the same `posts` prefix as the other routes and therefore will be treated as if it is a top-level route and will render `<PostEditor>`.
320
320
321
+
## Excluding Files and Folders from Routes
322
+
323
+
Files and folders can be excluded from route generation with a `-` prefix attached to the file name. This gives you the ability to colocate logic in the route directories.
324
+
325
+
Consider the following route tree:
326
+
327
+
```
328
+
routes/
329
+
├── posts.tsx
330
+
├── -posts-table.tsx // 👈🏼 ignored
331
+
├── -components/ // 👈🏼 ignored
332
+
│ ├── header.tsx // 👈🏼 ignored
333
+
│ ├── footer.tsx // 👈🏼 ignored
334
+
│ ├── ...
335
+
```
336
+
337
+
We can import from the excluded files into our posts route
The excluded files will not be added to `routeTree.gen.ts`.
364
+
321
365
## Pathless Route Group Directories
322
366
323
367
Pathless route group directories use `()` as a way to group routes files together regardless of their path. They are purely organizational and do not affect the route tree or component tree in any way.
0 commit comments