
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
react-change
Advanced tools
Utility for `shouldComponentUpdate` in React and Preact. Deeply compares props and state to detect changes and avoid unnecessary renders.
Utility for shouldComponentUpdate in React and Preact. Deeply compares props and state to detect changes and avoid unnecessary renders.
Intended for plain data structures such as {} and []. Any other objects are compared by reference: ===, not by structure.
Tiny, dependency-free, single file, native module.
shouldComponentUpdate is critical for the performance of frequently-updated views in React and Preact applications. React claims to implement shallow comparison in PureComponent, but what you really want is a deep comparison, which they don't provide.
As a rule of thumb, traversing data structures is much cheaper than making new ones. The cost of a deep shouldComponentUpdate is neglibible compared to the cost of rendering that it avoids.
Sticking this on all your classes is a no-brainer.
npm i -E react-change
import {Component} from 'react'
import {shouldComponentUpdate} from 'react-change'
class ViewComponent extends Component {
shouldComponentUpdate() {
return shouldComponentUpdate.apply(this, arguments)
}
}
You can stick this in a base class for all your components.
Support equality for Date and URL objects.
Now dependency-free and provided as a native module.
I'm receptive to suggestions. If this library almost satisfies you but needs changes, open an issue or chat me up. Contacts: https://mitranim.com/#contacts
FAQs
Utility for `shouldComponentUpdate` in React and Preact. Deeply compares props and state to detect changes and avoid unnecessary renders.
The npm package react-change receives a total of 6 weekly downloads. As such, react-change popularity was classified as not popular.
We found that react-change 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.