Home / Function/ Component() — react Function Reference

Component() — react Function Reference

Architecture documentation for the Component() function in valid-setState-in-effect-from-ref-arithmetic.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  23bba955_8b12_ceaf_d9aa_5b122a4865f6["Component()"]
  bcd5b6e1_ad86_ded9_1595_83c05fca2460["valid-setState-in-effect-from-ref-arithmetic.js"]
  23bba955_8b12_ceaf_d9aa_5b122a4865f6 -->|defined in| bcd5b6e1_ad86_ded9_1595_83c05fca2460
  style 23bba955_8b12_ceaf_d9aa_5b122a4865f6 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-arithmetic.js lines 4–13

function Component() {
  const ref = useRef({size: 5});
  const [computedSize, setComputedSize] = useState(0);

  useLayoutEffect(() => {
    setComputedSize(ref.current.size * 10);
  }, []);

  return computedSize;
}

Subdomains

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-arithmetic.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-arithmetic.js at line 4.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free