import React, { useState } from "react"; import PropTypes from "prop-types"; import { useDispatch } from "react-redux"; import { Toast } from "react-bootstrap"; import { removeNotification } from "../../actions/notifications"; export const Notification = ({ id, icon, title, message, imageUrl, autohide, delay, }) => { const dispatch = useDispatch(); const [show, setShow] = useState(true); const hide = () => { setShow(false); setTimeout(() => dispatch(removeNotification(id)), 200); }; return ( {icon !== "" && } {title} {message !== "" && {message}} {imageUrl !== "" && ( )} ); }; Notification.propTypes = { id: PropTypes.string, icon: PropTypes.string, title: PropTypes.string, message: PropTypes.string, imageUrl: PropTypes.string, autohide: PropTypes.bool, delay: PropTypes.number, }; Notification.defaultProps = { autohide: false, delay: 5000, icon: "", imageUrl: "", title: "Info", message: "", };