Courses / React 19: From Components to Production / Chapter 9
Module 4 · Advanced Hooks and Concurrency · Chapter 9 of 30
Concurrent Rendering: Transitions, Deferred Values and Priorities
Builds on State and Effects: useState, Events, useEffect and Cleanup, New in React 19: Actions, use, Optimistic UI and ref as a Prop and Advanced Hooks: Refs, Reducers, Context, Layout Effects and Custom Hooks. Next up: Forms: Controlled and Uncontrolled Inputs, Validation and Form Actions.
Part 1 · Why a render can block typing
One thread for everything
A search box over a list of 19,000 PIN codes has to keep up with typing, and a long list of results can make it stall. This lesson shows why, with a measurement, before the next ones fix it.
A browser runs your JavaScript, handles clicks and key presses, calculates layout and draws the page on a single main thread. It does one task at a time and cannot start the next until the current one returns. A key press becomes a task, so if a long task is running, the key press waits in a queue, and the character the user typed does not appear until the long task ends.
The delay a user feels between acting and seeing a result is measured by Interaction to Next Paint (INP). The web.dev guidance rates an INP of 200 ms or less, at the 75th percentile of page visits, as good. A single render that holds the main thread for 100 ms spends half of that budget before anything else happens.
React renders in response to state changes, and a render is ordinary JavaScript. If a state update leads to a render of thousands of components, nothing else can run until it finishes. An update from a discrete event such as typing is urgent: React renders it in one piece so that the screen never lags behind the input. For a small tree that is exactly right. For a large one it is the problem.