Skip to main content

@crup/react-timer-hook

@crup/react-timer-hook is a lightweight React hooks library for building timers, stopwatches, and real-time clocks with minimal boilerplate.

Start with the ~1.2 kB core hook, then compose opt-in batteries for schedules, diagnostics, duration helpers, and pages with many independent timers.

npm install @crup/react-timer-hook@latest
pnpm add @crup/react-timer-hook@latest

Live preview

StopwatchLive

Stopwatch

0.0s
idle
Elapsed0ms
Tick0
Generationnot started
Absolute countdownLive

Absolute deadline

00:30
idle
Deadline6:52:34 PM
Remaining30s
Wall-clock sourcetimer.now
Independent timer groupLive

Timer group

0/0 uploads running
paused

Public API

  • useTimer() for one lifecycle
  • useScheduledTimer() from /schedules for polling and schedule timing context
  • useTimerGroup() from /group for many keyed independent lifecycles
  • durationParts() from /duration for duration display math

Use the root hook first. Add subpaths only when a screen needs schedules, many independent timers, display parts, or diagnostics.

Use-case shortcuts

Recipe routes