Lesson 4.3

Optimistic updates

Optimistic UI shows the expected result immediately and reconciles when the server answers. The interesting part is what happens when the server disagrees.

Duration
9m
Level
Intermediate
Students
7.9k students

Overview

Optimistic UI shows the expected result immediately and reconciles when the server answers. The interesting part is what happens when the server disagrees.

In this lesson you will:

  • Render the expected state before the server confirms
  • Roll back cleanly when the action fails
  • Keep optimistic state scoped to the component that owns it

Resources

Next.js documentation

The official reference for the tools used in this lesson.