import React from 'react' const mergeRefs = (...refs: (React.Ref | React.LegacyRef | null | undefined)[]) => (value: T) => { refs.forEach((ref) => { if (ref == null) return if (typeof ref === 'function') { ref(value) return } try { ;(ref as React.MutableRefObject).current = value } catch (e) {} }) } export default mergeRefs