Documentation
Utilities
useCountDown

UseCountDown

useCountDown hook is useful for creating a countdown timer. It returns a count value and a start/stop function to control the count down.

Demo

Count: 1000

Usage

import {useCountDown} from "@reactusehooks/core";
 
const {count, start, stop} = useCountDown(
        new Date(Date.now() + 1000),
        {
            interval: 1000,
        }
);
 
console.log(count); // current count
start(); // start count down
stop(); // stop count down