useCountdown
Custom hook that manages countdown.
Installation
npx sse-tool add use-countdown
npm install sse-hooks
Usage
import { useCountdown } from "./{hooks file}";
const [counter, { start, stop, reset }] = useCountdown({
countStart: 10,
intervalMs: 1000,
isIncrement: false,
});
import { useCountdown } from "sse-hooks";
const [counter, { start, stop, reset }] = useCountdown({
countStart: 10,
intervalMs: 1000,
isIncrement: false,
});
API
Parameters
| Name | Type | Description |
|---|---|---|
| countdownOptions | CountdownOptions | The countdown's options. |
Return Value
Returns any.
An array containing the countdown's count and its controllers.