UNPKG

react-tiniest-form

Version:
11 lines (10 loc) 308 B
const setRef = (ref, instance) => { if (typeof ref === 'function') { ref(instance); } else if (ref !== null && ref !== undefined) { ref.current = instance; } }; const composeRefs = (...refs) => (instance) => refs.forEach(ref => setRef(ref, instance)); export { composeRefs };