Home / Function/ Component() — react Function Reference

Component() — react Function Reference

Architecture documentation for the Component() function in reactive-ref-ternary.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  4a0d459d_941b_af95_0d52_30d02a3e1470["Component()"]
  fbf6307d_ed04_6506_5132_cee30af94797["reactive-ref-ternary.js"]
  4a0d459d_941b_af95_0d52_30d02a3e1470 -->|defined in| fbf6307d_ed04_6506_5132_cee30af94797
  style 4a0d459d_941b_af95_0d52_30d02a3e1470 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/infer-effect-dependencies/reactive-ref-ternary.js lines 5–15

function Component({cond}) {
  const arr = useRef([]);
  const other = useRef([]);
  // Although arr and other are both stable, derived is not
  const derived = cond ? arr : other;
  useEffect(() => {
    mutate(derived.current);
    print(derived.current);
  }, AUTODEPS);
  return arr;
}

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/infer-effect-dependencies/reactive-ref-ternary.js.
Where is Component() defined?
Component() is defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/infer-effect-dependencies/reactive-ref-ternary.js at line 5.

Analyze Your Own Codebase

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

Try Supermodel Free