??????? ?? ???????
??????? ?? ???????
Portals In
React
@oluwakemi Oluwadahunsi
Introduction
React Portals are a powerful feature that allows
you to render components outside the normal
DOM hierarchy.
@oluwakemi Oluwadahunsi
They allow you to render a child component into a
DOM node that exists outside the DOM hierarchy
of the parent component.
@oluwakemi Oluwadahunsi
Finally, you can use the Modal component in
your App.jsx like so:
@oluwakemi Oluwadahunsi
In this example:
@oluwakemi Oluwadahunsi
Important Notes About
React Portals
1. Event Bubbling:
Even though the JSX is rendered outside of its
parent in the DOM tree, event bubbling in React
works as if the component was still in the same
place.
@oluwakemi Oluwadahunsi
Benefits of Using React Portals
@oluwakemi Oluwadahunsi
I hope you found this material
useful and helpful.
Remember to:
Like
&
Share with your network, be
helpful to someone 👌
@oluwakemi Oluwadahunsi
Hi There!
Thank you for reading through
Did you enjoy this knowledge?
kodemaven-portfolio.vercel.app