useToggle
The useToggle
hook allows you to manage the Toggle state with less code.
Usage
API
Arguments
The useToggle
hook accepts the following optional arguments:
Name | Default | Description |
---|---|---|
checked | The initial checked state of the toggle. | |
onChange | The custom handler the hook will call for the onChange event. |
Return
The useToggle
hook returns a memoized object with the same properties as the options object passed in.