File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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 );
Original file line number Diff line number Diff line change 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
1625export default Restaurant ;
You can’t perform that action at this time.
0 commit comments