mirror of
https://github.com/facebook/react.git
synced 2026-02-26 07:55:55 +00:00
10 lines
320 B
JavaScript
10 lines
320 B
JavaScript
// @enableAssumeHooksFollowRulesOfReact true
|
|
function Component(props) {
|
|
const x = {};
|
|
// In enableAssumeHooksFollowRulesOfReact mode hooks freeze their inputs and return frozen values
|
|
const y = useFoo(x);
|
|
// Thus both x and y are frozen here, and x can be independently memoized
|
|
bar(x, y);
|
|
return [x, y];
|
|
}
|