xtreme-ui
Version:
Collection of reusable components that can be used in web projects
20 lines (19 loc) • 320 B
JavaScript
function r(n, t) {
if (typeof n == "function")
n(t);
else if (n != null)
try {
n.current = t;
} catch {
throw new Error(`Cannot assign value "${t}" to ref "${n}"`);
}
}
function c(n) {
return (t) => {
n.forEach((o) => r(o, t));
};
}
export {
r as assignRef,
c as mergeRefs
};