All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.dist.cjs.merge-refs.cjs Maven / Gradle / Ivy

Go to download

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