import * as React from 'react' ; const useCombinedRefs = < T extends unknown > ( ... refs ) : React . MutableRefObject < T | null > => { const targetRef = React . useRef < T > ( null ) ; React . useEffect ( ( ) => { refs . forEach ( ( ref ) => { if ( ! ref ) { return ; } if ( typeof ref === 'function' ) { ref ( targetRef . current ) ; } else { ( ref as React . MutableRefObject < T | null > ) . current = targetRef . current ; } } ) ; } , [ refs ] ) ; return targetRef ; } ; export default useCombinedRefs ;