We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d88461e commit 2954242Copy full SHA for 2954242
1 file changed
src/components/Restaurant/Restaurant.jsx
@@ -1,18 +1,25 @@
1
-const Restaurant = () => {
2
- const pizzas = 0;
+import { useState } from "react";
+
3
+function Restaurant() {
4
+ const [pizzas, setPizzas] = useState(0);
5
6
+ function buttonAdd() {
7
+ setPizzas(pizzas + 1);
8
+ }
9
10
return (
11
<section className="restaurant">
12
<h3 className="restaurant__heading">Restaurant Orders</h3>
13
<ul className="restaurant__list">
14
<li className="restaurant__item">
15
Pizzas: {pizzas}{" "}
- <button className="button restaurant__button" onClick={Restaurant}>
16
+ <button className="button restaurant__button" onClick={buttonAdd}>
17
Add
18
</button>
19
</li>
20
</ul>
21
</section>
22
);
-};
23
+}
24
25
export default Restaurant;
0 commit comments