import React from 'react'; import { ToastContainer, Toast } from 'react-bootstrap'; export type Notification = { id: number; time: string; text: string; }; type NotificationProps = { showNotification: boolean; notifications: Notification[]; exceptions: Notification[]; removeNotificationById: (id: number) => void; removeExceptionById: (id: number) => void; }; export const Notifications = React.memo((props: NotificationProps) => { const { showNotification, notifications, exceptions, removeExceptionById, removeNotificationById } = props; return ( {showNotification && notifications.map((notification) => ( removeNotificationById(notification.id)} onClick={() => { removeNotificationById(notification.id); }} onMouseLeave={() => { removeNotificationById(notification.id); }} show={true} autohide={true} delay={2000}> Notification {notification.time} {notification.text} ))} {exceptions.map((exception) => ( removeExceptionById(exception.id)} onClick={() => { removeExceptionById(exception.id); }} show={true} autohide={false}> Exception {exception.time} {exception.text} ))} ); });