Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Docs]: Layout section is confusing #13270

Closed
mingxinwei opened this issue Mar 20, 2025 · 0 comments
Closed

[Docs]: Layout section is confusing #13270

mingxinwei opened this issue Mar 20, 2025 · 0 comments
Labels

Comments

@mingxinwei
Copy link

Describe what's incorrect/missing in the documentation

The layout section is confusing.

import {
  type RouteConfig,
  route,
  layout,
  index,
  prefix,
} from "@react-router/dev/routes";

export default [
  layout("./marketing/layout.tsx", [
    index("./marketing/home.tsx"),
    route("contact", "./marketing/contact.tsx"),
  ]),
  ...prefix("projects", [
    index("./projects/home.tsx"),
    layout("./projects/project-layout.tsx", [
      route(":pid", "./projects/project.tsx"),
      route(":pid/edit", "./projects/edit-project.tsx"),
    ]),
  ]),
] satisfies RouteConfig;

To see projects/home.tsx appear in the layout, we'll need an outlet:
./projects/project-layout.tsx

The question is the "./projects/home.tsx" is not inside "./projects/project-layout.tsx", why adding the outlet in the "./projects/project-layout.tsx" will show "./projects/home.tsx"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant