NewsItem 컴포넌트는 article이라는 객체를 props로 통째로 받아 와서 사용합니다. NewsItem 컴포넌트를 다음과 같이 작성해 보세요.
components/NewsItem.js
import React from 'react'; import styled from 'styled-components'; const NewsItemBlock = styled.div` display: flex; .thumbnail { margin-right: 1rem; img { display: block; width: 160px; height: 100px; object-fit: cover; } } .contents { h2 { margin: 0; a { color: black; } } p { margin: 0; line-height: 1.5; margin-top: 0.5rem; white-space: normal; } } & + & { margin-top: 3rem; } `; const NewsItem = ({ article }) => { const { title, description, url, urlToImage } = article; return ( <NewsItemBlock> {urlToImage && ( <div className="thumbnail"> <a href={url} target="_blank" rel="noopener noreferrer"> <img src={urlToImage} alt="thumbnail" /> </a> </div> )} <div className="contents"> <h2> <a href={url} target="_blank" rel="noopener noreferrer"> {title} </a> </h2> <p>{description}</p> </div> </NewsItemBlock> ); }; export default NewsItem;