Last active
November 8, 2018 21:05
-
-
Save jsrath/eaeaf01f29b39e857360e2e89ff2d6e0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
getCartQuantity = () => { | |
this.getTotalPrice(); | |
const updatedCart = [...this.state.cart]; | |
let quant = []; | |
updatedCart.forEach(element => { | |
quant.push(element.quantity); | |
}); | |
quant = quant.reduce((accumulator, currentValue) => accumulator + currentValue, 0); | |
this.setState({ totalQuantity: quant }); | |
}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment