import Potato from './Potato';
에서 점과 슬래쉬의 의미는 같은 디렉토리라는 뜻이다. React가 멋진 이유는 재사용 가능한 component를 만들 수 있다는 점이다.
component에서 component로
child component로 정보를 보낼 수 있다.
array의 각 item에 function을 적용하고 난 뒤 array를 준다.
const friends = ["dal", "mark", lynn, "japan guy"]
friends.map((friend) => {
return friend + " 💛" ;
})
이렇게 하게 되면 모든 index값에 하트가 추가된 배열을 반환한다.
{foodILike.map(dish => {
<Food name={dish.name} picture={dish.image} />;
})}
{foodILike.map(dish => (
<Food name={dish.name} picture={dish.image} />
))}
이 둘의 차이점은 무엇일까
우선
npm i prop-types
import PropTypes from 'prop-types'
componentName.propTypes = {}