import React from 'react'; import { Alert } from 'react-bootstrap'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; import * as Actions from '../actions'; class Alerts extends React.Component { removeAlert(alert) { this.props.actions.removeAlert(alert); } render() { const alerts = this.props.alerts.map((alert) => {alert.msg} ); return (
{alerts}
); } } Alerts.propTypes = { alerts: React.PropTypes.array, actions: React.PropTypes.object, }; function mapDispatchToProps(dispatch) { return { actions: bindActionCreators(Actions, dispatch), }; } export default connect(null, mapDispatchToProps)(Alerts);