babel-plugin-transform-react-class-displayname
v1.0.1
Published
Babel plugin that adds class' name as static property `displayName`
Downloads
24
Maintainers
Readme
babel-plugin-transform-react-class-displayname
Babel plugin that injects class' name as displayName
property.
Install:
npm i -D babel-plugin-transform-react-class-displayname
or
yarn add --dev babel-plugin-transform-react-class-displayname
Usage:
via .babelrc
{
"plugins": ["transform-react-class-displayname"],
}
via cli
babel --plugins transform-react-class-displayname script.js
Note:
If You want to use this plugin with es2015
preset, you need to install transform class properties plugin
Example:
In:
const component = class Class1 {
};
class Class2 {
}
Out:
const component = class Class1 {
static displayName = "Class1";
};
class Class2 {
static displayName = "Class2";
}