
Security News
Node.js Drops Bug Bounty Rewards After Funding Dries Up
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.
@rooks/use-interval
Advanced tools
npm install rooks
or
yarn add rooks
Rooks is completely treeshakeable and if you use only 1 of the 50+ hooks in the package, only that hook will be bundled with your code. Your bundle will only contain the hooks that you need. Cheers!
setInterval hook for React.
npm install --save @rooks/use-interval
import useInterval from "@rooks/use-interval"
function reducer(state, action) {
switch (action.type) {
case "increment":
return { count: state.count + 1 };
default:
return state;
}
}
function Demo() {
const [value, dispatcher] = useReducer(reducer, { count: 0 });
function increment() {
dispatcher({
type: "increment"
});
}
const { start, stop } = useInterval(() => {
increment();
}, 1000);
return (
<>
<p>value is {value.count}</p>
<button onClick={start}>Start</button>
<button onClick={stop}>Stop</button>
</>
);
}
render(<Demo/>)
| Argument | Type | Description | Default value |
|---|---|---|---|
| callback | function | Function be invoked after each interval duration | undefined |
| intervalDuration | number | Duration in milliseconds after which callback is invoked | undefined |
| startImmediate | boolean | Should the timer start immediately or no | false |
| Returned object attributes | Type | Description |
|---|---|---|
| start | function | Start the interval |
| stop | function | Stop the interval |
| intervalId | intervalId | IntervalId of the interval |
FAQs
A react hook for using setInterval
The npm package @rooks/use-interval receives a total of 1,657 weekly downloads. As such, @rooks/use-interval popularity was classified as popular.
We found that @rooks/use-interval 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
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

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.