Web Dev
Why Your React App Re-renders (And How to Actually Find Out)
Memoizing everything is not a performance strategy. Here's how I profile a slow React page and fix the real cause.

Edwine Nyakundi
Full stack engineer · Jun 11, 2026 · 10 min read
The usual response to a sluggish page is to wrap components in `memo` until it feels better. That adds comparison cost everywhere and usually misses the one component causing the problem.
Profile first
Open the React DevTools Profiler, record an interaction, and look at the flamegraph. You're looking for a wide bar that shouldn't be there at all.
The three usual culprits
- A context value recreated on every render, invalidating every consumer.
- An inline object or array passed as a prop to a memoized child.
- State living too high in the tree, so a keystroke re-renders the page.
class=class="tok-string">"tok-comment">// Re-creates the value object every render — every consumer re-renders.
<ThemeContext.Provider value={{ theme, setTheme }}>
class=class="tok-string">"tok-comment">// Stable across renders unless theme actually changes.
const value = useMemo(() => ({ theme, setTheme }), [theme]);
<ThemeContext.Provider value={value}>Move state down
The cheapest fix is often structural. If only the form cares about the input value, the value belongs in the form — not in a page-level provider.
Most React performance work is really state placement work wearing a disguise.
Related posts
Four Postgres Indexes I Wish I'd Understood Earlier
A 2.4s query became 11ms after one index. Here's how I reason about B-tree, partial, composite, and GIN indexes now.
Aug 28, 2026 · 11 min read
Building a Type-Safe API Layer in React with TypeScript
Stop sprinkling `any` across your fetch calls. Here's the small, boring pattern I use on every production app to keep server data honest.
Sep 12, 2026 · 9 min read
Growing Into a Senior Engineer Without Burning Out
Nobody gets promoted for working weekends. What actually moved the needle for me was writing things down and saying no more often.
Aug 4, 2026 · 7 min read
Newsletter
Get new posts in your inbox
Deep dives on TypeScript, Postgres, and engineering careers — roughly twice a month. No courses to sell, no spam.