Home / Function/ Component() — react Function Reference

Component() — react Function Reference

Architecture documentation for the Component() function in jsx-attribute-with-jsx-element-value.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  2a7d938e_66bc_666b_80ae_b408430e87bd["Component()"]
  31d60f6c_a2a4_e5dc_36e6_08c09eafbcd3["jsx-attribute-with-jsx-element-value.js"]
  2a7d938e_66bc_666b_80ae_b408430e87bd -->|defined in| 31d60f6c_a2a4_e5dc_36e6_08c09eafbcd3
  style 2a7d938e_66bc_666b_80ae_b408430e87bd fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/jsx-attribute-with-jsx-element-value.js lines 2–16

function Component({items}) {
  // Per the spec, <Foo value=<>{...}</> /> is valid.
  // But many tools don't allow fragments as jsx attribute values,
  // so we ensure not to emit them wrapped in an expression container
  return items.length > 0 ? (
    <Foo
      value={
        <Bar>
          {items.map(item => (
            <Item key={item.id} item={item} />
          ))}
        </Bar>
      }></Foo>
  ) : null;
}

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/jsx-attribute-with-jsx-element-value.js.
Where is Component() defined?
Component() is defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/jsx-attribute-with-jsx-element-value.js at line 2.

Analyze Your Own Codebase

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

Try Supermodel Free