Foo() — react Function Reference
Architecture documentation for the Foo() function in repro-returned-inner-fn-mutates-context.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD 92a4d074_7760_feb6_fac0_28b75b05007b["Foo()"] db856285_ec18_29a8_8003_6e0ffc12944b["repro-returned-inner-fn-mutates-context.js"] 92a4d074_7760_feb6_fac0_28b75b05007b -->|defined in| db856285_ec18_29a8_8003_6e0ffc12944b style 92a4d074_7760_feb6_fac0_28b75b05007b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-returned-inner-fn-mutates-context.js lines 7–28
function Foo({a, b}) {
'use memo';
const obj = {};
const updaterFactory = () => {
/**
* This returned function expression *is* a local value. But it might (1)
* capture and mutate its context environment and (2) be called during
* render.
* Typing it with `freeze` effects would be incorrect as it would mean
* inferring that calls to updaterFactory()() do not mutate its captured
* context.
*/
return newValue => {
obj.value = newValue;
obj.a = a;
};
};
const updater = updaterFactory();
updater(b);
return <Stringify cb={obj} shouldInvokeFns={true} />;
}
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/repro-returned-inner-fn-mutates-context.js.
Where is Foo() defined?
Foo() is defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-returned-inner-fn-mutates-context.js at line 7.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free