react-new-hoc
Version:
Work with React and HOCs (Higher-Order Components)
13 lines (11 loc) • 343 B
text/typescript
import { ComponentType } from "react";
export const componentDisplayName = {
get(component: ComponentType<any>): string {
return (
component.displayName || component.name || "UnkownComponentDisplayName"
);
},
set(displayName: string, component: ComponentType<any>): void {
component.displayName = displayName;
},
};