Skip to content

Latest commit

 

History

History

util.displayname

@rcp/util.displayname

NPM version NPM Downloads

The utility for getting display name

Installation

npm install @rcp/util.displayname
# or use yarn
yarn add @rcp/util.displayname

Usage

import displayName from '@rcp/util.displayname'

class A extends React.Component {}
displayName(A) === 'A'

class Foo extends React.Component {
  static displayName = 'FooFoo'
}
displayName(Foo) === 'FooFoo'

API

displayName

The utility for getting display name

Parameters

  • component (React.ComponentType | React.ReactElement<any> | IFunction | string)

Returns string

Authors

This library is written and maintained by imcuttle, [email protected].

License

MIT