Ir al contenido

useControllableState

Estado controlado y no controlado con una interfaz unificada.

Signature

useControllableState<T>(params): [T, setter]

Parameters

NameTypeDescription
valueT | undefinedControlled value; when set, internal state is bypassed.
defaultValueT | undefinedInitial value for the uncontrolled case.
onChange(value: T) => voidCalled on every change (controlled or not).

Returns

[value, setValue] — setValue accepts a value or functional updater.

SSR notes

Safe in Client Components. Uncontrolled defaultValue is fixed after first render.

Import

import { useControllableState } from "@gunkin/uiify/hooks";
Esta página se tradujo automáticamente y aún no se ha revisado.