import { connect } from 'react-redux' ; import { fetchItemAction } from '../actions/fetchItemAction' ; import { AppState } from '../index' ; import ItemBuyPage from '../pages/ItemBuyPage' ; const mapStateToProps = ( state ) => ( { loading : ! state . viewingItem . item , item : state . viewingItem . item , errorType : state . error . errorType , } ) ; const mapDispatchToProps = ( dispatch ) => ( { load : ( itemId ) => { dispatch ( fetchItemAction ( itemId ) ) ; } , } ) ; export default connect ( mapStateToProps , mapDispatchToProps ) ( ItemBuyPage ) ;