In all my modal components, I either return a response, or if the user closes the modal I do something like this:
<Modal
onClose={() => {
modal.resolve(false);
modal.remove();
}}
>
However, this is not ideal since I'm passing a new onClose function instance on each render. It would be great if there was a utility function on the modal instance that did both of these steps in one. 🙌