Home / Function/ Component() — react Function Reference

Component() — react Function Reference

Architecture documentation for the Component() function in repro-object-fromEntries-entries.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  9839c1de_f0d6_5a40_3130_6f56bf82af26["Component()"]
  9d5c3d7d_19a7_e6cc_db63_cd5f2a41d3bf["repro-object-fromEntries-entries.js"]
  9839c1de_f0d6_5a40_3130_6f56bf82af26 -->|defined in| 9d5c3d7d_19a7_e6cc_db63_cd5f2a41d3bf
  style 9839c1de_f0d6_5a40_3130_6f56bf82af26 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-object-fromEntries-entries.js lines 6–24

function Component({items}) {
  const record = useMemo(
    () =>
      Object.fromEntries(
        items.map(item => [item.id, ref => <Stringify ref={ref} {...item} />])
      ),
    [items]
  );

  // Without a declaration for Object.entries(), this would be assumed to mutate
  // `record`, meaning existing memoization couldn't be preserved
  return (
    <div>
      {Object.entries(record).map(([id, render]) => (
        <Stringify key={id} render={render} />
      ))}
    </div>
  );
}

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/repro-object-fromEntries-entries.js.
Where is Component() defined?
Component() is defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-object-fromEntries-entries.js at line 6.

Analyze Your Own Codebase

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

Try Supermodel Free