
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-forceupdate
Advanced tools
[](https://www.npmjs.com/package/react-forceupdate) [](https://www.npmjs.com/package
React hooks for force updating components. Force update from anywhere to those using a useForceUpdate hook.
mitt: tiny library ~270 byte gzipped. https://bundlephobia.com/result?p=mitt
npm install mitt
npm install react-forceupdate
# or
# yarn add mitt
# yarn add react-forceupdate
import { runForceUpdate, useForceUpdate } from 'react-forceupdate'
let nonReactive = {
something: '',
}
let Lorem = () => {
useForceUpdate() // re-render on runForceUpdate event.
return <div> {nonReactive.something} </div>
}
let Ipsum = () => {
useForceUpdate() // re-render on runForceUpdate event.
return <div> {nonReactive.something} </div>
}
function App() {
let onForceUpdate = () => {
// apply non-reactive changes.
nonReactive.something = 'something updated'
// force update those who uses useForceUpdate hook.
runForceUpdate()
}
return (
<main>
<button onClick={onForceUpdate}>Force update</button>
<DeeplyNestedComponentContainingLorem />
<DeeplyNestedComponentContainingIpsum />
</main>
)
}
import { runForceUpdate, useForceUpdate } from 'react-forceupdate'
let Lorem = () => {
let data = useForceUpdate({ type: 'lorem' }) // re-render on runForceUpdate event.
return <pre>{JSON.stringify(data, null, 2)}</pre>
}
let Ipsum = () => {
let data = useForceUpdate({ type: 'ipsum' }) // re-render on runForceUpdate event.
return <pre>{JSON.stringify(data, null, 2)}</pre>
}
let CatchAll = () => {
let data = useForceUpdate({ type: '*' }) // re-render on runForceUpdate event.
return <pre>{JSON.stringify(data, null, 2)}</pre>
}
function App() {
let onForceUpdateLorem = () => {
// force update those who uses useForceUpdate hook with given type.
runForceUpdate({ type: 'lorem', payload: 'hi' })
}
let onForceUpdateIpsum = () => {
// force update those who uses useForceUpdate hook with given type.
runForceUpdate({ type: 'ipsum' })
}
let onForceUpdateLoremIpsum = () => {
// force update those who uses useForceUpdate hook with given type.
runForceUpdate([
{ type: 'lorem', payload: { value: 1 } },
{ type: 'ipsum', payload: 'hello' },
{ payload: 'howdy' }, // default type
])
}
return (
<main>
<button onClick={onForceUpdateLorem}>Force update lorem</button>
<button onClick={onForceUpdateIpsum}>Force update ipsum</button>
<button onClick={onForceUpdateLoremIpsum}>
Force update lorem and ipsum
</button>
<DeeplyNestedComponentContainingLorem />
<DeeplyNestedComponentContainingIpsum />
<DeeplyNestedComponentContainingCatchAll />
</main>
)
}
https://codesandbox.io/s/react-forceupdate-pioue?file=/src/App.js
FAQs
[](https://www.npmjs.com/package/react-forceupdate) [](https://www.npmjs.com/packag
The npm package react-forceupdate receives a total of 135 weekly downloads. As such, react-forceupdate popularity was classified as not popular.
We found that react-forceupdate 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.