
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-props
Advanced tools
Mutate(Change) React props, for each element in tree, and replace children.
Mutate(Change) React props, for each element in tree, and replace children.
In React, you cannot change this.props of any component,
but in case you want to?
npm install react-change-props -S
# or
yarn add react-change-props
import React from 'react'
import changeProps from 'react-change-props'
const replacer = str => (str && {className: 'my-prefix-' + str})
const newThing = changeProps(
<div className="a"><p className="b"><span>text</span></p></div>,
el => replacer(el.props.className)
)
The newThing will be:
<div className="my-prefix-a"><p className="my-prefix-b"><span>text</span></p></div>
The API is easy:
// changeProps(JSX, [replacer])
var newJSX = changeProps(JSX, el => new_props_for_this_el)
If you return { children: <Foo/> } from above replacer, the children elements will be replaced.
The return value of replacer will be passed into Object.assign({}, return_value), so if you return Non-Object, nothing happend.
React only put Object.freeze when process.env.NODE_ENV==='development', this lib will account the case of development and production.
FAQs
Mutate(Change) React props, for each element in tree, and replace children.
We found that react-change-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.

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.