Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
@babel/plugin-transform-react-display-name
Advanced tools
Add displayName to React.createClass calls
The @babel/plugin-transform-react-display-name npm package is a Babel plugin that adds the displayName property to React components for use in debugging messages and dev tools. It helps to identify components in the React DevTools by providing a readable name, which is particularly useful for anonymous components.
Automatic displayName assignment for React components
This feature automatically assigns a displayName to React components based on their name. This is useful for debugging purposes, as it allows you to see the component's name in the React DevTools.
class MyComponent extends React.Component {}
// Transformed code with displayName:
// MyComponent.displayName = 'MyComponent';
displayName assignment for functional components
Similar to class components, this feature assigns a displayName to functional components, making them easier to identify in the React DevTools.
const MyComponent = () => <div />;
// Transformed code with displayName:
// MyComponent.displayName = 'MyComponent';
displayName assignment for components created with React.createClass
For components created using React.createClass, this plugin also adds a displayName property, which is useful for projects that have not yet migrated to ES6 classes or functional components.
const MyComponent = React.createClass({
render: function() { return <div />; }
});
// Transformed code with displayName:
// MyComponent.displayName = 'MyComponent';
This package is similar to @babel/plugin-transform-react-display-name as it also adds a displayName to React components. However, it is a standalone Babel plugin that might not be as actively maintained or integrated into the Babel ecosystem as the official Babel plugin.
This package provides a utility function to help manually assign a displayName to a React component. It is not a Babel plugin and requires manual usage within the code, unlike the automatic transformation provided by @babel/plugin-transform-react-display-name.
Add displayName to React.createClass calls
See our website @babel/plugin-transform-react-display-name for more information.
Using npm:
npm install --save-dev @babel/plugin-transform-react-display-name
or using yarn:
yarn add @babel/plugin-transform-react-display-name --dev
FAQs
Add displayName to React.createClass calls
The npm package @babel/plugin-transform-react-display-name receives a total of 10,303,507 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 healthy version release cadence and project activity because the last version was released less than 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
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.