nice-modal-react icon indicating copy to clipboard operation
nice-modal-react copied to clipboard

Add ability to resolve/reject and hide

Open adrhumphreys opened this issue 2 years ago • 3 comments

Hey team,

Loving the library and I found that I often would call resolve and hide or reject and hide, and noticed that there was a similar pattern mentioned in #88

This would mean that users are able to do something like:

const {resolveAndHide} = useModal()

return (
  <Modal onClose={() => resolveAndHide(false)}>
   <p>Content</p>
  </Modal>
)

Happy to update with any feedback

Reason for creating new methods was to keep backwards compatibility

adrhumphreys avatar Jan 17 '23 22:01 adrhumphreys