Skip to content

QuizNot attempted

Layout vs template

You navigate between two pages that share a layout.tsx containing a sidebar with a search input. What happens to the input's text?
1–4 to choose, Enter to submit
Show answer & explanation

Correct answer:

  • It is preserved: layouts don't re-mount; only the page segment swaps
  • A layout.tsx stays mounted across navigations within its segment
  • only the page segment below it swaps, so the input's client state survives.
  • Not 'every navigation re-mounts the layout': that is the defining difference from templates.
  • Not 'resets unless template.tsx': backwards, template.tsx is what re-mounts on each navigation.
  • Not a full reload: App Router navigation is client-side.