import { useState, useEffect } from 'react' import { Link } from 'react-router-dom' import movieApi from "../apis/movie.api.js" import catchErrors from '../utils/catchErrors.js' import styles from './MovieCard/movie-card.module.scss' const MovieComing = () => { const [TMDB_UpComing_Data, setTMDB_UpComing_Data] = useState([]) const [error, setError] = useState("") const category = "upcoming" useEffect(() => { getTMDB_UpComing() }, []) async function getTMDB_UpComing() { try { setError("") const response = await movieApi.getListByCategoryfromDB(category) setTMDB_UpComing_Data([...response]) console.log(response) } catch (error) { catchErrors(error, setError) } } return ( <> {TMDB_UpComing_Data.length !== 0 ?
{TMDB_UpComing_Data.map(movie => (
Movie Poster
{movie.overview}
{movie.adult ? : <>}
{movie.title}

{movie.runtime}분

{movie.release_date} 개봉

))}
:

} ) } export default MovieComing