1 import type { Ref } from 'react';
2 import { useCallback } from 'react';
4 const useCombinedRefs = <T extends any>(...refs: (Ref<T> | undefined)[]): Ref<T> =>
7 refs.forEach((ref) => {
12 // Ref can have two types - a function or an object. We treat each case.
13 if (typeof ref === 'function') {
17 // As per https://github.com/facebook/react/issues/13029
18 // it should be fine to set current this way.
19 (ref as any).current = element;
24 export default useCombinedRefs;