Basic Usage
Advanced Usage
When you need to dynamically load a Modal, you can use the useModal
hook to manage the Modal's state.
This example demonstrates prefetching data before displaying the Modal. After the data is fetched (and cached), the Modal is displayed. Once the Modal is closed, the data is still available for future use.
API
Arguments
The useModal
hook does not take any arguments.
Return Value
The useModal
hook returns an object with the following properties:
Name | Default | Description |
---|---|---|
modalRef | The ref that attaches to the Modal component. | |
show | Triggers the Modal to open. | |
close | Closes the Modal. | |
isOpen | false | Helper value to know the state of the dialog. |