React Portals Quiz

Test your knowledge of React portals, createPortal, modal rendering, event bubbling, context behavior, and portal accessibility concerns.

20 questions · free · answers explained

Start the quiz

All questions in this quiz

  1. What does createPortal let you do in React?
  2. Which package exports createPortal?
  3. What are portals commonly used for?
  4. What arguments does createPortal primarily need?
  5. Does a portal change where the component lives in the React tree?
  6. How do React events from a portal bubble?
  7. Can portal content access React context from its parent tree?
  8. What must be true about the DOM node passed to createPortal?
  9. What happens if a different portal target DOM node is passed during an update?
  10. Why are portals useful for modals inside containers with overflow hidden?
  11. What should modal portals handle for accessibility?
  12. What should happen to portal content when the component that renders it unmounts?
  13. Why might a click handler on a React parent fire when clicking inside a portal?
  14. How can you stop a portal click from triggering a parent React click handler?
  15. What is the optional third argument to createPortal used for?
  16. Should createPortal be used to create the root of an entire React app?
  17. What is a common portal target for application overlays?
  18. What does a portal change about CSS stacking and DOM placement?
  19. Can a portal render a string or fragment as children?
  20. What should you consider before using a portal?

Prefer to read first? React interview questions with written answers.