Question presented to candidate: "You enabled the React Compiler but the profiler shows components still re-rendering. What is going on?"
What a strong answer should cover:
- The compiler bails out per component when it cannot prove the transformation is safe. That component is left exactly as written; the rest of the file is still compiled.
- The failure mode is silence — you do not get an error, you get an unoptimised component. That is deliberate: it will never miscompile, only decline.
- The common bail-out causes: mutating props or state, reading or writing a ref during render, other impure render behaviour, and code the analysis cannot follow.
- The ESLint rule is the real adoption tool — it reports the violations, which is how you find out what was skipped.
- Escape hatches: the
"use no memo"directive to exclude a component deliberately, andopt-inmode to compile only annotated files. - Memoisation is a performance hint, not a semantic guarantee — code must still be correct if a value is recomputed.
- It does not fix effect dependency arrays, refactor your state placement, or virtualise a list.
- Existing manual
useMemoanduseCallbackkeep working; removal is a follow-up cleanup, not part of adoption.
Clarifying questions expected:
- "Does the codebase pass the React Compiler ESLint rule?" — that answers the question directly.
- "Is the compiler actually running on this file, or is it in opt-in mode?"
Code / implementation expected: Optional. Showing a component that would bail out, and its fixed version, is the useful form.