react-composite-events
Version:
A collection of higher-order components (HOCs) to easily create composite events in React components
12 lines (9 loc) • 372 B
Flow
// @flow
import type {ElementType} from 'react'
export const getDisplayName = (Element: ElementType): string => {
if (typeof Element === 'string') {
return Element
}
// $FlowFixMe: Need to figure out how to properly validate that Element is a class component to get `displayName` statically
return Element.displayName || Element.name || 'WrapperComponent'
}