When Would You Use useMemo or useCallback?
What is your relationship with React hooks? When would you use useMemo or useCallback?
Answer out loud in under a minute: a definition, one concrete example, and one pitfall or trade-off.
Hints
Hint 1
Say what each caches, and name the situations where that caching actually changes anything.
Solution
Show the approach
Answer
useMemo caches a computed value, and useCallback caches a function's identity. Both matter only when the result feeds a memoized child, a dependency array, or a costly calculation. Used everywhere, they add cost and noise, and the React Compiler increasingly applies them automatically.