useFoo() — react Function Reference
Architecture documentation for the useFoo() function in todo-merge-ssa-phi-access-nodes.ts from the react codebase.
Entity Profile
Dependency Diagram
graph TD f3ef1367_7d81_14e8_2732_7a23086c3c5c["useFoo()"] 43de443c_00e3_355b_dba8_17cde3efd2e8["todo-merge-ssa-phi-access-nodes.ts"] f3ef1367_7d81_14e8_2732_7a23086c3c5c -->|defined in| 43de443c_00e3_355b_dba8_17cde3efd2e8 style f3ef1367_7d81_14e8_2732_7a23086c3c5c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/todo-merge-ssa-phi-access-nodes.ts lines 11–40
function useFoo(cond) {
let x;
if (cond) {
/** start of scope for x_@0 */
x = {};
setPropertyByKey(x, 'a', {b: 2});
/** end of scope for x_@0 */
Math.max(x.a.b, 0);
} else {
/** start of scope for x_@1 */
x = makeObject_Primitives();
setPropertyByKey(x, 'a', {b: 3});
/** end of scope for x_@1 */
Math.max(x.a.b, 0);
}
/**
* At this point, we have a phi node.
* x_@2 = phi(x_@0, x_@1)
*
* We can assume that both x_@0 and x_@1 both have non-null `x.a` properties,
* so we can infer that x_@2 does as well.
*/
// Here, y should take a dependency on `x.a.b`
const y = [];
if (identity(cond)) {
y.push(x.a.b);
}
return y;
}
Domain
Subdomains
Source
Frequently Asked Questions
What does useFoo() do?
useFoo() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/todo-merge-ssa-phi-access-nodes.ts.
Where is useFoo() defined?
useFoo() is defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/todo-merge-ssa-phi-access-nodes.ts at line 11.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free