Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- addFoodItem(event){
- event.preventDefault()
- if (!this.state.food) return;
- const foodItem = {
- id: this.state.foodItems.length + 1,
- food: this.state.food,
- cost: this.state.cost,
- userId: this.state.userId,
- statu: this.state.status
- };
- this.setState({
- food: '',
- cost: '',
- foodItem: foodItem,
- foodItems: [...this.state.foodItems, foodItem]
- })
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement