import type { Ref } from 'react' /** Sets a ref the caller passed, whether a callback or an object, beside a component's own. */ export function setRef(ref: Ref | undefined, value: T | null) { if (typeof ref === 'function') ref(value) else if (ref) ref.current = value }