DEV Community

Discussion on: How to Create a Modal in React

bikasv profile image
Bikas Vaibhav

You should consider portals ( for modal as it scopes it out of usual DOM structure including its events.

franciscomendes10866 profile image
Francisco Mendes Author • Edited on

I considered using it, but since I don't have other elements that use z-index like notifications and toasts, I decided to take a simpler approach. But if I had one of the ones mentioned before, I wouldn't hesitate to use Portals. šŸ˜Ž

Thanks for the comment, it is quite relevant. šŸ™Œ