eBay / nice-modal-react

A modal state manager for React.
https://ebay.github.io/nice-modal-react
MIT License
1.96k stars 109 forks source link

remove() Function without Modal ID just like hide() #128

Closed Kanary159357 closed 9 months ago

Kanary159357 commented 9 months ago

https://github.com/eBay/nice-modal-react/issues/58

Cause this issue, I don't want to use useModal outside modal. So want to use NiceModal with NiceModal.show(), hide(), remove() outside modal(Not using useModal). show, and hide function has no problem. But remove function doesn't accept modal and only accept modal Id. I know I could declaratively set modalId with ModalDef or register, but It defeat the pros of NiceModal.

So I wonder is it possible to use remove() with just modal component something like this.

NiceModal.remove(SomeModal)
supnate commented 9 months ago

I'm not sure why it was not supported, seems a simple improvement: 7fa8bad .

Kanary159357 commented 9 months ago

Thanks!