What are portals and when do you use them?

React 19 and architecture · Freshers and experienced

Model answer

createPortal renders children into a different DOM node, such as document.body, while keeping them in the same React tree for events and context. It is used for modals, tooltips and dropdowns that must escape overflow or z-index limits of a parent.

Learn this topic

React 19 New Features: Actions, useActionState, useOptimistic, use and More in the course React.js Full Course: Beginner to Advanced.

Sign in to add your own answer.

More questions