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

ParameterTypeDescriptionDefault
countdownOptionsCountdownOptionsThe countdown's options.-

Return Value

ValueTypeDescription
return[number, CountdownControllers]An array containing the countdown's count and its controllers.

On this page