← back to blog

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

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.
tsx
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.
#React#Performance#Debugging

Related posts

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.