Engrain by ByteRush

MC.07.01 Mid-levelCore — asked often

Modal and toast system as a reusable API

Comes up in: Machine coding, Low-level design

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

  • imperative API (toast.success()), provider + portal
  • stacking multiple modals
  • scroll lock
  • focus restoration
  • queue limits and priorities
  • animations with reduced motion

Words you will know

imperative APIportal

What you will practise

  • build useToast() and useModal() APIs (timed 75 min)

Interview questions this answers

  • Design an API for a toast system used across a large app.
  • How do you handle multiple stacked modals?