Skip to content
zenui/react-hooks

useCountdown

Count down to a date or through a duration and expose days, hours, minutes and seconds. Time left is computed from the clock rather than by counting ticks, so it does not drift in background tabs. When the target is a Date, the first render depends on the current time, so render it on the client only to avoid a hydration mismatch.

Level
Intermediate
Since
v2.1.0
import {useCountdown} from '@zenuilabs/react-hooks';
Loading demo_

More in Time & Motion