Home / Function/ Component() — react Function Reference

Component() — react Function Reference

Architecture documentation for the Component() function in escape-analysis-non-escaping-interleaved-allocating-dependency.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  35993a53_77dd_b2e0_543a_51e296a5f570["Component()"]
  1f45915c_9ebf_a36b_e1fc_5b5db442e7ba["escape-analysis-non-escaping-interleaved-allocating-dependency.js"]
  35993a53_77dd_b2e0_543a_51e296a5f570 -->|defined in| 1f45915c_9ebf_a36b_e1fc_5b5db442e7ba
  style 35993a53_77dd_b2e0_543a_51e296a5f570 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/escape-analysis-non-escaping-interleaved-allocating-dependency.js lines 1–15

function Component(props) {
  // a can be independently memoized, is not mutated later
  const a = [props.a];

  // b and c are interleaved and grouped into a single scope,
  // but they are independent values. c does not escape, but
  // we need to ensure that a is memoized or else b will invalidate
  // on every render since a is a dependency.
  const b = [];
  const c = {};
  c.a = a;
  b.push(props.b);

  return b;
}

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/escape-analysis-non-escaping-interleaved-allocating-dependency.js.
Where is Component() defined?
Component() is defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/escape-analysis-non-escaping-interleaved-allocating-dependency.js at line 1.

Analyze Your Own Codebase

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

Try Supermodel Free