Skip to content

useCounter

jsxhook

useCounter component

Installation

$ bunx termuijs add use-counter

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

Usage

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

API Reference

useCounter

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