Intermediate React Interview QuestionsIntermediateConcept
React · Question 57
How does React Compiler change the way you think about memo, useMemo, and useCallback?
Direct answer
React Compiler can automatically memoize components and calculations at build time, reducing the amount of manual memoization needed in compiler-enabled applications.
The compiler analyzes components and Hooks under the Rules of React and can generate memoization that skips unnecessary cascading renders and repeated calculations.
- New compiler-enabled code: prefer clear React code first and rely on automatic memoization where appropriate.
- Existing manual memoization: do not delete it blindly; removal can change compilation output or performance behavior.
- Escape hatch: useMemo and useCallback still exist when you need precise control, especially around identity-sensitive dependencies.