useDisclosure is a custom hook to help handle common open, close, or toggle scenarios. It can be used to control feedback component such as Modal, AlertDialog, Drawer, etc.


Return value#

The useDisclosure hook returns an object with the following fields:

isOpenbooleanfalseIf true set the controlled component to it's visible state.
onClosefunctionCallback function to set a falsy value for the isOpen parameter.
onOpenfunctionCallback function to set a truthy value for the isOpen parameter.
onTogglefunctionCallback function to toggle the value of the isOpen parameter.


Editable Example

Proudly made in 🇳🇬

Released under the MIT License.

Copyright © 2019 Segun Adebayo