idev0085 / react-boilerplate

0 stars 0 forks source link

What are portals in React? #57

Open idev0085 opened 3 years ago

idev0085 commented 3 years ago

Portals provide a first-class way to render children into a DOM node that exists outside the DOM hierarchy of the parent component.

ReactDOM.createPortal(child, container) The first argument (child) is any renderable React child, such as an element, string, or fragment. The second argument (container) is a DOM element.