import { connect } from 'react-redux';
import { callForHelp } from './heroActions';
//The component receives `heroes` and `callHero` from `connect`
const HeroList = ({ heroes, callHero }) => ...
const mapStateToProps = (state) => {
return {
heroes: state.heroes
}
}
const mapDispatchToProps = dispatch => {
callHero: hero => dispatch(callForHelp(hero))
}
export default connect(
mapStateToProps,
mapDispatchToProps
)(HeroList)