forEach함수에서 {}를 ()로 수정하면 해결된다.
//수정 전
<div className="movies">
{movies.map(movie=>{
<Movie
key={movie.id}
id={movie.id}
year={movie.year}
title={movie.title}
summary ={movie.summary}
poster={movie.medium_cover_image}
/>
})}
</div>
//수정 후
<div className="movies">
{movies.map(movie=>(
<Movie
key={movie.id}
id={movie.id}
year={movie.year}
title={movie.title}
summary ={movie.summary}
poster={movie.medium_cover_image}
/>
))}
</div>
from map(() => {}) to map(() => ())
'REACT' 카테고리의 다른 글
[React] form 태그, event.preventDefault (0) | 2021.10.12 |
---|---|
[React] useEffect(), props, rendering (0) | 2021.10.12 |
REACT | [ERROR] Warning: Invalid DOM property `class`. Did you mean `className`? 해결 (0) | 2021.10.11 |
REACT | #2.4 Protection with PropTypes (0) | 2021.10.11 |
REACT | #2.3 map Recap (0) | 2021.10.11 |