react-simple-hook-modal icon indicating copy to clipboard operation
react-simple-hook-modal copied to clipboard

Would this be possible?

Open gino opened this issue 4 years ago • 1 comments

Hi there,

I was looking for a similar approach to use modals with a hook like this, but I was wondering if something like this would be possible, cause this would be a very nice approach:

const { isModalOpen, openModal, closeModal } = useModal(<div>This is my modal</div>);

So you are able to pass elements into the useModal hook so you do not have to put any <Modal> logic into the DOM itself, and without passing props either. This is a similar library that allows you to do that, but unfortunately not really active and has some issues. But I think that would be a very nice approach, not sure if it's possible without having to change a lot of things though.

I just think that it would be a nice idea, I would really prefer this method myself to keep my modals out of the structure itself.

gino avatar May 23 '21 11:05 gino

@gino Thanks for the suggestion! Definitely open to this idea. Feel free to PR a change, otherwise I will try to get round to implementing this in the near future.

mbrookson avatar Jul 04 '21 15:07 mbrookson