Home / Function/ Component() — react Function Reference

Component() — react Function Reference

Architecture documentation for the Component() function in context-var-granular-dep.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  ba77f04c_87e1_0128_2a70_8c00f5508194["Component()"]
  d8176708_fc7f_f677_5d6e_baca69fa9191["context-var-granular-dep.js"]
  ba77f04c_87e1_0128_2a70_8c00f5508194 -->|defined in| d8176708_fc7f_f677_5d6e_baca69fa9191
  style ba77f04c_87e1_0128_2a70_8c00f5508194 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/context-var-granular-dep.js lines 13–34

function Component({cond, a}) {
  let contextVar;
  if (cond) {
    contextVar = {val: a};
  } else {
    contextVar = {};
    throwErrorWithMessage('');
  }
  const cb = {cb: () => contextVar.val * 4};

  /**
   * manually specify input to avoid adding a `PropertyLoad` from contextVar,
   * which might affect hoistable-objects analysis.
   */
  return (
    <ValidateMemoization
      inputs={[cond ? a : undefined]}
      output={cb}
      onlyCheckCompiled={true}
    />
  );
}

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/reduce-reactive-deps/context-var-granular-dep.js.
Where is Component() defined?
Component() is defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/context-var-granular-dep.js at line 13.

Analyze Your Own Codebase

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

Try Supermodel Free