Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

opbeat/babel-plugin-add-react-displayname

Folders and files

NameName
Last commit message
Last commit date

Latest commit

author
Ron Cohen
Jan 30, 2018
bbdaa13 · Jan 30, 2018

History

14 Commits
Jan 30, 2018
Sep 28, 2016
Dec 10, 2016
Jan 30, 2018
Jan 30, 2018

Repository files navigation

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published