git: https://github.com/leeyulgok/React-BootCamp-Team2/tree/yulgok
const Detail = () => {
const [movie, setMovie] = useState({});
const { id } = useParams();
const getMovie = async () => {
const json = await (
await fetch(`https://yts.mx/api/v2/movie_details.json?movie_id=${id}`)
).json();
setMovie(json.data.movie);
console.log(json);
};
useEffect(() => {
getMovie();
}, []);
return (
<div className={styles["detail-container"]}>
<div className={styles["moive-img"]}>
<img src={movie.large_cover_image} alt="movie_cover" />
</div>
<div className={styles["movie-des"]}>
<h1>
{movie.title}({movie.year})
</h1>
<ul>Genres : {movie.genres && movie.genres.map((g) => <li key={g}>{g}</li>)}</ul>
<small>runtime : {movie.runtime}</small>
<p>{movie.description_intro}</p>
</div>
</div>
);
};
export default Detail;
본 후기는 유데미-스나이퍼팩토리 10주 완성 프로젝트캠프 학습 일지 후기로 작성 되었습니다.
#프로젝트캠프 #프로젝트캠프후기 #유데미 #스나이퍼팩토리 #웅진씽크빅 #인사이드아웃 #IT개발캠프 #개발자부트캠프 #리액트 #react #부트캠프 #리액트캠프