@nex-ui/utils
Version:
Utility functions for React components.
19 lines (15 loc) • 503 B
JavaScript
var reactIs = require('react-is');
function supportRef(nodeOrComponent) {
if (typeof nodeOrComponent.type === 'string') {
return true;
}
if (reactIs.isMemo(nodeOrComponent) && nodeOrComponent.type && typeof nodeOrComponent.type.type === 'object' && nodeOrComponent.type.type.$$typeof === reactIs.ForwardRef) {
return true;
}
if (reactIs.isForwardRef(nodeOrComponent)) {
return true;
}
return false;
}
exports.supportRef = supportRef;
;