import { useEffect, useState } from 'react' import movieApi from '../apis/movie.api.js' import catchErrors from '../utils/catchErrors.js' const Collection = ({ TMDB_TopRated_Data }) => { const [videoUrls, setVideoUrls] = useState([]) const [error, setError] = useState("") useEffect(() => { if (TMDB_TopRated_Data.length > 0) { getVideos() } }, [TMDB_TopRated_Data]) async function getVideos() { try { const data = await movieApi.getVideosfromTM(TMDB_TopRated_Data[0].id) setVideoUrls(data) } catch (error) { catchErrors(error, setError) } } return ( <>

Movie Collection

{videoUrls.length > 0 ?
:
예고편 정보가 존재하지 않습니다.
}
{TMDB_TopRated_Data.length > 0 ? :
}
) } export default Collection