Portal
The <Portal/>
component renders its children into a new "subtree" outside of current component hierarchy.
You can think of it as a declarative appendChild()
, or jQuery's $().appendTo()
.
The children of <Portal/>
component will be appended to the container
specified.
The component is a light wrapper around React.createPortal
with some conveniences around
specifying and waiting for the container element.
API
import Portal from 'react-overlays/Portal'
childrenrequired
type:ReactReactElement
containerrequired
A DOM element, Ref to an element, or function that returns either. The container
will have the Portal children
appended to it.
type:DOMContainer
onRendered
type:(element: any) => void