diff --git a/08_rendering-list-of-elements/final-code/script.js b/08_rendering-list-of-elements/final-code/script.js index 4f7f551..26a2d7c 100644 --- a/08_rendering-list-of-elements/final-code/script.js +++ b/08_rendering-list-of-elements/final-code/script.js @@ -20,21 +20,20 @@ function Card(key, title, image, brand, price) { const root = createRoot(document.getElementById('root')) console.log('Hello world!!!') - fetch('https://dummyjson.com/products') .then((res) => res.json()) .then((data) => { root.render( -
- {data.products.map((product) => { - return Card( - product.id, - product.title, - product.thumbnail, - product.brand, - product.price - ) - })} +
+ {data.products.map((product) => ( // The arrow function implicitly returns the Card component, making the code more concise and readable. + + ))}
- ) - }) + ); + });