Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // FAVORITES
- if (favStorage.length > 0) {
- this.setState({favorites: favStorage})
- if (favStorage.filter(rep => rep.label === this.state.recipe.label).length > 0) {
- this.setState({isFavorite: true})
- } else {
- this.setState({isFavorite: false})
- }
- } else if (favStorage.length === 0) {
- this.setState({isFavorite: false})
- }
- //SHOPPING CART
- if (cartStorage.length > 0) {
- this.setState({cart: cartStorage})
- if (cartStorage.filter(rep => rep.label === this.state.recipe.label).length > 0) {
- this.setState({isInCart: true})
- } else {
- this.setState({isInCart: false})
- }
- } else if (cartStorage.length === 0) {
- this.setState({isInCart: false})
- }
Add Comment
Please, Sign In to add comment