Home / Function/ Component() — react Function Reference

Component() — react Function Reference

Architecture documentation for the Component() function in capture-backedge-phi-with-later-mutation.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  4b2e21bb_8c77_eada_5dcd_aab8a2271e0c["Component()"]
  c87b742b_82bf_3809_b43e_ad26b8dda254["capture-backedge-phi-with-later-mutation.js"]
  4b2e21bb_8c77_eada_5dcd_aab8a2271e0c -->|defined in| c87b742b_82bf_3809_b43e_ad26b8dda254
  style 4b2e21bb_8c77_eada_5dcd_aab8a2271e0c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/capture-backedge-phi-with-later-mutation.js lines 4–23

function Component({prop1, prop2}) {
  'use memo';

  let x = [{value: prop1}];
  let z;
  while (x.length < 2) {
    // there's a phi here for x (value before the loop and the reassignment later)

    // this mutation occurs before the reassigned value
    arrayPush(x, {value: prop2});

    if (x[0].value === prop1) {
      x = [{value: prop2}];
      const y = x;
      z = y[0];
    }
  }
  z.other = true;
  return <Stringify z={z} />;
}

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/new-mutability/capture-backedge-phi-with-later-mutation.js.
Where is Component() defined?
Component() is defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/capture-backedge-phi-with-later-mutation.js at line 4.

Analyze Your Own Codebase

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

Try Supermodel Free