package.dist.cjs.merge-refs.cjs Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of react Show documentation
Show all versions of react Show documentation
Responsive and accessible React UI components built with React and Emotion
The newest version!
"use strict";
'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);
});
};
}
exports.assignRef = assignRef;
exports.mergeRefs = mergeRefs;
© 2015 - 2025 Weber Informatics LLC | Privacy Policy