@piplup/utils
Version:
A collection of utility hooks and functions crafted to power up the packages within Piplup.
11 lines (10 loc) • 518 B
TypeScript
/**
* Creates a function that forwards an instance to multiple refs.
*
* This function returns a callback that assigns the provided `instance` to each ref in `refs`.
* If all refs are `null` or `undefined`, it returns `null`.
*
* @param refs - An array of refs to forward the instance to.
* @returns A function that forwards the instance to each ref, or `null` if all refs are `null`/`undefined`.
*/
export declare function forkRef<T>(...refs: Array<React.Ref<T> | undefined>): ((instance: T) => void) | null;