
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
react-dom-polyfill
Advanced tools
Publish React libs that work with all React versions (0.12+)
Publish React libs that work with almost all React versions.
Considering the cost of upgrading in big orgs, older versions of React (<0.14, pre ReactDOM) are still used in large codebases. React DOM Polyfill allows you to publish libs that work both with latest React and older versions (starting with 0.12), by proxying how your lib interacts with DOM in React.
Usage:
// CommonJS
var React = require('react');
var ReactDOM = require('react-dom-polyfill')(React);
// ES6
import React from 'react';
import reactDOMPolyfill from 'react-dom-polyfill';
const ReactDOM = reactDOMPolyfill(React);
Notes:
Also update your React/ReactDOM peer dependencies to make your published lib compatible with all React versions. The latter should be missing (and thus optional). This is a rough example:
"peerDependencies": {
"react": ">=0.12 <16"
}
Even though calling findDOMNode
on DOM element refs is not required in newer versions of React, you must always do it to account for older Reacts. This makes this polyfill somewhat special. E.g.
// Polyfill will simply return this.refs.searchInput with newer React versions,
// but will call this.refs.searchInput.getDOMNode() with older versions
ReactDOM.findDOMNode(this.refs.searchInput)
Make sure you have the browserify-optional transform installed in your devDependencies when building via Browserify.
FAQs
Publish React libs that work with all React versions (0.12+)
The npm package react-dom-polyfill receives a total of 42 weekly downloads. As such, react-dom-polyfill popularity was classified as not popular.
We found that react-dom-polyfill 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 uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.