useCountdown
Manage countdown state and controls.
useCountdown.tsx
import { useCountdown } from "@cermuel/hooks/react";export function useCountdownExample() { const countdown = useCountdown(10); return <button type="button" onClick={countdown.start}>{countdown.remaining}</button>;}Props
Param
Type
Default Value
initialSecondsnumberoptions?CountdownOptions{}Returns
{ remaining: number; running: boolean; start: () => void; pause: () => void; reset: (seconds?: number) => void; }