Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
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 85 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.