0PricingLogin
React Academy · Lesson

What Are React Portals?

Understand the createPortal API and why rendering outside the root div is useful.

Welcome

In this lesson you will learn what React Portals are, why rendering outside the parent DOM tree is useful, and how to use the createPortal API.

The Normal React DOM Hierarchy

By default, every component renders inside its parent's DOM node. The entire React app usually lives inside one `
`. This works fine until you need a modal, tooltip, or dropdown to escape a parent with `overflow: hidden`.

All lessons in this course

  1. What Are React Portals?
  2. Building a Modal Component with Portals
  3. Handling Focus & Keyboard Traps in Modals
  4. Tooltips & Dropdown Menus with Portals
← Back to React Academy