Home / Function/ Component() — react Function Reference

Component() — react Function Reference

Architecture documentation for the Component() function in merge-consecutive-scopes-deps-subset-of-decls.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  2663fa87_37b1_5c7c_1249_8dc478fb70cf["Component()"]
  5de197dc_24a0_bde4_aae2_ce24c27657d9["merge-consecutive-scopes-deps-subset-of-decls.js"]
  2663fa87_37b1_5c7c_1249_8dc478fb70cf -->|defined in| 5de197dc_24a0_bde4_aae2_ce24c27657d9
  style 2663fa87_37b1_5c7c_1249_8dc478fb70cf fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/merge-consecutive-scopes-deps-subset-of-decls.js lines 3–16

function Component() {
  const [count, setCount] = useState(0);
  return (
    <div>
      <button onClick={() => setCount(count - 1)}>Decrement</button>
      {/**
       * The scope for the <button> depends on just the scope for the callback,
       * but the previous scope (after merging) will declare both the above
       * <button> and the callback.
       */}
      <button onClick={() => setCount(count + 1)}>Increment</button>
    </div>
  );
}

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/merge-consecutive-scopes-deps-subset-of-decls.js.
Where is Component() defined?
Component() is defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/merge-consecutive-scopes-deps-subset-of-decls.js at line 3.

Analyze Your Own Codebase

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

Try Supermodel Free