UNPKG

@supunlakmal/hooks

Version:

A collection of reusable React hooks

12 lines (11 loc) 684 B
type ReactRef<T> = React.RefCallback<T> | React.MutableRefObject<T> | null | undefined; /** * Custom hook that merges multiple refs (callback refs or MutableRefObject refs) into a single callback ref. * This allows a single DOM element or component instance to be referenced by multiple sources. * * @template T The type of the element or component being referenced. * @param refs - An array of refs (React.RefCallback<T> or React.MutableRefObject<T>) to merge. * @returns {React.RefCallback<T>} A single memoized callback ref that assigns the instance to all provided refs. */ export declare const useMergeRefs: <T>(...refs: ReactRef<T>[]) => React.RefCallback<T>; export {};