Content
useToggle
A hook that provides a boolean state and a function to toggle it.
useToggle
Usage
API
useToggle
Returns a stateful value and two functions to update it.
Parameters
Name | Type | Description |
---|---|---|
defaultValue | boolean | The initial value of the state. Default is false . |
Returns
Name | Type | Description |
---|---|---|
isOn | boolean | The current value of the state. |
toggle | () => void | A function to toggle the state. |
setToggle | Dispatch | A function to set the state to a new value. |