Skip to content

[Docs]: How to use Layout #13122

@GOKORURI007

Description

@GOKORURI007

Describe what's incorrect/missing in the documentation

When initializing a React Router project with Vite, a Layout function is generated in root.tsx. I'm having trouble understanding how the children here interact with the <Outlet> in App. I hope the documentation can provide clearer explanations.

export function Layout({ children }: { children: React.ReactNode }) {
  return (
    <html lang="en">
      <head>
        <meta charSet="utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1" />
        <Meta />
        <Links />
      </head>
      <body>
        {children}
        <ScrollRestoration />
        <Scripts />
      </body>
    </html>
  );
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions