Stop UI flickering caused by unnecessary re-renders. Learn how function identity and referential equality keep your app fast by stabilizing props.

React uses referential equality to decide if a component should re-render; if you define a function inside a component body, JavaScript creates a brand-new spot in memory for it every time, signaling to React that the prop has changed even if the logic is identical.
This happens because of "function identity" and referential equality. In JavaScript, defining a function inside a component body creates a brand-new memory reference every time that component renders. Even if the code inside the curly braces is identical, React’s shallow comparison (similar to Object.is) sees a new "address" in memory and assumes the prop has changed. This triggers a re-render in child components, even if they are wrapped in React.memo, because the "identity" of the function is technically new.
useCallback acts as a cache or a vault for a function instance. On the initial render, React stores the function in its internal memory. On subsequent renders, useCallback checks its dependency array; if the dependencies haven't changed, React bypasses the creation of a new reference and hands back the exact same memory reference from the previous render. This stable identity allows React.memo to see that the props are identical, permitting it to skip the re-render process entirely.
Over-memoizing can actually decrease performance because useCallback carries its own overhead. Every time the hook is used, React must allocate memory to store the function and execute a comparison of the dependency array. For simple components, this extra work can be more expensive for the CPU than just letting the component re-render naturally. Developers should prioritize memoization for "expensive" branches of the UI tree, such as large lists or components with heavy rendering logic.
A stale closure occurs when a memoized function is "frozen" in time, capturing variables from a past render rather than the current one. For example, if a play handler depends on a "volume" state but the dependency array is empty, the function will always use the volume level that existed when it was first created. Including all reactive values (props and state) in the dependency array ensures that useCallback generates a fresh, updated version of the function only when those specific values change.
Yes, an effective alternative is "moving state down" or improving the component architecture. Often, performance issues arise because a function is defined in a "top-heavy" parent component and passed down through many layers. By moving the logic and state closer to the specific component that actually uses it, you can often eliminate the need for complex memoization entirely. Additionally, moving functions that don't rely on component state outside of the component body ensures they have a single, permanent reference without using hooks at all.
From Columbia University alumni built in San Francisco
"Instead of endless scrolling, I just hit play on BeFreed. It saves me so much time."
"I never knew where to start with nonfiction—BeFreed’s book lists turned into podcasts gave me a clear path."
"Perfect balance between learning and entertainment. Finished ‘Thinking, Fast and Slow’ on my commute this week."
"Crazy how much I learned while walking the dog. BeFreed = small habits → big gains."
"Reading used to feel like a chore. Now it’s just part of my lifestyle."
"Feels effortless compared to reading. I’ve finished 6 books this month already."
"BeFreed turned my guilty doomscrolling into something that feels productive and inspiring."
"BeFreed turned my commute into learning time. 20-min podcasts are perfect for finishing books I never had time for."
"BeFreed replaced my podcast queue. Imagine Spotify for books — that’s it. 🙌"
"It is great for me to learn something from the book without reading it."
"The themed book list podcasts help me connect ideas across authors—like a guided audio journey."
"Makes me feel smarter every time before going to work"
From Columbia University alumni built in San Francisco
