Component() — react Function Reference
Architecture documentation for the Component() function in valid-setState-in-effect-from-ref-function-call.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD 07414da3_b43d_88be_2e07_5e0a43c8e16c["Component()"] 9a2f93b7_99f0_65b6_2a1d_b3d8d6dbc3a0["valid-setState-in-effect-from-ref-function-call.js"] 07414da3_b43d_88be_2e07_5e0a43c8e16c -->|defined in| 9a2f93b7_99f0_65b6_2a1d_b3d8d6dbc3a0 style 07414da3_b43d_88be_2e07_5e0a43c8e16c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/valid-setState-in-effect-from-ref-function-call.js lines 4–20
function Component() {
const ref = useRef(null);
const [width, setWidth] = useState(0);
useEffect(() => {
function getBoundingRect(ref) {
if (ref.current) {
return ref.current.getBoundingClientRect?.()?.width ?? 100;
}
return 100;
}
setWidth(getBoundingRect(ref));
}, []);
return width;
}
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/valid-setState-in-effect-from-ref-function-call.js.
Where is Component() defined?
Component() is defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/valid-setState-in-effect-from-ref-function-call.js at line 4.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free