Notifications
Call it to create a notification from anywhere, even outside React. Make sure you add the <Notification/> component to your app first.
Available Notification options#
You can provide NotificationOptions as the second argument. They will overwrite all options received from <Notifiction/>.
Creating a notification#
Blank#
Success#
Error#
Loading#
Promise#
This shorthand is useful for mapping a promise to a notify. It will update automatically when the promise resolves or fails.
Advanced#
Confirm#
A custom notification used in user confirmation dialogs. Can be helpful for asynchronous operations.
Dismiss notification programmatically#
Dismiss all notifications at one#
Update an existing notification#
Render JSX custom content#
You can provide a React component instead of text.
Advanced#
You can also supply a function that receives the notification as an argument, giving you access to all properties. This allows you to access the notification id, which can be used to add a dismiss button.
Reference#
Under the hood, we are using react-hot-toast for our notifications UI.