Frontendx
README.md
SOLUTION.md
main.tsxentry
App.tsx
App.css
index.html
vite.config.ts
Installed
react@^19.2.0
react-dom@^19.2.0

Create Stacked Snack Bar (Toast) in React — Notification System That Stacks Multiple Toasts with Auto-Dismiss

Prompt

Build a fully functional Toast/Snackbar notification system in React. Part 1: Create a single toast that can be triggered programmatically, manually dismissed via an X button, and auto-dismissed after a configurable timeout. Part 2: Make it stackable — multiple toasts appear stacked vertically, each new toast appends below the previous one, and a maximum stack size (e.g., 3) is enforced so the oldest is removed when the limit is exceeded. Each toast is identified by a unique ID. Use a toast queue in state. This was a two-part question from Razorpay's SDE2 frontend interview.

Create a toast queue in state as an array of {id, message, type} objects.
Test Results

Create Stacked Snack Bar (Toast) in React — Notification System That Stacks Multiple Toasts with Auto-Dismiss

Build a fully functional Toast/Snackbar notification system in React. Part 1: Create a single toast that can be triggered programmatically, manually dismissed via an X button, and auto-dismissed after a configurable timeout. Part 2: Make it stackable — multiple toasts appear stacked vertically, each new toast appends below the previous one, and a maximum stack size (e.g., 3) is enforced so the oldest is removed when the limit is exceeded. Each toast is identified by a unique ID. Use a toast queue in state. This was a two-part question from Razorpay's SDE2 frontend interview.