리액트 실습- 컴포넌트/props/map

import React from "react";

function Food({ name, picture }) {
return

<h2>I like {name}</h2>
<img src={picture} />
</div>

}

const foodIlike = [
{
name: "kimchi",
image: "https://www.maangchi.com/wp-content/uploads/2019/11/vegankimchi-insta.jpg"
},
{
name: "soju",
image: "https://www.saq.com/media/catalog/product/1/2/12894822-1_1578413418.png?quality=80&fit=bounds&height=&width="
}
]
function App() {
return (

<div> 
  <h1>hello stranger?</h1>
  {foodIlike.map(dish => (
  <Food name={dish.name} picture={dish.image} />
  ))}
  </div>

);
}

export default App

좋은 웹페이지 즐겨찾기