valid-setState-in-effect-from-ref-function-call.js — react Source File
Architecture documentation for valid-setState-in-effect-from-ref-function-call.js, a javascript file in the react codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 9a2f93b7_99f0_65b6_2a1d_b3d8d6dbc3a0["valid-setState-in-effect-from-ref-function-call.js"] ac587885_e294_a1e9_b13f_5e7b920fdb42["react"] 9a2f93b7_99f0_65b6_2a1d_b3d8d6dbc3a0 --> ac587885_e294_a1e9_b13f_5e7b920fdb42 style 9a2f93b7_99f0_65b6_2a1d_b3d8d6dbc3a0 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
// @validateNoSetStateInEffects @enableAllowSetStateFromRefsInEffects @outputMode:"lint"
import {useState, useRef, useEffect} from 'react';
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;
}
export const FIXTURE_ENTRYPOINT = {
fn: Component,
params: [],
};
Domain
Subdomains
Functions
Dependencies
- react
Source
Frequently Asked Questions
What does valid-setState-in-effect-from-ref-function-call.js do?
valid-setState-in-effect-from-ref-function-call.js is a source file in the react codebase, written in javascript. It belongs to the TestingUtilities domain, Fixtures subdomain.
What functions are defined in valid-setState-in-effect-from-ref-function-call.js?
valid-setState-in-effect-from-ref-function-call.js defines 1 function(s): Component.
What does valid-setState-in-effect-from-ref-function-call.js depend on?
valid-setState-in-effect-from-ref-function-call.js imports 1 module(s): react.
Where is valid-setState-in-effect-from-ref-function-call.js in the architecture?
valid-setState-in-effect-from-ref-function-call.js is located at compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/valid-setState-in-effect-from-ref-function-call.js (domain: TestingUtilities, subdomain: Fixtures, directory: compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free