Component() — react Function Reference
Architecture documentation for the Component() function in reactivity-analysis-interleaved-reactivity.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD 5b597d14_42b1_345c_0686_c742f13679a2["Component()"] 3396b062_146b_9ce4_2e5c_832a604bcea9["reactivity-analysis-interleaved-reactivity.js"] 5b597d14_42b1_345c_0686_c742f13679a2 -->|defined in| 3396b062_146b_9ce4_2e5c_832a604bcea9 style 5b597d14_42b1_345c_0686_c742f13679a2 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reactivity-analysis-interleaved-reactivity.js lines 1–19
function Component(props) {
// a and b are technically independent, but their mutation is interleaved
// so they are grouped in a single reactive scope. a does not have any
// reactive inputs, but b does. therefore, we have to treat a as reactive,
// since it will be recreated based on a reactive input.
const a = {};
const b = [];
b.push(props.b);
a.a = null;
// because a may recreate when b does, it becomes reactive. we have to recreate
// c if a changes.
const c = [a];
// Example usage that could fail if we didn't treat a as reactive:
// const [c, a] = Component({b: ...});
// assert(c[0] === a);
return [c, a];
}
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/reactivity-analysis-interleaved-reactivity.js.
Where is Component() defined?
Component() is defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reactivity-analysis-interleaved-reactivity.js at line 1.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free