Foo() — react Function Reference
Architecture documentation for the Foo() function in error.invalid-hoisting-setstate.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD 40af078b_c523_d99a_4f53_dd650ecc0558["Foo()"] b02e178d_1095_49a0_49e4_7b5929bb5ac9["error.invalid-hoisting-setstate.js"] 40af078b_c523_d99a_4f53_dd650ecc0558 -->|defined in| b02e178d_1095_49a0_49e4_7b5929bb5ac9 style 40af078b_c523_d99a_4f53_dd650ecc0558 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.invalid-hoisting-setstate.js lines 5–23
function Foo() {
/**
* Previously, this lowered to
* $1 = LoadContext capture setState
* $2 = FunctionExpression deps=$1 context=setState
* [[ at this point, we freeze the `LoadContext setState` instruction, but it will never be referenced again ]]
*
* Now, this function expression directly references `setState`, which freezes
* the source `DeclareContext HoistedConst setState`. Freezing source identifiers
* (instead of the one level removed `LoadContext`) is more semantically correct
* for everything *other* than hoisted context declarations.
*
* $2 = Function context=setState
*/
useEffect(() => setState(2), []);
const [state, setState] = useState(0);
return <Stringify state={state} />;
}
Domain
Subdomains
Source
Frequently Asked Questions
What does Foo() do?
Foo() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.invalid-hoisting-setstate.js.
Where is Foo() defined?
Foo() is defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.invalid-hoisting-setstate.js at line 5.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free