import * as React from 'react'; import { DefaultToast, ToastProps, ToastProvider, useToasts, ToastConsumer } from 'react-toast-notifications'; const CustomToast: React.FC = ({ children, ...props }) => (
{children}
); // ToastProvider Props const MyApp: React.FC = () => ( ); // ToastConsumer const ToastConsumerTest: React.FC = () => ( {context => (
)}
); // Hooks const AddToast: React.FC = () => { const { addToast } = useToasts(); return (
); }; const RemoveAllToasts: React.FC = () => { const { removeAllToasts } = useToasts(); return (
); }; const RemoveToast: React.FC = () => { const { removeToast } = useToasts(); return (
); }; const ToastStack: React.FC = () => { const { removeAllToasts, toastStack } = useToasts(); const onSubmit = () => { if (toastStack.length > 0) { removeAllToasts(); } }; return
Save Form
; }; const UpdateToast: React.FC = () => { const { updateToast } = useToasts(); return (
); };