createPortal function

ReactPortal createPortal(
  1. ReactNode? children,
  2. Element container
)

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.

See: reactjs.org/docs/portals.html

Implementation

ReactPortal createPortal(ReactNode children, Element container) => ReactDom.createPortal(children, container);