
Security News
Feross on Risky Business Weekly Podcast: npm’s Ongoing Supply Chain Attacks
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
babel-plugin-transform-react-pure-to-component
Advanced tools
Convert React.PureComponent to React.Component to improve hot reloading.
This plugin transforms any class extending React’s PureComponent
to extend Component
instead. This should only be enabled in development, and only when using hot reloading. Extending Component
in all cases in development means that changes to the render
method of your component will be run, where PureComponent
s will opt out via their componentWillUpdate()
checks.
In
import React, {PureComponent} from 'react';
class MyComponent extends PureComponent {}
Out
import React, {Component as _Component} from 'react';
class MyComponent extends _Component {}
This plugin also handles cases where you use a namespace import (import * as React from 'react';
), default imports with properties (import React from 'react'; class MyComponent extends React.PureComponent {}
), and named imports other than React
/ PureComponent
.
# yarn
yarn add --dev babel-plugin-pure-to-impure-component
# npm
npm install --save-dev babel-plugin-pure-to-impure-component
.babelrc
(Recommended).babelrc
{
"plugins": ["transform-react-pure-to-component"]
}
babel --plugins transform-react-pure-to-component script.js
require('babel-core').transform('code', {
plugins: ['transform-react-pure-to-component'],
});
FAQs
Convert React.PureComponent to React.Component to improve hot reloading.
The npm package babel-plugin-transform-react-pure-to-component receives a total of 58 weekly downloads. As such, babel-plugin-transform-react-pure-to-component popularity was classified as not popular.
We found that babel-plugin-transform-react-pure-to-component demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
Research
/Security News
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.