UNPKG

@chakra-ui/react

Version:

Responsive and accessible React UI components built with React and Emotion

23 lines (21 loc) 427 B
"use strict"; function assignRef(ref, value) { if (ref == null) return; if (typeof ref === "function") { ref(value); return; } try { ref.current = value; } catch (error) { throw new Error(`Cannot assign value '${value}' to ref '${ref}'`); } } function mergeRefs(...refs) { return (node) => { refs.forEach((ref) => { assignRef(ref, node); }); }; } export { assignRef, mergeRefs };