Skip to content

useTimeout

jsxhook

useTimeout: run a callback once after a delay

Installation

$ bunx termuijs add use-timeout

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

Usage

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

API Reference

useTimeout

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