Component() — react Function Reference
Architecture documentation for the Component() function in function-expression-mutation-edge-case.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD aa249b9e_5896_066e_2a1f_97f07b1c8e67["Component()"] 5700b416_f24d_72df_c382_fd5d9f842c8c["function-expression-mutation-edge-case.js"] aa249b9e_5896_066e_2a1f_97f07b1c8e67 -->|defined in| 5700b416_f24d_72df_c382_fd5d9f842c8c style aa249b9e_5896_066e_2a1f_97f07b1c8e67 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/effect-derived-computations/function-expression-mutation-edge-case.js lines 3–32
function Component() {
const [foo, setFoo] = useState({});
const [bar, setBar] = useState(new Set());
/*
* isChanged is considered context of the effect's function expression,
* if we don't bail out of effect mutation derivation tracking, isChanged
* will inherit the sources of the effect's function expression.
*
* This is innacurate and with the multiple passes ends up causing an infinite loop.
*/
useEffect(() => {
let isChanged = false;
const newData = foo.map(val => {
bar.someMethod(val);
isChanged = true;
});
if (isChanged) {
setFoo(newData);
}
}, [foo, bar]);
return (
<div>
{foo}, {bar}
</div>
);
}
Domain
Subdomains
Source
Frequently Asked Questions
What does Component() do?
Component() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/effect-derived-computations/function-expression-mutation-edge-case.js.
Where is Component() defined?
Component() is defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/effect-derived-computations/function-expression-mutation-edge-case.js at line 3.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free