Lesson 3.3

Concurrent rendering with useTransition

Typing must be immediate; the filtered ten-thousand-row list below it does not have to be.

8mAdvanced5.4k students

Overview

Some updates are more urgent than others

Typing must be immediate; the filtered ten-thousand-row list below it does not have to be. A transition tells React that the second update can be interrupted, so a new keystroke pre-empts the in-progress render instead of queueing behind it.

useTransition is for when you control the event that triggers the update and want a pending flag. useDeferredValue is for when you only receive a value as a prop and want to render a lagging copy of it.

Neither makes rendering faster. They change which work is allowed to block input, which is what users actually perceive as speed.

In this lesson you will:

  • Mark an update as interruptible
  • Keep an input responsive during a heavy render
  • Choose between a transition and a deferred value

Resources

Previous Lesson
Next Lesson
Concurrent rendering with useTransition — React Performance Engineering — Vertex