import React from 'react' ; import { connect } from 'react-redux' ; import { AppStore , CartItem } from '../types' ; function getCartPrice ( cart ) { return cart . reduce ( ( accum , current ) => { return accum + ( current . value * current . quantityBought ) ; } , 0 ) ; } const mapStateToProps = ( state ) => ( { shoppingCart : state . cartsOldModule . cart , shoppingCartTotal : getCartPrice ( state . cartsOldModule . cart ) } ) ; const CartContainerOld = ( props ) => { return ( < > < h1 > Tried and true Cart Container with Connect < /h1> < div > { props . shoppingCart . map ( ( item ) => { return ( < div key = { item . id } > { item . id } { item . quantityBought } < /div>); } ) } Total Price : $ { props . shoppingCartTotal } < /div> < hr > < /hr> < />); } ; export default connect ( mapStateToProps ) ( CartContainerOld ) ;