Engrain by ByteRush

RCT.08.04 Mid-level

Portals, focus and layering

Comes up in: React, Machine coding

This concept is being written. It gets the full five steps — explanation, predict, interview angle, practice with tests, and review cards. Here is exactly what it will cover, so you can study it elsewhere in the meantime.

What it covers

  • createPortal for modals/toasts
  • events bubble through the React tree not the DOM tree
  • focus trap and return focus
  • native <dialog>/popover vs portals

Words you will know

portalfocus trap

What you will practise

  • toast system with portal

Interview questions this answers

  • How do events behave in a portal?