DcruzQ

Untitled

Jul 15th, 2019
757
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React, { Component, Fragment } from "react";
  2. import { withAlert } from "react-alert";
  3. import { connect } from "react-redux";
  4. import PropTypes from "prop-types";
  5.  
  6. export class Alerts extends Component {
  7.   static propTypes = {
  8.     error: PropTypes.object.isRequired,
  9.     message: PropTypes.object.isRequired
  10.   };
  11.  
  12. componentDidMount() {
  13.     this.props.alert.show("It Works!");
  14.   }
  15.   render() {
  16.     return <Fragment />;
  17.   }
  18. }
  19.  
  20. const mapStateToProps = state => ({
  21.   error: state.errors,
  22.   message: state.messages
  23. });
  24.  
  25. export default connect(mapStateToProps)(withAlert(Alerts));
Advertisement
Add Comment
Please, Sign In to add comment