Home / File/ error.todo-allow-assigning-to-inferred-ref-prop-in-callback.js — react Source File

error.todo-allow-assigning-to-inferred-ref-prop-in-callback.js — react Source File

Architecture documentation for error.todo-allow-assigning-to-inferred-ref-prop-in-callback.js, a javascript file in the react codebase.

Entity Profile

Relationship Graph

Source Code

// @validateRefAccessDuringRender

function useHook(parentRef) {
  // Some components accept a union of "callback" refs and ref objects, which
  // we can't currently represent
  const elementRef = useRef(null);
  const handler = instance => {
    elementRef.current = instance;
    if (parentRef != null) {
      if (typeof parentRef === 'function') {
        // This call infers the type of `parentRef` as a function...
        parentRef(instance);
      } else {
        // So this assignment fails since we don't know its a ref
        parentRef.current = instance;
      }
    }
  };
  return handler;
}

Subdomains

Functions

Frequently Asked Questions

What does error.todo-allow-assigning-to-inferred-ref-prop-in-callback.js do?
error.todo-allow-assigning-to-inferred-ref-prop-in-callback.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 error.todo-allow-assigning-to-inferred-ref-prop-in-callback.js?
error.todo-allow-assigning-to-inferred-ref-prop-in-callback.js defines 1 function(s): useHook.
Where is error.todo-allow-assigning-to-inferred-ref-prop-in-callback.js in the architecture?
error.todo-allow-assigning-to-inferred-ref-prop-in-callback.js is located at compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-allow-assigning-to-inferred-ref-prop-in-callback.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