Lesson 4.39mIntermediate7.9k students

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.

This lesson sits in Server Actions and Mutations, part of Next.js App Router in Depth. It assumes what came before it and leads directly into the next lesson in the module.

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