
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
react-use-poll
Advanced tools
react-use-poll is a package designed to simplify polling in functional react components.
Add to your project using npm i -S react-use-poll
The simplest possible use is below.
import React from 'react';
import usePoll from 'react-use-poll';
export default function MyComponent() {
usePoll(() => {
console.log('Hello world!');
});
}
// Will log 'Hello world!' once every 5 seconds
It supports dependencies in the same way that useEffect does, to restart the poll.
import React from 'react';
import usePoll from 'react-use-poll';
export default function MyComponent({ prop1 }) {
usePoll(() => {
console.log('Hello world!');
}, [prop1]);
}
// Will log 'Hello world!' once every 5 seconds
It supports asynchronous callbacks. The polling timeout will start at the point that the async function completes.
import React from 'react';
import usePoll from 'react-use-poll';
export default function MyComponent() {
usePoll(async () => {
await fetch();
console.log('Hello world!');
});
}
// Will log 'Hello world!' once every 5 seconds + however long the async function takes to respond
It supports different callback times.
import React from 'react';
import usePoll from 'react-use-poll';
export default function MyComponent() {
usePoll(async () => {
await fetch();
console.log('Hello world!');
}, [], {
interval: 3000
});
}
// Will log 'Hello world!' once every 3 seconds
FAQs
React polling hook
The npm package react-use-poll receives a total of 51 weekly downloads. As such, react-use-poll popularity was classified as not popular.
We found that react-use-poll 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
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.