createPortal function
Returns a portal that renders children
into a container
.
Portals provide a first-class way to render children into a DOM node that exists outside the DOM hierarchy of the parent component.
children
can be any renderable React child, such as a ReactElement, String, or fragment.
Implementation
ReactPortal createPortal(ReactNode children, Element container) => ReactDom.createPortal(children, container);