@react-md/utils
Version:
General utils for react-md.
19 lines • 452 B
JavaScript
/**
* A small utility function that allows me to apply a passed in ref along with
* my own custom ref logic.
*
* @param instance - The DOM Node instance
* @param ref - The prop ref
*/
export function applyRef(instance, ref) {
if (!ref) {
return;
}
if (typeof ref === "function") {
ref(instance);
}
else if (typeof ref === "object") {
ref.current = instance;
}
}
//# sourceMappingURL=applyRef.js.map