import React, { Component } from 'react'; import PropTypes from 'prop-types'; class Toast extends Component { componentDidMount() { setTimeout(() => { this.props.removeToast(this.props.id); }, 30000); } shouldComponentUpdate() { return false; } render() { return (

{this.props.message}

); } } Toast.propTypes = { id: PropTypes.string.isRequired, message: PropTypes.string.isRequired, type: PropTypes.string.isRequired, removeToast: PropTypes.func.isRequired, }; export default Toast;