useMemo vs React.memo
They sound similar but do different jobs — and they're often used together.
What each does
useMemo caches a computed VALUE inside a component so it isn't recalculated every render. React.memo wraps a COMPONENT so it skips re-rendering when its props are shallowly equal.
How they work together
React.memo compares props by reference, so a parent passing a new inline object/function defeats it. useMemo (for objects) and useCallback (for functions) keep those props stable so React.memo can actually bail out.
Ace the performance round
Re-renders, React.memo, useMemo/useCallback and virtualization — in the React Interview Kit.
⚡ Get the React Interview Kit → ₹399Frequently asked questions
- Does React.memo cache values?
- No — it memoizes a component's render based on props. useMemo caches a value within a component.
- Should I use them everywhere?
- No. They cost memory and a comparison; use them where a component is expensive and its props are stable, or measure first.
