Advanced React
Advanced React
Code: Output:
const data = [
{ Examine the console output
id: "1",
title: "Tiramisu", Changes:
description: "The best tiramisu in town",
image: "https://picsum.photos/200/300/? const topDesserts = data.map(dessert => {
random", return {
price: "$5.00", content: `${dessert.title} - ${dessert.description},
}, price: dessert.price,
{ }
id: "2", })
title: "Lemon Ice Cream",
description: "Mind blowing taste", export default function App() {
image:
"https://picsum.photos/200/300/7random", console.log(topDesserts)
price: "$4.50", return <h1>Examine the console output</h1>;
}, }
{
id: "3",
title: "Chocolate mousse",
description: "Unexplored flavour",
image: "https://picsum.photos/200/300/?
random",
price: "$6.00",
},
export default function App() {
return <h1>Examine the console output</h1>;
}
Example: I will use the list of little lemons best desserts again, each one having the following properties,
ID, title, image, description, and price.
The aim is to display a simpler version of this collection of top desserts by displaying just the title and the
price.