decord/alpha/source/hooks/useForwardedRef.tsx

32 lines
721 B
TypeScript
Raw Permalink Normal View History

2026-10-13 12:43:34 +00:00
// Module ID: 17002
// Function ID: 17003
2026-10-03 08:58:59 +00:00
// Name: react
// Dependencies: [19, 2]
// Exports: default
2026-10-13 12:43:34 +00:00
// Module 17002 (react)
2026-10-03 08:58:59 +00:00
import react from "react" /* 19 */;
import size from "module_2" /* 2 */;
const result = size.fileFinishedImporting("hooks/useForwardedRef.tsx");
export default function useForwardedRef(arg0) {
2026-10-03 08:58:59 +00:00
let closure_0 = arg0;
const ref = react.useRef(null);
const items = [arg0];
const items1 = [
ref,
2026-10-03 08:58:59 +00:00
react.useCallback((current) => {
if (null != closure_0) {
2026-10-03 08:58:59 +00:00
if (typeof closure_0 === "function") {
closure_0(current);
} else {
2026-10-03 08:58:59 +00:00
closure_0.current = current;
}
ref.current = current;
}
}, items)
];
return items1;
};