A cascading render is what happens when one small state change re-renders far more of the tree than the change affects. You type one character into a filter box and the chart next to it, the sidebar and every table row render again, even though none of their output changed. On a small screen you won't notice. On a dashboard with a heavy chart and a few hundred rows, typing starts to lag.
The fix is usually structural: move the state down to the component that uses it, or hand the expensive parts to the stateful component as children. But don't start by moving code around. Start by finding out which state change is doing it and which components pay for it, because the Profiler often points somewhere other than where you'd guess.
The app we'll diagnose
Here's a stripped-down version of a pattern that turns up in most admin panels. A Dashboard component owns two unrelated pieces of state: the text in the orders filter and whether the sidebar is open. It renders a revenue chart and a filtered orders table.
export type Order = { id: string; customer: string; total: number }
export function RevenueChart({ orders }: { orders: Order[] }) {
const max = Math.max(1, ...orders.map((order) => order.total))
return (
<svg role="img" aria-label="Revenue per order" viewBox={`0 0 ${orders.length * 12} 100`}>
{orders.map((order, i) => (
<rect key={order.id} x={i * 12} y={100 - (order.total / max) * 100} width={10} height={(order.total / max) * 100} />
))}
</svg>
)
}
export function OrdersTable({ orders, query }: { orders: Order[]; query: string }) {
const needle = query.toLowerCase()
const rows = orders.filter((order) => order.customer.toLowerCase().includes(needle))
return (
<table>
<tbody>
{rows.map((order) => (
<tr key={order.id}>
<td>{order.customer}</td>
<td>{order.total}</td>
</tr>
))}
</tbody>
</table>
)
} 'use client'
import { useState } from 'react'
import { OrdersTable, RevenueChart, type Order } from './widgets'
export function Dashboard({ orders }: { orders: Order[] }) {
const [query, setQuery] = useState('')
const [sidebarOpen, setSidebarOpen] = useState(true)
return (
<div className={sidebarOpen ? 'layout with-sidebar' : 'layout'}>
<aside>
<button type="button" aria-expanded={sidebarOpen} onClick={() => setSidebarOpen(!sidebarOpen)}>
Filters
</button>
</aside>
<main>
<RevenueChart orders={orders} />
<input type="search" aria-label="Filter orders" value={query} onChange={(e) => setQuery(e.target.value)} />
<OrdersTable orders={orders} query={query} />
</main>
</div>
)
} Only OrdersTable reads query, and nothing in main reads sidebarOpen. But both live in Dashboard, and when a component's state changes, React renders that component again along with everything it renders, unless something tells it to skip. So every keystroke renders the chart, and every sidebar toggle renders the chart and the table.
That's the theory. Here's how to see it.
Step 1: make renders visible
Install React Developer Tools, open the Components tab and click the gear icon. On the General tab, switch on Highlight updates when components render. Now every component that renders gets a coloured outline on the page as it happens. Type into the filter box. If an outline flashes around the chart, you've found a cascade, and you know which interaction triggers it.
This is a quick check, not a measurement. It shows that something rendered, not how long it took or why. It's still the fastest way to find out which interaction to profile, so I always start here.
Step 2: record a profile and ask why each component rendered
Switch to the Profiler tab. Before recording, open its settings (the gear again) and turn on Record why each component rendered while profiling. It's off by default and it's the most useful thing in the panel. Then:
- Click the record button.
- Do the slow interaction, and only that. Type three or four characters into the filter.
- Stop recording.
The bar chart at the top right has one bar per commit, so you should see roughly one per keystroke. Pick one and look at the flamegraph. Components that didn't render in that commit are greyed out. Here, Dashboard, RevenueChart and OrdersTable are all coloured, which confirms the cascade. The Ranked view sorts the same commit by render time, which is the quickest way to find the component that's actually expensive.
Click RevenueChart and the side panel shows a "Why did this render?" section. These are the messages DevTools uses and what each one means here:
- "The parent component rendered." The component's own props, state and context didn't change. It rendered only because its parent did. This is the signature of a cascade, and it's what you'll see on the chart.
- "Hook 1 changed" (or "State changed" on a class component). The component's own state changed. On
Dashboard, hook 1 is theuseStatethat holdsquery. That's your source. - "Props changed" with a list of prop names. A prop really changed. On
OrdersTableit listsquery, which is a legitimate render. - "Context changed". The component reads a context whose value changed. If you see this on components that don't care about the change, the context is too broad, which is a different fix from the one below.
So the diagnosis reads: state changes in Dashboard, OrdersTable renders because a prop changed (fine), and RevenueChart renders only because its parent did (waste). Toggle the sidebar while recording and you'll see the same thing on both the chart and the table.
Step 3: measure in code when you need numbers
The DevTools Profiler is interactive. When you want numbers you can log, compare or put in a test, React has a Profiler component. Wrap the suspect and give it an onRender callback:
'use client'
import { Profiler, useState, type ProfilerOnRenderCallback } from 'react'
import { OrdersTable, RevenueChart, type Order } from './widgets'
const logRender: ProfilerOnRenderCallback = (id, phase, actualDuration, baseDuration) => {
console.log(`${id} ${phase}: ${actualDuration.toFixed(2)}ms (full subtree estimate ${baseDuration.toFixed(2)}ms)`)
}
export function Dashboard({ orders }: { orders: Order[] }) {
const [query, setQuery] = useState('')
return (
<main>
<Profiler id="RevenueChart" onRender={logRender}>
<RevenueChart orders={orders} />
</Profiler>
<input type="search" aria-label="Filter orders" value={query} onChange={(e) => setQuery(e.target.value)} />
<OrdersTable orders={orders} query={query} />
</main>
)
} onRender gets the profiler's id, the phase ("mount", "update" or "nested-update"), actualDuration (time spent rendering the subtree in this commit) and baseDuration (an estimate of what rendering the whole subtree would cost with no memoization). If actualDuration stays close to baseDuration on updates, nothing in that subtree is skipping work. Typing two characters into the filter of this version logs one mount and then one RevenueChart update per keystroke. That's the cascade in a form you can assert on. One caveat from my tests: a Profiler placed below a context provider didn't report renders caused only by that context changing, though it did report the same component re-rendering for its own state. For context-driven renders, trust the DevTools Profiler, which lists "Context changed" as a reason.
Profiling is disabled in production builds by default, and timings from a development build are inflated by dev-only checks. For realistic numbers, use a profiling build. In Next.js that's next build --profile (the Next.js CLI reference describes it as enabling production profiling for React). Elsewhere you alias react-dom/client to react-dom/profiling in your bundler, as described in the React Performance tracks docs. Those tracks are also worth a look. In Chrome's Performance panel, React adds Scheduler and Components tracks, so you can see renders next to the rest of the main-thread work. In development builds, clicking a component entry shows which props changed.
Step 4: fix it by moving state, not by memoizing
The diagnosis gives two separate problems with two different fixes. The filter text is read by one subtree (the input and the table), so it moves down into a component that owns just that subtree. The sidebar flag has to wrap the whole page, so it can't move below the content. Instead, the content moves out of the component that owns the flag and comes back in as children.
'use client'
import { useState, type ReactNode } from 'react'
import { OrdersTable, RevenueChart, type Order } from './widgets'
export function Dashboard({ orders }: { orders: Order[] }) {
return (
<SidebarShell>
<RevenueChart orders={orders} />
<OrdersPanel orders={orders} />
</SidebarShell>
)
}
function SidebarShell({ children }: { children: ReactNode }) {
const [sidebarOpen, setSidebarOpen] = useState(true)
return (
<div className={sidebarOpen ? 'layout with-sidebar' : 'layout'}>
<aside>
<button type="button" aria-expanded={sidebarOpen} onClick={() => setSidebarOpen(!sidebarOpen)}>
Filters
</button>
</aside>
<main>{children}</main>
</div>
)
}
function OrdersPanel({ orders }: { orders: Order[] }) {
const [query, setQuery] = useState('')
return (
<>
<input type="search" aria-label="Filter orders" value={query} onChange={(e) => setQuery(e.target.value)} />
<OrdersTable orders={orders} query={query} />
</>
)
} Now a keystroke changes state in OrdersPanel, which renders the input and the table and nothing else. The chart isn't a child of OrdersPanel, so it isn't involved.
The sidebar fix is less obvious. SidebarShell still re-renders when you toggle it, but the children elements it receives were created by Dashboard, and Dashboard didn't render. They're the same element objects as last time, so React has no reason to render the chart or the panel again. The memo reference lists exactly this as a way to make memoization unnecessary: when a component visually wraps others, let it accept JSX as children, and don't lift state any higher than it needs to go.
I checked both versions with a Testing Library test that counts how often the chart and table components run. With the original Dashboard, typing "ada" renders the chart on each keystroke and a sidebar toggle renders both the chart and the table. With the fixed version, typing renders only the table (three times, as it should), and a sidebar toggle renders neither. Record the same profile again in DevTools and the chart is grey in every commit.
Why not just wrap RevenueChart in memo? It would work for this exact case, as long as orders keeps its identity. But it's fragile: the first time someone passes an inline object or callback to the chart, memoization silently breaks, and the docs point out that a single always-new prop is enough to defeat it. Moving state down removes the cascade. memo only hides it, and only while the props cooperate.
What changes with React Compiler
React Compiler exists partly to skip cascading re-renders automatically. It memoizes JSX inside your components, so a child whose props didn't change isn't rendered again. I ran the original Dashboard through babel-plugin-react-compiler and ran the same test: the compiled version no longer rendered the chart while typing, and a sidebar toggle rendered neither the chart nor the table. If your app has the compiler on, the Profiler may already show these components as skipped.
That doesn't make colocation pointless, and it changes how you read the profile. The owning component still runs on every change, so a big component with lots of local logic still does work for state it doesn't need. Only components and hooks are memoized, and the compiler relies on your code following the Rules of React. Components it can't optimize behave like the uncompiled version. Context changes still render every consumer. And a component that owns one piece of state is easier to reason about than one that owns six, whatever the compiler does. With the compiler on, I treat a Profiler showing "The parent component rendered." on an expensive component as a sign that something isn't being compiled the way I expect, and I check that first.
Other causes the Profiler will point you to
Not every cascade comes from state in the wrong place. Three others turn up often, and the "Why did this render?" panel tells them apart:
- "Context changed" on many components. A provider holds a value that changes often, such as a whole state object, and every consumer renders on every change. Split the context by how often each part changes, or keep fast-changing values out of it.
- A burst of commits from one interaction. An effect sets state, which triggers another render, which triggers another effect. The memo docs say most performance problems come from chains of updates that start in effects. Compute the value during render instead.
- "Props changed" for a callback or object prop on every commit. The parent creates a new function or object each render. Without the compiler, that's where
useCallbackoruseMemoactually earns its place, on a memoized child that you've measured.
Once a fix is in, record the same interaction again and compare commit by commit. If the expensive component is grey and the commit is shorter, you're done. If it isn't, the panel will say why.
For the wider question of where each piece of state belongs before it causes a problem like this, see where React state should live. The composition techniques used here, plus split contexts and Server Components, get a fuller treatment in advanced colocation patterns. And if your slow screen is a long list rather than a cascade, list virtualization is the tool to reach for.












