mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
ab752bf7a1
Adds `dynamicGating` as an experimental option for testing rollout DX at Meta. If specified, this enables dynamic gating which matches `use memo if(...)` directives.
#### Example usage
Input file
```js
// @dynamicGating:{"source":"myModule"}
export function MyComponent() {
'use memo if(isEnabled)';
return <div>...</div>;
}
```
Compiler output
```js
import {isEnabled} from 'myModule';
export const MyComponent = isEnabled()
? <optimized version>
: <original version>;
```