Lesson 1.2

Layouts, templates, and shared UI

Layouts persist across navigations and keep their state; templates remount on every navigation. Choosing the wrong one is why your sidebar scroll position keeps resetting.

Duration
6m
Level
Intermediate
Students
17k students

Overview

Layouts persist across navigations and keep their state; templates remount on every navigation. Choosing the wrong one is why your sidebar scroll position keeps resetting.

In this lesson you will:

  • Nest layouts to share chrome across a section
  • Know when state persistence makes a template the wrong choice
  • Colocate loading and error UI with the layout it belongs to

Resources

Next.js documentation

The official reference for the tools used in this lesson.