Home / Function/ Component() — react Function Reference

Component() — react Function Reference

Architecture documentation for the Component() function in mutable-lifetime-with-aliasing.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  7c725a2e_72df_9ccb_e79f_2ef14279b716["Component()"]
  ec6e6e08_54ad_605d_5234_13d4aec41b5b["mutable-lifetime-with-aliasing.js"]
  7c725a2e_72df_9ccb_e79f_2ef14279b716 -->|defined in| ec6e6e08_54ad_605d_5234_13d4aec41b5b
  62d30e75_aec9_3119_76fd_9f4ec010d00f["mutate()"]
  7c725a2e_72df_9ccb_e79f_2ef14279b716 -->|calls| 62d30e75_aec9_3119_76fd_9f4ec010d00f
  style 7c725a2e_72df_9ccb_e79f_2ef14279b716 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/mutable-lifetime-with-aliasing.js lines 12–40

function Component(props) {
  const a = {};
  const b = [a]; // array elements alias
  const c = {};
  const d = {c}; // object values alias

  // capture all the values into this object
  const x = {};
  x.b = b;
  const y = mutate(x, d); // mutation aliases the arg and return value

  // all of these tests are seemingly readonly, since the values are never directly
  // mutated again. but they are all aliased by `x`, which is later modified, and
  // these are therefore mutable references:
  if (a) {
  }
  if (b) {
  }
  if (c) {
  }
  if (d) {
  }
  if (y) {
  }

  // could in theory mutate any of a/b/c/x/z, so the above should be inferred as mutable
  mutate(x, null);
  return x;
}

Subdomains

Calls

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/mutable-lifetime-with-aliasing.js.
Where is Component() defined?
Component() is defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/mutable-lifetime-with-aliasing.js at line 12.
What does Component() call?
Component() calls 1 function(s): mutate.

Analyze Your Own Codebase

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

Try Supermodel Free