Overview
Unifies controlled and uncontrolled state handling behind a single API. Ifvalue is provided, the hook works in controlled mode and delegates updates to onChange. Otherwise, it stores state internally using defaultValue (or finalValue as fallback).
Import
Signature
Parameters
State control options
Controlled value. When defined, internal state is ignored
Initial value used for uncontrolled mode
Fallback value when
defaultValue is not providedCallback fired whenever the setter is called
Return Value
A tuple containing the current value, setter function, and controlled state flag
Current value (controlled or uncontrolled)
Setter function that updates state and calls onChange
True if the component is controlled, false if uncontrolled