babel-plugin-add-react-displayname

0.0.5 • Public • Published

babel-plugin-add-react-displayname

Automatically detects and sets displayName for React components. This is useful for having real component names show up in production builds of React apps.

Babel already does this for React.createClass style components, this adds support for the two other kinds of component definitions:

  • ES6-classes style components
  • Stateless components that return JSX

Installation

Simply add add-react-displayname to your .babelrc file:

{
    "plugins": ["add-react-displayname"]
}

Troubleshooting

Doesn't work for decorated classes

If you are using the transform-decorators-legacy plugin, make sure it's placed after this plugin in your plugin list.

Testing

npm test

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.5
    2,719,254
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.5
    2,719,254
  • 0.0.4
    295
  • 0.0.3
    1
  • 0.0.2
    1
  • 0.0.1
    0

Package Sidebar

Install

npm i babel-plugin-add-react-displayname

Weekly Downloads

2,181,179

Version

0.0.5

License

MIT

Last publish

Collaborators

  • roncohen