wix-style-react
Version:
wix-style-react
24 lines (19 loc) • 706 B
JavaScript
// these are taken from Recompose:
// https://github.com/acdlite/recompose/tree/7918e23eebb74dc930e6ff2d32eb1ead4750f061
//
// TODO: consider using the Recompose package
export var getDisplayName = function getDisplayName(Component) {
if (typeof Component === 'string') {
return Component;
}
if (!Component) {
return undefined;
}
return Component.displayName || Component.name || 'Component';
};
export var wrapDisplayName = function wrapDisplayName(BaseComponent, hocName) {
return hocName + '(' + getDisplayName(BaseComponent) + ')';
};
export var isStatelessComponent = function isStatelessComponent(Component) {
return !(Component.prototype && Component.prototype.render);
};