Version: v4.9.0
use-toggle
#
AboutToggle (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) |
#
Join Bhargav's discord serverYou can click on the floating discord icon at the bottom right of the screen and talk to us in our server.