
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
react-use-shared-tick
Advanced tools
React hook run function in same setInterval
use npm
npm install react-use-shared-tick --save
use yarn
yarn add react-use-shared-tick
use pnpm
pnpm install react-use-shared-tick
run function per second
import { useStatus } from "react"
import useSharedTick from "react-use-shared-tick"
function App() {
const [time, setTime] = useState(Date.now())
useSharedTick(setTime)
return (
<div>Current Timestamp: {time}</div>
)
}
run function per 3 second
useSharedTick(setTime, {tick: 3000})
useSharedTick(handler: (t: number)=>void, param)
| Param | Type | Description |
|---|---|---|
| timestamp | number | current timestamp |
| Field | Type | Default | Requirement | Description |
|---|---|---|---|---|
| tick | number | 1000 | No | Running interval time |
| runOnTabVisible | boolean | false | No | when true will pause/start interval if visibilitychange event dispatched |
The files included in this repository are licensed under the MIT license.
FAQs
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
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.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.