createPortal static method

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

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.

See: reactjs.org/docs/portals.html

Implementation

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