Add state to function components.
PARAMETER |
DESCRIPTION |
initial
|
Initial state value or a function that returns the initial state value.
TYPE:
StateT | Callable[[], StateT]
|
RETURNS |
DESCRIPTION |
tuple[StateT, Callable[[StateT], None]]
|
A tuple of the current state value and a function to update it.
|