@implements IDisposable; @inject IToastService toastService @if (toastService.HasToasts()) {
@foreach( var toast in toastService.GetToasts()) { }
} @code { protected override void OnInitialized() { toastService.Subscribe(OnUpdate); } public void Dispose() { toastService.Unsubscribe(OnUpdate); } void OnUpdate() { StateHasChanged(); } }