react-hot-toast
react-hot-toast copied to clipboard
Add ability to customise default toast messages
Hi @timolins 👋
I was thinking that the following API would be nice to allow users to default to a certain toast message if none is provided:
// example API
<Toaster types=[{
icon: ErrorIcon,
defaultMessage: 'An error happened'
}]
// in this way one could do the following
toast.error()
// An alternative to this would be to wrap the `toast` object and export it in your application, e.g.
import { toast as toastHander } from 'react-hot-toast'
export const toast = {
...toastHandler,
error: (message, opts) => toastHandler.error(message || 'Your default error message', opts)
}
What do you think?