Unnecessary renders and expensive updates.
In React, a render is React calling your component functions and working out what should be on screen. Every screen update goes through three steps: something triggers the render (the first load, or a state update), React renders the components, then commits the differences to the DOM. React only touches the DOM if there is a difference between two renders.1
So a component re-rendering does not always mean the DOM changes; most re-renders are fast. The problem is usually the expensive work done during the render. As Kent C. Dodds puts it, even if all your renders are necessary, the user still has a bad experience if they are slow.2
Every re-render starts with a state change. The component whose state changed re-renders, and React re-renders all the components below it as well; whether or not they receive that state as a prop makes no difference.3 A component renders for four reasons: its own state changed, its parent rendered (rendering flows top-down; a child rendering does not render the parent), the value of a context it uses changed, or the state of a hook it uses changed.4
In the Profiler tab of the React Developer Tools extension you start a recording, perform the interaction that feels slow, and stop the recording. The result is split into commits; in each commit's flame chart, yellow bars show long renders and blue bars short ones, while grey ones did not render at all in that commit. The ranked chart, meanwhile, sorts the components by render time.5
Two settings are especially useful:
Highlight updates: the "Highlight updates when components render" option in the DevTools settings shows the components that rendered with a flashing outline on screen.36 If the whole page flashes while you type into an input, you see at once that the state sits too high up.
The reason for a render: the "Record why each component rendered while profiling" option in the Profiler settings records which prop or state caused a component to render.3
With React 19.2, React adds its own tracks to the browser's Performance panel.8 When you record in the Performance panel you saw in the Measuring lesson, the Scheduler track shows at which priority the work was done (Blocking for a user interaction, Transition for startTransition) and the cascading updates that cause work to be redone from the start. The Components track gives the render times as a flamegraph; in a development build, clicking a render shows you the props that changed. The tracks are on in a development build and off in a production build, because they add overhead.9
React Compiler is a tool that analyses your code at build time and adds the memoization automatically. Its first stable release, v1.0, came out in October 2025.10 It does what the memo, useMemo and useCallback you write by hand do, on code that follows the Rules of React; you do not have to rewrite anything.11
In Next.js 16 the reactCompiler option is stable; you install the package and turn it on in the config:12
$ pnpm add -D babel-plugin-react-compiler// next.config.ts
import type { NextConfig } from "next";
const nextConfig: NextConfig = { reactCompiler: true };
export default nextConfig;There are official setup paths for Vite and Expo too; in Expo SDK 54 and later the compiler is on by default.10 To leave a component out of the compiler, write "use no memo" at the top of the function.12
If you do not use the compiler, or you need the escape hatch, there are three tools:
| Tool | What it stores | When |
|---|---|---|
memo | The component's last render result | Components that render often with the same props and whose render is expensive |
useMemo | The result of a calculation | A noticeably slow calculation, a prop for a memo-wrapped child, or another hook's dependency |
useCallback | A function | When passing a function to a memo-wrapped child |
memo is a performance optimisation, not a guarantee. If there is no noticeable delay in the render, it is unnecessary.13 You can measure whether a calculation is expensive with console.time: if it takes 1ms or more in total, it is worth memoizing.7
If you pass a memo-wrapped component an object or a function recreated on every render, memo does nothing at all; this is why useMemo and useCallback are usually used together with memo.13 Memoization is fragile for that reason: the moment someone else passes the component an inline object or JSX children, its effect is silently lost.14
Before reaching for memo, changing the component structure is often enough.1513
Move the state down: put the state in the smallest component that actually uses it. Then, when the state changes, only that component renders and the expensive tree next to it is unaffected. For example, if you move an input's state from the page's root into a small Form component containing the input, <ExpensiveTree /> does not render while you type.15
Pass the content as children: if the state has to sit above the expensive tree, move the stateful part into a wrapper that takes children. Because children is created in the parent, React does not re-render it when the wrapper's state changes.1513
function ColorPicker({ children }: { children: React.ReactNode }) {
const [color, setColor] = useState("red");
return (
<div style={{ color }}>
<input value={color} onChange={(e) => setColor(e.target.value)} />
{children}
</div>
);
}
<ColorPicker>
<ExpensiveTree />
</ColorPicker>;The same list has two more rules: do not put temporary state such as an input's value or a hover into a global store or at the top of the tree, and keep renders pure. According to React, most performance problems come out of chains of Effects that update state.13
Don't
Do not define a component inside another component. A new component is created on every render and React mounts it from scratch; that is slower than a re-render and it resets the state.4
In a list of thousands of rows the problem is not each row itself but the size of the DOM: the bigger the DOM, the bigger the browser's rendering work, and both the first load and the interactions get slower.16 Virtualization is the technique of putting only the rows visible on screen into the DOM and swapping them as you scroll.
The common choice in React is TanStack Virtual. It produces no markup (it is headless) and only works out which row goes where; it supports lists, grids and horizontal scrolling.1718 The setup is a single package:19
$ pnpm add @tanstack/react-virtualimport { useRef } from "react";
import { useVirtualizer } from "@tanstack/react-virtual";
function LongList({ items }: { items: string[] }) {
const parentRef = useRef<HTMLDivElement>(null);
const virtualizer = useVirtualizer({
count: items.length,
getScrollElement: () => parentRef.current,
estimateSize: () => 40,
});
return (
<div ref={parentRef} style={{ height: 400, overflow: "auto" }}>
<div style={{ height: virtualizer.getTotalSize(), position: "relative" }}>
{virtualizer.getVirtualItems().map((row) => (
<div key={row.key} style={{ position: "absolute", width: "100%", transform: `translateY(${row.start}px)` }}>
{items[row.index]}
</div>
))}
</div>
</div>
);
}count is the total number of rows, getScrollElement the box that scrolls, and estimateSize a row's estimated height.17 If the page itself scrolls, useWindowVirtualizer is used.17
Interaction to Next Paint (INP) measures how long the screen takes to update after a click or a key press. The latency has three parts: the wait caused by the main thread being busy, the event handlers running, and the new frame being painted.16 In 2025, 77% of sites got a good INP on mobile and 97% on desktop.20
A large render blocks the main thread and delays typing and clicking. React's concurrent features can pause a non-urgent render and give way to the browser, so typing stays smooth.21
State updates inside startTransition are marked as a transition. Transitions do not block and can be interrupted: if the user clicks something else, React handles that first. With isPending you can show the waiting state.22
const [isPending, startTransition] = useTransition();
function selectTab(next: Tab) {
startTransition(() => setTab(next));
}Warning
Do not update a controlled text input's state inside a transition; the character typed has to appear immediately. Keep a separate, normal state for the input.22
It gives you a "lagging" copy of a value: React renders quickly with the old value first and tries the render with the new value in the background.23
const [text, setText] = useState("");
const deferredText = useDeferredValue(text);
<input value={text} onChange={(e) => setText(e.target.value)} />
<SlowList text={deferredText} /> {/* SlowList is wrapped in memo */}This does not make SlowList faster; it only keeps it from blocking the key presses. SlowList has to be wrapped in memo, otherwise it renders on every key again and the gain is lost. The difference from debouncing is that you do not pick a fixed delay, and the work can be interrupted.23
These two APIs do not help when a single component is expensive in itself, and they add CPU work; look at making the render faster first.21
Talk: Nadia Makarevich's 23-minute talk on the reasons for re-renders and the composition techniques (React Summit 2022).24
Talk: Ivan Akulov's 23-minute talk explaining startTransition through a slow filter example (React Summit 2023).21
Talk: Ruslan Lesiutin's roughly 21-minute session showing how to profile with Performance Tracks (React Conf 2025, day 1 stream).25
Article: Nadia Makarevich's re-render guide; it collects the reasons, the patterns and the anti-patterns on one page.4
Official docs: React Compiler's installation, incremental adoption and troubleshooting pages.11
Sources
The trigger, render and commit steps, and React changing the DOM only when there is a difference.
Finding and fixing the slow render before reducing re-renders.
Re-renders starting with state, the props myth, `memo` and the Profiler settings.
The four reasons for a re-render, the composition patterns and the anti-patterns.
Recording in the Profiler, the commits, the flame chart colours and the ranked chart.
A bug report about the "Highlight updates when components render" setting in DevTools.
Storing a calculation, measuring how expensive it is, and the CPU throttling recommendation.
The announcement of Performance Tracks and Activity.
The Scheduler and Components tracks, and their use per build type.
The compiler's stable release, its setup and the recommendations about existing memoization.
What the compiler does, a before/after example and the related documents.
Turning the compiler on in Next.js 16, the annotation mode and `"use no memo"`.
When `memo` helps, and the principles that make memoization unnecessary.
Why `memo` breaks so easily, and why composition should come first.
Moving state down, and lifting content up as `children`.
INP's three phases, yielding to the main thread and the effect of the DOM size.
The `useVirtualizer` and `useWindowVirtualizer` options.
The headless, framework-agnostic virtualization library.
Installing the React package `@tanstack/react-virtual`.
The share of sites with a good INP on mobile and desktop.
23 minutes. A filter that does not block typing with `startTransition`, and the cost of concurrency.
Transitions, `isPending` and the controlled input warning.
Deferring a value, the `memo` requirement and the difference from debouncing.
23 minutes. The re-render triggers, the `memo` traps and composition.
A roughly 21-minute session in the day 1 stream; debugging with Performance Tracks.
Check the lesson's main ideas with three questions.
Your progress is stored only in this browser.
Last updated: November 3, 2026