Home / File/ jsx-attribute-with-jsx-element-value.js — react Source File

jsx-attribute-with-jsx-element-value.js — react Source File

Architecture documentation for jsx-attribute-with-jsx-element-value.js, a javascript file in the react codebase.

Entity Profile

Relationship Graph

Source Code

// @flow
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;
}

function Foo({value}) {
  return value;
}

function Bar({children}) {
  return <div>{children}</div>;
}

function Item({item}) {
  return <div>{item.name}</div>;
}

export const FIXTURE_ENTRYPOINT = {
  fn: Component,
  params: [{items: [{id: 1, name: 'One!'}]}],
};

Subdomains

Frequently Asked Questions

What does jsx-attribute-with-jsx-element-value.js do?
jsx-attribute-with-jsx-element-value.js is a source file in the react codebase, written in javascript. It belongs to the TestingUtilities domain, Fixtures subdomain.
What functions are defined in jsx-attribute-with-jsx-element-value.js?
jsx-attribute-with-jsx-element-value.js defines 4 function(s): Bar, Component, Foo, Item.
Where is jsx-attribute-with-jsx-element-value.js in the architecture?
jsx-attribute-with-jsx-element-value.js is located at compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/jsx-attribute-with-jsx-element-value.js (domain: TestingUtilities, subdomain: Fixtures, directory: compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler).

Analyze Your Own Codebase

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

Try Supermodel Free