Open rosensteinsamuel1 opened 4 years ago
Hey, this is neat. Any reason to use refs in this situation? I had initially thought users could just pass in their own open/close function but that would be outside the modal. what do you think?
Good idea, I'm going to try a different approach and I'll keep you updated.
After thinking about this for a bit I think the best thing is to have defined open/close functionality. If the user wants to run custom functions then we can have props for functions that will execute when the modal is opened/closed. Also, the ref is in order to allow for the modal to close when the background is clicked. If this isn't necessary, I can remove the ref and just have the close functionality via an 'x' button in the corner of the modal.
Here is the new version. There aren't any refs. In order to open, set isOpen=true
and then the modal closes when the 'close' button is clicked inside of the modal.
@NehemiahK Where are we with this?
I added the Modal component along with the corresponding demo and docs.