diff --git a/src/content/reference/react-compiler/gating.md b/src/content/reference/react-compiler/gating.md index 2959c49fa..479506af3 100644 --- a/src/content/reference/react-compiler/gating.md +++ b/src/content/reference/react-compiler/gating.md @@ -63,7 +63,7 @@ Configures runtime feature flag gating for compiled functions. // src/utils/feature-flags.js export function shouldUseCompiler() { // your logic here - return Math.random() < 0.5; + return getFeatureFlag('react-compiler-enabled'); } ``` @@ -94,6 +94,8 @@ const Button = shouldUseCompiler() : function Button_original(props) { /* original version */ }; ``` +Note that the gating function is evaluated once at module time, so once the JS bundle has been parsed and evaluated the choice of component stays static for the rest of the browser session. + --- ## Troubleshooting {/*troubleshooting*/}