InterviewBuddy
All interview questions

What is the role of a layout in the App Router?

Beginner

Answer

A layout wraps a route segment and its children, providing shared UI such as navigation. A root layout defines the HTML and body elements.

Explanation

Layouts preserve shared structure during navigation. Put route-specific content in pages and shared chrome in layouts.

Example

app/layout.tsx → root; app/dashboard/layout.tsx → dashboard section