Next.js · Junior · Question 4 of 75

How does layout.tsx differ from page.tsx?

Explanation

A layout receives children and holds UI shared by nested routes (header, sidebar). When navigating between child pages, the layout doesn't remount: its state and DOM are preserved, and only the changed part renders. Both layout and page are Server Components by default.

Further reading

Problem with a question

Next.js · Junior · question 4

Test yourself

Take the Next.js · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz