Skip to content
Source
Sign inSign up
TanStack/router

docs(start): explain that layout routes must render <Outlet> #7852

Opendeeferentleeg(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/7852/headopened

Showing 1 changed file with 23 additions and 0 deletions.

x
0 of 1 viewed, 1 left
23 additions and 0 deletionsdocs/start/framework/react/guide/routing.mdModified
View file
@@ -172,6 +172,8 @@
</Root>
```
​
+For this tree to render, the `posts.tsx` layout route's component must render an [`<Outlet />`](#defining-routes) — that's where the matching child route (`<Post />`) is displayed. Without `<Outlet />`, only the `<Posts>` component renders and the child route will not appear.
Thread on line 175

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Fix both links to the Outlet documentation. Both additions use #defining-routes, which points to the “Defining Routes” section rather than the existing “The Outlet Component” section.

  • docs/start/framework/react/guide/routing.md#L175-L175: replace the anchor with the correct Outlet-section link.
  • docs/start/framework/react/guide/routing.md#L207-L208: replace the repeated incorrect anchor and follow the relative documentation-link convention.
📍 Affects 1 file
  • docs/start/framework/react/guide/routing.md#L175-L175 (this comment)
  • docs/start/framework/react/guide/routing.md#L207-L208
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/start/framework/react/guide/routing.md` at line 175, Update both Outlet
documentation links in docs/start/framework/react/guide/routing.md at lines
175-175 and 207-208 to use the existing “The Outlet Component” section anchor
instead of `#defining-routes`, preserving the relative documentation-link
convention at the sibling site.

Source: Coding guidelines

+​
## Types of Routes
​
There are a few different types of routes that you can create in your project.
@@ -202,6 +204,27 @@
| `/posts/:postId` | `posts/$postId.tsx` | Dynamic Route |
| `/rest/*` | `rest/$.tsx` | Wildcard Route |
​
+> [!NOTE]
+> A file like `posts.tsx` is a **layout route** that wraps its child routes (`posts/index.tsx`, `posts/$postId.tsx`). Its component **must render an [`<Outlet />`](#defining-routes)** for the matching child route to appear. The route generator creates a placeholder component for `posts.tsx` that does not include `<Outlet />`, so when you intend `posts.tsx` to be a layout you need to add it manually — otherwise navigating to `/posts/123` renders only the `posts.tsx` component and the child never shows up.
+>
+> ```tsx