useCountdown
A custom React hook to manage countdown timers.
Example
Loading...
Install
npx shadcn@latest add https://unlogg.com/r/use-countdown.json
pnpm dlx shadcn@latest add https://unlogg.com/r/use-countdown.json
bunx shadcn@latest add https://unlogg.com/r/use-countdown.json
Notes
- Provides a simple way to manage countdown timers.
- Includes functions to start, stop, and reset the countdown.
API Reference
Parameters
Prop | Type | Default |
---|---|---|
options.onComplete? | () => void | undefined |
options.intervalMs? | number | 1000 |
options.countStart? | number | — |
options? | UseCountdownOptions | — |
Returns
Prop | Type | Default |
---|---|---|
handlers.isActive? | boolean | - |
handlers.resetCountdown? | () => void | - |
handlers.stopCountdown? | () => void | - |
handlers.startCountdown? | () => void | - |
count? | number | - |