Explain the difference between React.memo and useMemo

WHAT IT TESTS: whether you distinguish component-level memo from value caching. ANSWER OUTLINE: React.memo skips re-renders when props match; useMemo caches a computed value between renders. RED FLAG: saying they are interchangeable or both stop re-renders.
WHAT IT TESTS: whether you understand that memoization operates at two different layers in React. ANSWER OUTLINE: React.memo is a higher-order component that compares incoming props with Object.is and skips rendering the wrapped component if unchanged; useMemo is a hook that caches the return value of a function between renders of the same component when dependencies are stable. RED FLAG: saying either tool prevents child re-renders automatically, or using useMemo to replace React.memo on a component export.
Read the original → react.dev
- #react
- #memoization
- #performance
- #hooks
- #react.memo
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.