use-toggle
Toggle custom hook and component wrapper for React
Installing
Example usage
Toggle hook - useToggle()
Use it as your usual hooks. disable
, enable
, or toggle
does not accept parameters so you can use it on onClick
handlers.
Toggle wrapper - <ToggleWrap />
Component which wraps the children with its internal hooks. Use this if you do not want to declare another component and just wrap it.
API
Toggle hook
TODO
Toggle wrapper
TODO
Suggestions and/or questions
Head over to our dedicated Discord channel for use-toggle
.
Maintainers
- Griko Nibras (@grikomsn)
License
MIT License, Copyright (c) 2021 Koding Ninja