UNPKG

@mskcc/carbon-react

Version:

Carbon react components for the MSKCC DSM

27 lines (24 loc) 640 B
/** * MSKCC 2021, 2024 */ /** * @param {...Ref<Element>} refs List of React refs to merge. * @returns {Ref<Element>} Merged React ref. */ const mergeRefs = function () { for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) { refs[_key] = arguments[_key]; } return el => { refs.forEach(ref => { // https://github.com/facebook/react/issues/13029#issuecomment-410002316 if (typeof ref === 'function') { ref(el); } else if (Object(ref) === ref) { ref.current = el; } }); }; }; var mergeRefs$1 = mergeRefs; export { mergeRefs$1 as default };