Hooks

useCountdown

Publisher

cermuel

50 hooks published

More from this publisher

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
initialSeconds
number
options?
CountdownOptions
{}

Returns

{ remaining: number; running: boolean; start: () => void; pause: () => void; reset: (seconds?: number) => void; }