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
  64278978_ab30_528b_fac0_defe3d5a40f1["Component()"]
  e52aa4de_285e_196e_53e4_0340a9039e26["aliased-nested-scope-truncated-dep.tsx"]
  64278978_ab30_528b_fac0_defe3d5a40f1 -->|defined in| e52aa4de_285e_196e_53e4_0340a9039e26
  style 64278978_ab30_528b_fac0_defe3d5a40f1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/aliased-nested-scope-truncated-dep.tsx lines 73–87

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

Analyze Your Own Codebase

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

Try Supermodel Free