Component() — react Function Reference
Architecture documentation for the Component() function in allow-ref-access-in-effect.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD 83512038_1d40_b737_6f13_0fd2375d531a["Component()"] 71741bea_0946_c4bb_6a9d_d94964e7fc71["allow-ref-access-in-effect.js"] 83512038_1d40_b737_6f13_0fd2375d531a -->|defined in| 71741bea_0946_c4bb_6a9d_d94964e7fc71 style 83512038_1d40_b737_6f13_0fd2375d531a fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/allow-ref-access-in-effect.js lines 4–19
function Component() {
const ref = useRef(null);
const [state, setState] = useState(false);
useEffect(() => {
ref.current = 'Ok';
}, []);
useEffect(() => {
setState(true);
}, []);
// We use state to force a re-render and observe whether the
// ref updated. This lets us check that the effect actually ran
// and wasn't DCE'd
return <Child key={String(state)} ref={ref} />;
}
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/allow-ref-access-in-effect.js.
Where is Component() defined?
Component() is defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/allow-ref-access-in-effect.js at line 4.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free