@knitui/hooks
useInterval
Declarative setInterval with start/stop/toggle and an active flag — port of Mantine's useInterval. The callback is read through a ref so changing it never tears down a running interval; the interval is cleared on unmount. Uses the global setInterval (no window), so it runs on web and native alike.
WebiOSAndroid
Import
import { useInterval } from "@knitui/hooks";Signature
export function useInterval( fn: () => void, interval: number, options: UseIntervalOptions = {}, ): UseIntervalReturnExported types: UseIntervalOptions, UseIntervalReturn