← All notes

Layouts and pages in the App Router

Answer: Next.js uses file-system based routing. A page file defines UI that is unique to a route. A layout is UI that is shared between multiple pages and keeps state across navigations.

File-system routing

Folders and files under app define routes.

Pages and layouts

Add a page file that default-exports a React component. Define a layout by default exporting a React component from a layout file. On navigation, layouts preserve state, remain interactive, and do not rerender.

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Copyright (c) 2025 Vercel, Inc. Sources: Next.js docs (vercel/next.js on GitHub / nextjs.org), MIT (https://raw.githubusercontent.com/vercel/next.js/canary/license.md). Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Next.js docs, Layouts and pages, MIT (vercel/next.js); Next.js docs, page.js, MIT (vercel/next.js). Copyright (c) 2025 Vercel, Inc. MIT (https://raw.githubusercontent.com/vercel/next.js/canary/license.md).

Cite this

Permanent ID: iil:note:fwtcred0

iinventedlight. 2026. "Layouts and pages in the App Router." iinventedlight Library, iil:note:fwtcred0, version of 2026-11-09. https://iinventedlight.com/library/notes/nextjs-layouts-and-pages/. License: CC-BY-4.0.

@misc{iil_note_fwtcred0,
  author = {{iinventedlight}},
  title = {{Layouts and pages in the App Router}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-09},
  url = {https://iinventedlight.com/library/notes/nextjs-layouts-and-pages/},
  note = {Permanent ID iil:note:fwtcred0. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com.

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/nextjs-layouts-and-pages.md.