Home / Function/ Component() — react Function Reference

Component() — react Function Reference

Architecture documentation for the Component() function in lambda-with-fbt.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  851291f8_d377_9755_8ebb_3474655729b0["Component()"]
  85cbb0c2_b9e2_0841_acaa_8b2dadb64716["lambda-with-fbt.js"]
  851291f8_d377_9755_8ebb_3474655729b0 -->|defined in| 85cbb0c2_b9e2_0841_acaa_8b2dadb64716
  style 851291f8_d377_9755_8ebb_3474655729b0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/lambda-with-fbt.js lines 3–30

function Component() {
  const buttonLabel = () => {
    if (!someCondition) {
      return <fbt desc="My label">{'Purchase as a gift'}</fbt>;
    } else if (
      !iconOnly &&
      showPrice &&
      item?.current_gift_offer?.price?.formatted != null
    ) {
      return (
        <fbt desc="Gift button's label">
          {'Gift | '}
          <fbt:param name="price">
            {item?.current_gift_offer?.price?.formatted}
          </fbt:param>
        </fbt>
      );
    } else if (!iconOnly && !showPrice) {
      return <fbt desc="Gift button's label">{'Gift'}</fbt>;
    }
  };

  return (
    <View>
      <Button text={buttonLabel()} />
    </View>
  );
}

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/fbt/lambda-with-fbt.js.
Where is Component() defined?
Component() is defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/lambda-with-fbt.js at line 3.

Analyze Your Own Codebase

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

Try Supermodel Free