getDisplayName.tsx 262 B

12345678
  1. // Attempts to get a display name from a Component
  2. //
  3. // Use for HoCs
  4. export default function getDisplayName<Props = {}>(
  5. WrappedComponent: React.ComponentType<Props>
  6. ): string {
  7. return WrappedComponent.displayName || WrappedComponent.name || 'Component';
  8. }