useStopwatch
jsxhook
useStopwatch: tracks elapsed time with start, pause, and reset controls
Terminal
$termuijs render use-stopwatch
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
| Prop | Type | Default | Description |
|---|---|---|---|
initial | T | undefined | — | Initial value |
persist | boolean | false | Persist to storage |
key | string | — | Storage key |