react-simple-hook-modal
react-simple-hook-modal copied to clipboard
Would this be possible?
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 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.