Capítulo 92 de 116
Beyond the default zero-config behavior, React Compiler exposes a handful of Babel-plugin options (target, panicThreshold, logger, gating, compilationMode) and two source-level directives ("use memo", "use no memo") for controlling exactly what gets compiled and how failures are handled.
| Option/Directive | What it controls |
|---|---|
target | Which React version's runtime APIs the compiler emits code for — must match the actual React version the app runs on. |
panicThreshold | How the compiler reacts when it can't safely compile a piece of code — options generally range from silently skipping that code to failing the build, letting a team choose how strict adoption should be. |
logger | A custom callback for the compiler's diagnostic output — useful for piping compilation results into a team's own build tooling/monitoring instead of just console output. |
gating | Enables the runtime feature-flag rollout mode described in Ch 44 — compiled and uncompiled versions of a module both ship, switched by a flag. |
compilationMode | Controls which components/Hooks the compiler considers eligible for optimization by default (e.g. "all" vs. an opt-in-only mode), interacting with the "use memo" directive below. |
"use memo" (directive) | Placed at the top of a function, explicitly opts that function into compilation — the mechanism behind opt-in incremental adoption (Ch 44). |
"use no memo" (directive) | Placed at the top of a function, explicitly excludes it from compilation — the diagnostic/escape-hatch tool from Ch 45's debugging workflow. |
| Compiling Libraries | Guidance for library authors: whether/how to ship compiler-optimized code in a published package, given consumers may be on different compiler versions or configurations than the library was built with. |
target must match the app's actual React version — a mismatch here is a common source of runtime errors after adopting the compiler."use memo"/"use no memo" are the source-level, per-function controls; compilationMode/gating are the project-level, config-file controls — they compose together during incremental adoption."use no memo".