([]);
const removeToast = (id: number) => {
setToasts(toasts => toasts.filter(toast => toast !== id));
};
const handleToastAdd = () => {
const newToastId = addedToastId++;
setToasts(toasts => [...toasts, newToastId]);
};
return (
{toasts.map(toastId => {
const handleDismiss = () => {
removeToast(toastId);
};
return (
);
})}
);
};
export const CustomDismissTimeAutoDismiss = () => {
const [toasts, setToasts] = React.useState([]);
const removeToast = (id: number) => {
setToasts(toasts => toasts.filter(toast => toast !== id));
};
const handleToastAdd = () => {
const newToastId = addedToastId++;
setToasts(toasts => [...toasts, newToastId]);
};
return (
{toasts.map(toastId => {
const handleDismiss = () => {
removeToast(toastId);
};
return (
);
})}
);
};
export const WithDismissCallback = () => (
{[
]}
);
export const With1Action = () => (
{[
primaryAction
}
id="oneAction"
/>
]}
);
export const With2Actions = () => (
{[
primaryAction
}
secondaryAction={
}
id="twoActions"
/>
]}
);