Feature Restaurant State #9
Labels
🏕 Priority Mandatory
This work is expected
🦔 Size Tiny
Less than 30 minutes
📅 Week 2
Assigned during Week 2 of this module
Instructions:
Working in
Restaurant
componentAt the moment, the number of pizzas a guest can order is static and set to 0, even if they click on the 'Add' button. We will change that in the following to let a guest add more pizzas to their order. First, declare a new state variable
orders
along with the function to set the orders statesetOrders
. The initial value of theorders
state should be 0. Use the neworders
variable instead of thepizzas
variable (that you can now delete).Hint: You need to use the React function
useState
to create a state variable. Remember to import the function at the top withimport React, {useState} from "react";
.Test:
The text was updated successfully, but these errors were encountered: