Home / Function/ Component() — react Function Reference

Component() — react Function Reference

Architecture documentation for the Component() function in nested-function-shadowed-identifiers.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  f21db3fb_c9bd_5f16_f008_c639503384ad["Component()"]
  0988788d_8980_29f0_7631_0beecfa405d9["nested-function-shadowed-identifiers.js"]
  f21db3fb_c9bd_5f16_f008_c639503384ad -->|defined in| 0988788d_8980_29f0_7631_0beecfa405d9
  style f21db3fb_c9bd_5f16_f008_c639503384ad fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/nested-function-shadowed-identifiers.js lines 1–10

function Component(props) {
  const [x, setX] = useState(null);

  const onChange = e => {
    let x = null; // intentionally shadow the original x
    setX(currentX => currentX + x); // intentionally refer to shadowed x
  };

  return <input value={x} onChange={onChange} />;
}

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/nested-function-shadowed-identifiers.js.
Where is Component() defined?
Component() is defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/nested-function-shadowed-identifiers.js at line 1.

Analyze Your Own Codebase

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

Try Supermodel Free