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. 😎
I am passionate about development, cryptography, and security, and how they can be applied to solve real-world problems. I aim to learn from the best and become a proficient and innovative engineer.
You should consider portals (reactjs.org/docs/portals.html) for modal as it scopes it out of usual DOM structure including its events.
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. 🙌
can you tell me if the above solution works which I also did in my practice setup, why would we go for portals instead?