useHook() — react Function Reference
Architecture documentation for the useHook() function in error.todo-allow-assigning-to-inferred-ref-prop-in-callback.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD 1ab1502a_94d6_a20a_65c3_aa7310ce9345["useHook()"] 2304a93e_7648_0b48_c050_6b2a910744fe["error.todo-allow-assigning-to-inferred-ref-prop-in-callback.js"] 1ab1502a_94d6_a20a_65c3_aa7310ce9345 -->|defined in| 2304a93e_7648_0b48_c050_6b2a910744fe style 1ab1502a_94d6_a20a_65c3_aa7310ce9345 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-allow-assigning-to-inferred-ref-prop-in-callback.js lines 3–20
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;
}
Domain
Subdomains
Source
Frequently Asked Questions
What does useHook() do?
useHook() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-allow-assigning-to-inferred-ref-prop-in-callback.js.
Where is useHook() defined?
useHook() is defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-allow-assigning-to-inferred-ref-prop-in-callback.js at line 3.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free