ControllableStateUpdater
typeSource L7Type contract for ControllableStateUpdater.
type ControllableStateUpdater<T> = T | ((previous: T) => T)Open-code aq-ui React hook for Use Controllable State.
pnpm dlx aq-ui@alpha add use-controllable-stateImport the parts you need, then jump to an export for its contract.
"use client"
import { useControllableState } from "@/hooks/use-controllable-state"Type contract for ControllableStateUpdater.
type ControllableStateUpdater<T> = T | ((previous: T) => T)Open-code aq-ui React hook for Use Controllable State.
function useControllableState<T>({ value, defaultValue, onChange, }: UseControllableStateOptions<T>): [ T, (next: ControllableStateUpdater<T>) => void, ][ T, (next: ControllableStateUpdater<T>) => void, ]| Name | Type |
|---|---|
options | UseControllableStateOptions<T> |
Type contract for UseControllableStateOptions.
interface UseControllableStateOptions<T>| Name | Type |
|---|---|
value? | T |
defaultValue | T | (() => T) |
onChange? | (value: T) => void |
use-latest