React Portal — Render Components Outside the Root DOM Hierarchy to Fix z-index and Overflow Clipping Issues
Learn how and why to use ReactDOM.createPortal() to render a component's output into a different DOM node than its parent. Classic use cases: modals, tooltips, dropdowns, and toast notifications that need to escape parent overflow:hidden or z-index stacking contexts. Implement a Portal wrapper component that uses createPortal to append children to document.body (or any target DOM node). Show the problem it solves — a modal trapped inside an overflow:hidden container — and then the fix using a portal. Cover event bubbling behavior through portals (events still bubble through the React tree not the DOM tree).