npm install react-app-notifier
root.render(
<React.StrictMode>
<NotificationProvider>
<App/>
</NotificationProvider>
</React.StrictMode>
);
const ExampleComponent: FC = () => {
const dispatchNotification = useNotification();
const showNotification = () => {
dispatchNotification({message: 'An example text', timeout: 10, type: 'error'});
}
return (
<button onClick={showNotification}>click me</button>
);
}
- Icons by Font Awesome