
Product
Introducing Manifest Alerts
Socket now detects supply chain risks in project manifests, starting with missing lockfiles that can make dependency installs non-reproducible.
@rooks/use-timeout
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!
setTimeout hook for react.
npm install --save @rooks/use-timeout
import useTimeout from "@rooks/use-timeout"
function TimeoutComponent() {
function doAlert() {
window.alert("timeout expired!");
}
const { start, clear } = useTimeout(doAlert, 2000);
return (
<>
<button onClick={start}> Start timeout </button>
<button onClick={clear}> Clear timeout </button>
</>
);
}
render(<TimeoutComponent/>)
| Arguments | Type | Description | Default value |
|---|---|---|---|
| callback | function | Function to be executed in timeout | undefind |
| delay | Number | Number in milliseconds after which callback is to be run | 0 |
| Returned object attributes | Type | Description |
|---|---|---|
| clear | function | Clear the timeout |
| start | function | Start the timeout |
| isActive | boolean | Is the timeout active |
FAQs
A React Hooks package for timeout
The npm package @rooks/use-timeout receives a total of 1,238 weekly downloads. As such, @rooks/use-timeout popularity was classified as popular.
We found that @rooks/use-timeout 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.

Product
Socket now detects supply chain risks in project manifests, starting with missing lockfiles that can make dependency installs non-reproducible.

Research
/Security News
The trojanized extensions use TinyGo-compiled WebAssembly and Solana transaction memos to resolve command-and-control infrastructure.

Security News
Anthropic says the directive cited national security concerns over a narrow jailbreak, but offered no specific technical details.