mirror of
https://github.com/zoriya/v10.git
synced 2026-08-08 23:27:58 +00:00
28 lines
831 B
TypeScript
28 lines
831 B
TypeScript
import { Ref, RefCallback } from "react";
|
|
//#region src/utils/use-composed-refs.d.ts
|
|
type OptionalRef<T> = Ref<T> | undefined;
|
|
/**
|
|
* Compose multiple refs into a single callback ref.
|
|
*
|
|
* @example
|
|
* ```tsx
|
|
* const composedRef = composeRefs(ref1, ref2, ref3);
|
|
* return <div ref={composedRef} />;
|
|
* ```
|
|
*/
|
|
declare function composeRefs<T>(...refs: (OptionalRef<T> | OptionalRef<T>[])[]): RefCallback<T>;
|
|
/**
|
|
* Hook that composes multiple refs into a single callback ref.
|
|
*
|
|
* Memoized for stable reference.
|
|
*
|
|
* @example
|
|
* ```tsx
|
|
* const composedRef = useComposedRefs(forwardedRef, localRef);
|
|
* return <div ref={composedRef} />;
|
|
* ```
|
|
*/
|
|
declare function useComposedRefs<T>(...refs: OptionalRef<T>[]): RefCallback<T>;
|
|
//#endregion
|
|
export { composeRefs, useComposedRefs };
|
|
//# sourceMappingURL=use-composed-refs.d.ts.map
|