Last active
August 7, 2019 06:31
-
-
Save codingnninja/8cb6c07556acecf217c47cad50c4f0df to your computer and use it in GitHub Desktop.
Bought food items.
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
boughtFoodItem(currentFoodItem) { | |
const updatedCurrentFoodItem = Object.assign({}, currentFoodItem, { status: true }); | |
const foodItems = this.state.foodItems.map((foodItem, index) => (foodItem.id === currentFoodItem.id ? updatedCurrentFoodItem : foodItem)); | |
this.setState({foodItems: foodItems}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment