انتقل إلى المحتوى
uiify

useControllableState

حالة موحّدة للنمط المتحكّم به وغير المتحكّم به.

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";
تُرجمت هذه الصفحة آليًا ولم تُراجع بعد.