DEV Community

Sagar Gnawali
Sagar Gnawali

Posted on

Day 2 -> 40 days of code

Portals provide a first-class way to render children into a DOM node that exists outside the DOM
Hierarchy of the parent component.
A React portals provides a way to render an element outside of its component hierarchy ie in a separate component.

Syntax: ReactDOM.createPortal(child,container)

Usage:
->floating menus
->widgets

Top comments (0)