UNPKG

@arolariu/components

Version:

🎨 70+ beautiful, accessible React components built on Base UI. TypeScript-first, CSS Modules styling, tree-shakeable, SSR-ready. Perfect for modern web apps, design systems & rapid prototyping. Zero config, maximum flexibility! ⚡

27 lines • 1.11 kB
import * as React from "react"; /** * Merges multiple refs into a single callback ref. * * @remarks * This hook is essential when you need to attach multiple refs to the same element, * such as combining a forwarded ref with an internal ref for measurements or * imperative operations. All provided refs will receive the same element instance. * * Supports all ref types: callback refs, mutable ref objects, and `null`/`undefined`. * * @typeParam T - The type of the element being referenced. * @param refs - An array of refs to merge. Can include callback refs, ref objects, or undefined. * @returns A callback ref that updates all provided refs. * * @example * ```tsx * const MyComponent = React.forwardRef<HTMLDivElement, Props>((props, forwardedRef) => { * const internalRef = useRef<HTMLDivElement>(null); * const mergedRef = useMergedRefs(forwardedRef, internalRef); * * return <div ref={mergedRef}>Content</div>; * }); * ``` */ export declare function useMergedRefs<T>(...refs: Array<React.Ref<T> | undefined>): React.RefCallback<T>; //# sourceMappingURL=useMergedRefs.d.ts.map