@momentum-ui/react-collaboration
Version:
Cisco Momentum UI Framework for React Collaboration Applications
14 lines (11 loc) • 307 B
text/typescript
import { ForwardedRef } from 'react';
export const applyRef = (ref: ForwardedRef<HTMLElement>, node: HTMLElement): void => {
if (!ref) {
return;
}
if (typeof ref === 'function') {
ref(node);
} else if (Object.prototype.hasOwnProperty.call(ref, 'current')) {
ref.current = node;
}
};