Skip to content

An opinionated toast component for React.

Check if icon exists

emilkowalski2282469def65
diff --git a/src/index.tsx b/src/index.tsx
index 6ef206c..d0ba5b4 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -342,7 +342,7 @@ const Toast = (props: ToastProps) => {
<div data-icon="">
{toast.promise || toastType === 'loading'
? toast.icon || icons.loading || getLoadingIcon()
- : toast.icon || icons[toastType] || getAsset(toastType)}
+ : toast.icon || icons?.[toastType] || getAsset(toastType)}
</div>
) : null}