Slide 11
Slide 11 text
const = =>
const =
const = =>
const = +
const =
*
...
return
=>
=
=
() {
[ , ] ([
{ name: , price: },
{ name: , price: },
{ name: , price: },
]);
() {
products. ;
{
name: newProductNumber ,
price: newProductNumber ,
};
([ products, newProduct]);
};
(
< >
< >
{products. (( , ) (
< {index}>
{product.name} - ${product.price. ( )}
))}
< {addProduct}>Add Product
);
};
ProductList
useState
addProduct
setProducts
map
key
toFixed
onClick
products setProducts
10.0
20.0
30.0
newProductNumber length 1
newProduct
10.0
2
"Product 1"
"Product 2"
"Product 3"
`Product ${ }`
div
ul
li
li
ul
button button
div
product index