AceDevHub
Intermediate React Interview QuestionsIntermediateComparison

React · Question 55

What is the difference between memo, useMemo, and useCallback?

Direct answer

memo memoizes a component against unchanged props, useMemo caches a calculated value, and useCallback caches a function definition.

APIWhat it cachesTypical reason
memoComponent render result based on propsSkip parent-driven child renders
useMemoResult of a calculationSkip expensive recalculation or stabilize a value
useCallbackFunction definitionStabilize callback identity for a consumer

All three are performance tools. Code should remain correct if the optimization is removed.