Home / Function/ Component() — react Function Reference

Component() — react Function Reference

Architecture documentation for the Component() function in aliased-nested-scope-truncated-dep.tsx from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  9fad2228_0e88_fbd6_1638_5277b2dc7cfc["Component()"]
  b6639f9c_b1c3_c5ef_b1a0_3f3622dfd822["aliased-nested-scope-truncated-dep.tsx"]
  9fad2228_0e88_fbd6_1638_5277b2dc7cfc -->|defined in| b6639f9c_b1c3_c5ef_b1a0_3f3622dfd822
  style 9fad2228_0e88_fbd6_1638_5277b2dc7cfc fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/aliased-nested-scope-truncated-dep.tsx lines 74–88

function Component({prop}) {
  let obj = shallowCopy(prop);
  const aliasedObj = identity(obj);

  // [obj.id] currently is assigned its own reactive scope
  const id = [obj.id];

  // Writing to the alias may reassign to previously captured references.
  // The compiler currently produces valid output, but this breaks with
  // reordering, recycleInto, and other potential optimizations.
  mutate(aliasedObj);
  setPropertyByKey(aliasedObj, 'id', prop.id + 1);

  return <Stringify id={id} />;
}

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/aliased-nested-scope-truncated-dep.tsx.
Where is Component() defined?
Component() is defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/aliased-nested-scope-truncated-dep.tsx at line 74.

Analyze Your Own Codebase

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

Try Supermodel Free