import React, { useState } from "react"; import PropTypes from "prop-types"; import { useDispatch, useSelector } from "react-redux"; import { Toast } from "react-bootstrap"; import { removeNotification } from "../../actions/notifications"; export const Notification = ({ id }) => { const dispatch = useDispatch(); const notification = useSelector((state) => state.notifications.get(id)); const [show, setShow] = useState(true); const hide = () => { setShow(false); dispatch(removeNotification(id)); }; return ( {notification.icon && ( )} {notification.title} {notification.message !== "" && {notification.message}} {notification.imageUrl !== "" && ( )} ); }; Notification.propTypes = { id: PropTypes.string.isRequired, };