useCountdown
Custom hook that manages countdown.
Custom hook that manages countdown.
Usage
import { useCountdown } from "@tilt-legal/cubitt-components/utilities/hooks";
const [counter, { start, stop, reset }] = useCountdown({
countStart: 10,
intervalMs: 1000,
isIncrement: false,
});API
Signature
declare function useCountdown({ countStart, countStop, intervalMs, isIncrement, }: CountdownOptions): [number, CountdownControllers];Parameters
| Parameter | Type | Description | Default |
|---|---|---|---|
countdownOptions | CountdownOptions | The countdown's options. | - |
Return Value
| Value | Type | Description |
|---|---|---|
return | [number, CountdownControllers] | An array containing the countdown's count and its controllers. |