Skip to content

Public API / 37 Hooks

Hook index

Search by behavior, category, or TypeScript signature. Every entry links to its runtime contract and source.

Hook results

37 API entries found.

useToggle

Boolean state with a stable action for toggling or setting an explicit value.

useToggle(initialValue?: boolean): readonly [boolean, (next?: ToggleUpdater) => void]

useControllableState

A controlled/uncontrolled state primitive with one stable setter contract.

useControllableState<T>(options?: UseControllableStateOptions<T>): readonly [T | undefined, SetValue<T>]

useMemoizedFn

Keeps a stable callback identity while invoking the latest committed implementation.

useMemoizedFn<T extends (...args: never[]) => unknown>(fn: T): T

useCounter

Manages a bounded number with stable increment, decrement, set, and reset actions.

useCounter(initialValue?: number, options?: UseCounterOptions): UseCounterResult

useMap

Manages a readonly Map snapshot with stable immutable actions.

useMap<K, V>(initialValue?: MapInitializer<K, V>): UseMapResult<K, V>

useSet

Manages a readonly Set snapshot with stable membership actions.

useSet<T>(initialValue?: SetInitializer<T>): UseSetResult<T>

useDebounceFn

Debounces function calls with cancel, flush, and pending controls.

useDebounceFn<Args, Result>(fn: (...args: Args) => Result, options: DebounceFnOptions): DebouncedFunction<Args, Result>

useThrottleFn

Throttles function calls while preserving the latest committed callback.

useThrottleFn<Args, Result>(fn: (...args: Args) => Result, options: ThrottleFnOptions): ThrottledFunction<Args, Result>

useTimeout

Runs the latest callback once after a delay, with cancellation state.

useTimeout(callback: () => void, delay: number | null, options?: UseTimeoutOptions): { cancel: () => void; pending: boolean }

useInterval

Runs the latest callback on a declarative interval.

useInterval(callback: () => void, delay: number | null, options?: UseIntervalOptions): void

useAsync

Runs abortable asynchronous work with stale-result protection.

useAsync<T>(task: AsyncTask<T>, options?: UseAsyncOptions): UseAsyncResult<T>

useLockFn

Prevents overlapping calls to an async or synchronous action.

useLockFn<Args extends readonly unknown[], Result>(fn: (...args: Args) => Result | PromiseLike<Result>, options?: UseLockFnOptions): LockFn<Args, Awaited<Result>>

useWebSocket

Manages a browser WebSocket with raw messages, stable actions, and bounded reconnects.

useWebSocket(url: string | URL | null, options?: UseWebSocketOptions): UseWebSocketResult

useEventListener

Subscribes to an EventTarget with typed window events and automatic cleanup.

useEventListener(target?, type, listener, options?: UseEventListenerOptions | boolean): void

useClickOutside

Calls a handler for pointer presses outside a referenced element.

useClickOutside<T extends HTMLElement>(ref: RefTarget<T>, onOutside: (event: PointerEvent) => void, enabledOrOptions?: boolean | UseClickOutsideOptions): void

useKeyPress

Matches key alternatives, predicates, and string chords such as ctrl+s.

useKeyPress(keyFilter: KeyFilter, handler: KeyPressHandler, options?: UseKeyPressOptions): void

useHover

Tracks mouseenter and mouseleave state for a target and follows ref changes.

useHover(target?: HoverTarget, options?: UseHoverOptions): boolean

useLocalStorage

Synchronizes typed state with localStorage and reports serialization errors.

useLocalStorage<T>(key: string, initialValue: T | (() => T), options?: StorageOptions<T>): UseStorageResult<T>

useSessionStorage

Synchronizes typed state with sessionStorage for the current tab session.

useSessionStorage<T>(key: string, initialValue: T | (() => T), options?: StorageOptions<T>): UseStorageResult<T>

useIntersectionObserver

Tracks intersection state for an element or ref with a deterministic SSR snapshot.

useIntersectionObserver(options?: UseIntersectionObserverOptions): IntersectionObserverState; useIntersectionObserver(target: IntersectionObserverTarget, options?: Omit<UseIntersectionObserverOptions, 'target' | 'ref'>): IntersectionObserverState

useResizeObserver

Tracks an element size through ResizeObserver with stable dimensions and cleanup.

useResizeObserver(options?: UseResizeObserverOptions): ResizeObserverState; useResizeObserver(target: ResizeObserverTarget, options?: Omit<UseResizeObserverOptions, 'target' | 'ref'>): ResizeObserverState