React Portals provide a way to render content outside the current DOM hierarchy, allowing components to be rendered in a different part of the app's DOM.
Portals are created using ReactDOM.createPortal(child, container), which specifies the React element to render and the DOM node where it should be inserted.
When to use Portals: Recommended for components like modals, tooltips, popovers, dropdowns, and overlays to escape parent styles, manage focus correctly, and maintain React context.
Portals are useful when building custom modals, working on design systems, or dealing with layout/z-index issues, with many existing UI libraries utilizing Portals underneath.