Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Restaurant State #9

Open
1 task
SallyMcGrath opened this issue Dec 22, 2023 · 0 comments
Open
1 task

Feature Restaurant State #9

SallyMcGrath opened this issue Dec 22, 2023 · 0 comments
Labels
🏕 Priority Mandatory This work is expected 🦔 Size Tiny Less than 30 minutes 📅 Week 2 Assigned during Week 2 of this module

Comments

@SallyMcGrath
Copy link
Member

SallyMcGrath commented Dec 22, 2023

Instructions:

Working in Restaurant component

At 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 state setOrders. The initial value of the orders state should be 0. Use the new orders variable instead of the pizzas 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 with import React, {useState} from "react";.

Test:

  • The number of ordered pizzas is still 0 on the screen.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏕 Priority Mandatory This work is expected 🦔 Size Tiny Less than 30 minutes 📅 Week 2 Assigned during Week 2 of this module
Projects
Status: 📋 Backlog
Development

No branches or pull requests

1 participant