
Security News
Django Joins curl in Pushing Back on AI Slop Security Reports
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
babel-plugin-transform-react-display-name
Advanced tools
Add displayName to React.createClass calls
The babel-plugin-transform-react-display-name package is a Babel plugin that automatically adds display names to React components. This is particularly useful for debugging purposes, as it makes it easier to identify components in the React Developer Tools.
Automatic Display Name Addition
This feature automatically adds a display name to React components, which helps in identifying the component in debugging tools. The plugin scans for React components and assigns a display name based on the variable or function name.
/* .babelrc configuration */
{
"plugins": ["transform-react-display-name"]
}
/* Example React Component */
const MyComponent = () => <div>Hello World</div>;
/* After transformation */
const MyComponent = () => <div>Hello World</div>;
MyComponent.displayName = "MyComponent";
babel-plugin-add-react-displayname is a Babel plugin that also aims to add display names to React components. It provides similar functionality to babel-plugin-transform-react-display-name, ensuring that components are easily identifiable in debugging tools.
Add displayName to
createReactClass
(andReact.createClass
) calls
In
var foo = React.createClass({}); // React <= 15
var bar = createReactClass({}); // React 16+
Out
var foo = React.createClass({
displayName: "foo"
}); // React <= 15
var bar = createReactClass({
displayName: "bar"
}); // React 16+
npm install --save-dev babel-plugin-transform-react-display-name
.babelrc
(Recommended).babelrc
{
"plugins": ["transform-react-display-name"]
}
babel --plugins transform-react-display-name script.js
require("babel-core").transform("code", {
plugins: ["transform-react-display-name"]
});
FAQs
Add displayName to React.createClass calls
The npm package babel-plugin-transform-react-display-name receives a total of 510,286 weekly downloads. As such, babel-plugin-transform-react-display-name popularity was classified as popular.
We found that babel-plugin-transform-react-display-name demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.