Skip to content

Commit d81e223

Browse files
authored
Merge pull request #37 from areebsattar/FeatureRestaurantState
NW6 | OrlandoMorales | FeatureRestaurantState-ReactModule | Week2
2 parents 62a1aa4 + 4fa785a commit d81e223

2 files changed

Lines changed: 17 additions & 4 deletions

File tree

src/components/App/App.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
margin-top: 30%;
1818
}
1919

20+
.restaurant {
21+
margin-bottom: 20px;
22+
}
23+
2024
.footer {
2125
background-color: var(--color--paper);
2226
padding: var(--space--m);
Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,25 @@
1-
const Restaurant = () => {
2-
const pizzas = 0;
1+
import { useState } from "react";
2+
3+
function Restaurant() {
4+
const [pizzas, setPizzas] = useState(0);
5+
6+
function buttonAdd() {
7+
setPizzas(pizzas + 1);
8+
}
9+
310
return (
411
<section className="restaurant">
512
<h3 className="restaurant__heading">Restaurant Orders</h3>
613
<ul className="restaurant__list">
714
<li className="restaurant__item">
815
Pizzas: {pizzas}{" "}
9-
<button className="button restaurant__button">Add</button>
16+
<button className="button restaurant__button" onClick={buttonAdd}>
17+
Add
18+
</button>
1019
</li>
1120
</ul>
1221
</section>
1322
);
14-
};
23+
}
1524

1625
export default Restaurant;

0 commit comments

Comments
 (0)