Hooks for super easy use of MUI's Snackbar.
npm install use-toast-mui
<ToastProvider>
<App />
</ToastProvider>
useToast
provides a function to display a Snackbar with Alert.
const ExampleButton = () => {
const toast = useToast()
return <button onClick={() => toast.success("hello!")}>
push me
</button>
}
show
accepts the severity as a parameter.
show("hello", { severity: "info" })
is equivalent to info("hello")