Skip to content

useStopwatch

jsxhook

useStopwatch: tracks elapsed time with start, pause, and reset controls

Installation

$ bunx termuijs add use-stopwatch

Copies the source into src/components/use-stopwatch/ and installs @termuijs/jsx.

Usage

ts
import { useStopwatch } from '@termuijs/jsx'
ts
const { value, set, reset } = useStopwatch({
  initial: undefined,
})

API Reference

useStopwatch

PropTypeDefaultDescription
initialT | undefinedInitial value
persistbooleanfalsePersist to storage
keystringStorage key
#hook#use-stopwatch