Home / Function/ Foo() — react Function Reference

Foo() — react Function Reference

Architecture documentation for the Foo() function in error.invalid-use-ref-added-to-dep-without-type-info.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  5c12aa41_a482_0c30_127c_745123f43e7b["Foo()"]
  ec3af841_0b68_0330_60ef_8355333f3948["error.invalid-use-ref-added-to-dep-without-type-info.js"]
  5c12aa41_a482_0c30_127c_745123f43e7b -->|defined in| ec3af841_0b68_0330_60ef_8355333f3948
  style 5c12aa41_a482_0c30_127c_745123f43e7b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.invalid-use-ref-added-to-dep-without-type-info.js lines 2–13

function Foo({a}) {
  const ref = useRef();
  // type information is lost here as we don't track types of fields
  const val = {ref};
  // without type info, we don't know that val.ref.current is a ref value so we
  // *would* end up depending on val.ref.current
  // however, this is an instance of accessing a ref during render and is disallowed
  // under React's rules, so we reject this input
  const x = {a, val: val.ref.current};

  return <VideoList videos={x} />;
}

Subdomains

Frequently Asked Questions

What does Foo() do?
Foo() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.invalid-use-ref-added-to-dep-without-type-info.js.
Where is Foo() defined?
Foo() is defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.invalid-use-ref-added-to-dep-without-type-info.js at line 2.

Analyze Your Own Codebase

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

Try Supermodel Free