babel-plugin-add-react-displayname
Automatically add displayName to all your components
Last updated 8 years ago by roncohen .
MIT · Repository · Bugs · Original npm
$ cnpm install babel-plugin-add-react-displayname 
SYNC missed versions from official npm registry.

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

Current Tags

  • 0.0.5                                ...           latest (8 years ago)

1 Versions

  • 0.0.5                                ...           8 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dependents (0)
None

Copyright 2013 - present © cnpmjs.org