createPortal static method
Returns a 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
static ReactPortal createPortal(ReactNode children, Element container) => ReactDOM.createPortal(children, container);