DEV Community

ashley
ashley

Posted on

how react-dom render a portal which has already been added to the document.body

export const createNotification = () => {
  const container = document.getElementById("notificationContainer");
  console.log(container);
  return render(createPortal(<ToastNotification />, container), document.createElement("div"));
};
Enter fullscreen mode Exit fullscreen mode

how it works? who can provide me a explanation? thanks so much

Top comments (0)