Closed
Description
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"
?