Skip to content

onRequestClose Callback

This example shows how you can use the onRequestClose prop with a function to perform actions when closing.

This is especially important for handling closing the modal via the escape key.

Also more important if shouldCloseOnOverlayClick is set to true, when clicked on overlay it calls onRequestClose.

onRequestClose example