![Malicious npm Package Typosquats react-login-page to Deploy Keylogger](https://cdn.sanity.io/images/cgdhsj6q/production/007b21d9cf9e03ae0bb3f577d1bd59b9d715645a-1024x1024.webp?w=400&fit=max&auto=format)
Research
Security News
Malicious npm Package Typosquats react-login-page to Deploy Keylogger
Socket researchers unpack a typosquatting package with malicious code that logs keystrokes and exfiltrates sensitive data to a remote server.
use-force-update
Advanced tools
Readme
useForceUpdate
is a React Hook that forces your function component to
re-render.
useForceUpdate
does not serve a purpose in and of itself. It is a tiny
package that aims to be integrated into larger hooks, making obsolete any class
functionality that is still reliant on this.forceUpdate()
.
npm install use-force-update
oryarn add use-force-update
In its simplest form, useForceUpdate
re-renders a component.
import useForceUpdate from 'use-force-update';
let renderCount = 0;
export default function MyButton() {
const forceUpdate = useForceUpdate();
renderCount++;
return (
<>
<p>I have rendered {renderCount} times.</p>
<button onClick={forceUpdate}>
Re-render
</button>
</>
);
};
In its ideal form, useForceUpdate
integrates with event emitters, such as
state managers.
import { useEffect } from 'react';
import useForceUpdate from 'use-force-update';
import store from './store';
export default function MyButton() {
const forceUpdate = useForceUpdate();
const username = store.get('username');
useEffect(() => {
// When the username changes, re-render this component.
const selector = state => state.username;
const unsubscribe = store.subscribe(selector, forceUpdate);
// When we unmount, stop re-rendering this component.
return () => {
unsubscribe();
};
}, [forceUpdate]);
if (username === null) {
return <p>You are not logged in.</p>;
}
return <p>Hello, {username}!</p>;
};
FAQs
Unknown package
The npm package use-force-update receives a total of 26,943 weekly downloads. As such, use-force-update popularity was classified as popular.
We found that use-force-update 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 unpack a typosquatting package with malicious code that logs keystrokes and exfiltrates sensitive data to a remote server.
Security News
The JavaScript community has launched the e18e initiative to improve ecosystem performance by cleaning up dependency trees, speeding up critical parts of the ecosystem, and documenting lighter alternatives to established tools.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.