Home / Function/ Component() — react Function Reference

Component() — react Function Reference

Architecture documentation for the Component() function in reactive-control-dependency-switch-condition.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  c5fb24b1_99dd_8f20_6d72_5aa38526e94b["Component()"]
  72f3af72_0c02_1e6b_b7c5_3ba161f34b93["reactive-control-dependency-switch-condition.js"]
  c5fb24b1_99dd_8f20_6d72_5aa38526e94b -->|defined in| 72f3af72_0c02_1e6b_b7c5_3ba161f34b93
  style c5fb24b1_99dd_8f20_6d72_5aa38526e94b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reactive-control-dependency-switch-condition.js lines 3–18

function Component({value}) {
  let x;
  switch (GLOBAL) {
    case value: {
      x = 1;
      break;
    }
    default: {
      x = 2;
    }
  }
  // The values assigned to `x` are non-reactive, but the value of `x`
  // depends on the "control" value `props.value` which is reactive.
  // Therefore x should be treated as reactive too.
  return [x];
}

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/reactive-control-dependency-switch-condition.js.
Where is Component() defined?
Component() is defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reactive-control-dependency-switch-condition.js at line 3.

Analyze Your Own Codebase

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

Try Supermodel Free