Q23: What are React Portals and when are they used?
Portals (ReactDOM.createPortal) provide a way to render children elements into a DOM node that exists outside the DOM hierarchy of the parent component, useful for modals, tooltips, and overlays.
Key Takeaways
Renders React elements into external DOM containers.
Preserves React event bubbling through the virtual React tree regardless of DOM parentage.
Knowledge Check
Which method creates a React Portal?