Skip to content
aq-ui
Back to HooksHook

Use Interval

Open-code aq-ui React hook for Use Interval.

Installation

pnpm dlx aq-ui@alpha add use-interval

API reference

Client module

Import the parts you need, then jump to an export for its contract.

View full source

Quick start

"use client"

import { useInterval } from "@/hooks/use-interval"

IntervalControls

interfaceSource L7

Type contract for IntervalControls.

interface IntervalControls

Members

NameType
pause() => void
resume() => void
isActiveboolean

useInterval

functionSource L18

Open-code aq-ui React hook for Use Interval.

function useInterval(callback: () => void, delay: number | null, { autoStart = true, immediate = false }: UseIntervalOptions = {}): IntervalControls
Returns
IntervalControls

Parameters

NameTypeDefault
callback() => void—
delaynumber | null—
options?UseIntervalOptions{}

UseIntervalOptions

interfaceSource L13

Type contract for UseIntervalOptions.

interface UseIntervalOptions

Members

NameTypeDefault
autoStart?booleantrue
immediate?booleanfalse

Registry dependencies

use-latest

Files

  • hooks/use-interval.ts

Source