Version: v3.6.0
#
@rooks/use-toggle#
Toggle (between booleans or custom data)hook for React.
#
Installation#
Importing the hook#
Usage#
ArgumentsArguments | Type | Description | Default value |
---|---|---|---|
initialValue | boolean | Initial value of the state | false |
toggleFunction | function | Function which determines how to toggle a value | v => !v |
#
Returned array itemsReturned Array items | Type | Description |
---|---|---|
value | Any | Current value |
toggleValue | function | Toggle function which changes the value to the other value in the list of 2 acceptable values. (Mostly true or false) |