Video Tutorial Portals


The portals will allow you to mount a component on a specific element of the DOM while keeping it in your react element. This allows for example to create a modal box which will be at the root of the body without having to change the structure of your components.

import React from "react";
import {createPortal} from 'react-dom'

function Modal ({onClose}) {
  return createPortal (
    <>
      
Modal title

Modal body text goes here.

, document.body ); }