Renders components elsewhere in the DOM.
To implement Portal component into your project you’ll need to add the import:
import Portal from "@kiwicom/orbit-components/lib/Portal";
After adding import into your project you can use it simply like:
<Portal>// probably Modal<Modal /></Portal>
Table below contains all types of the props available in the Portal component.
|children||The content of the Portal to render. See Functional specs|
|renderInto||The string name of element to be used for the render.|
<Portal />component with property
renderInto="modal"will render its children into a DOM node that exists outside the DOM hierarchy of the parent component. It means that you have to create
divelement with id
modal(or whatever you want) in root
htmlfile. For more info, see React Portal docs.