Make the Toast provider manage state so that submitting the form adds a new toast and clicking the close button dismisses that specific toast.
Asked in frontend interviews at Adobe, Okta and Razorpay