Home / Function/ Component() — react Function Reference

Component() — react Function Reference

Architecture documentation for the Component() function in error.todo-preserve-memo-deps-mixed-optional-nonoptional-property-chain.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  9590faf5_6e00_a1f8_8d91_b6d11b66245c["Component()"]
  ba48dd20_cc56_8b09_8e01_d224e8af764d["error.todo-preserve-memo-deps-mixed-optional-nonoptional-property-chain.js"]
  9590faf5_6e00_a1f8_8d91_b6d11b66245c -->|defined in| ba48dd20_cc56_8b09_8e01_d224e8af764d
  style 9590faf5_6e00_a1f8_8d91_b6d11b66245c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-preserve-memo-deps-mixed-optional-nonoptional-property-chain.js lines 6–23

function Component({x}) {
  const object = useMemo(() => {
    return identity({
      callback: () => {
        // This is a bug in our dependency inference: we stop capturing dependencies
        // after x.a.b?.c. But what this dependency is telling us is that if `x.a.b`
        // was non-nullish, then we can access `.c.d?.e`. Thus we should take the
        // full property chain, exactly as-is with optionals/non-optionals, as a
        // dependency
        return identity(x.a.b?.c.d?.e);
      },
    });
  }, [x.a.b?.c.d?.e]);
  const result = useMemo(() => {
    return [object.callback()];
  }, [object]);
  return <Inner x={x} result={result} />;
}

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/error.todo-preserve-memo-deps-mixed-optional-nonoptional-property-chain.js.
Where is Component() defined?
Component() is defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-preserve-memo-deps-mixed-optional-nonoptional-property-chain.js at line 6.

Analyze Your Own Codebase

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

Try Supermodel Free