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.
use-changed-props
Advanced tools
A React hook to log which props have changed. The hook will also include the changes for each prop, which is useful for tracking down unnecessary work when nothing really changed eg. a reference was updated.
https://www.npmjs.com/package/use-changed-props
https://codepen.io/mozmorris/pen/BaopXRX?editors=1111
npm install use-changed-props
or
yarn add use-changed-props
import useChangedProps from "use-changed-props"
const App = props => {
// log props changes
useChangedProps(props)
return </div>
}
import useChangedProps from "use-changed-props"
const App = props => {
// disable logging
const options = { log: false }
// store changed props
const changedProps = useChangedProps(props, options)
return </div>
}
Option | Description | Default |
---|---|---|
log | Should automatically log prop changes to the console | true |
MIT
"How to check what props have changed?"
"Determine which props caused a re-render"
I've found myself Googling these questions on more than one occasion. Ideally I can now just drop this hook in to my component and get feedback about which props have changed and also the differences.
FAQs
React Hook to output props that have changed
The npm package use-changed-props receives a total of 149 weekly downloads. As such, use-changed-props popularity was classified as not popular.
We found that use-changed-props 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.