The False Security of useCallback
You'll learn why wrapping every callback with useCallback doesn't actually prevent re-renders unless the components receiving those callbacks are also optimized.
The Illusion of Optimization
Many developers discover useCallback and immediately wrap every callback function in their components, thinking they've optimized their app. Here's the uncomfortable truth: useCallback alone doesn't stop re-renders.
When a parent component re-renders, all its children re-render by default—regardless of whether their props have "stable" references or not. This is React's normal behavior. If you pass a useCallback-wrapped function to a regular child component, that child will still re-render every time the parent does.
Why It Feels Like It Should Work
The confusion comes from understanding only half the picture. Yes, useCallback gives you a stable function reference. But React doesn't automatically check if props have changed before re-rendering children. It only does that check when a component is wrapped in React.memo.
Think of it like this: You've carefully packaged a gift (stable callback) to avoid changing it, but you're still knocking on someone's door every time (triggering re-renders). The person inside (child component) answers the door every time you knock, even if you're holding the same gift.
The Missing Piece
useCallback only provides value when the receiving component is memoized with React.memo, or when the callback is used as a dependency in useEffect, useMemo, or another useCallback. Without these, you're paying the cost of memoization (checking dependencies, maintaining cache) with zero benefit.
Key Takeaway: useCallback doesn't prevent re-renders by itself—it only helps when paired with memoized components or dependency arrays. Wrapping everything in useCallback without this understanding creates false security and adds unnecessary complexity.