import { useState, useEffect } from "react" import movieApi from '../../apis/movie.api.js' import "./box-office.module.css" const BoxOffice = () => { const [TMDB_TopRated_Data, setTMDB_TopRated_Data] = useState() useEffect(() => { // getTMDB_TopRated() let items = document.querySelectorAll('.carousel .carousel-item') // console.log("item", items) items.forEach((el) => { const minPerSlide = 4 let next = el.nextElementSibling for (let i = 1; i < minPerSlide; i++) { if (!next) { // wrap carousel by using first child next = items[0] } let cloneChild = next.cloneNode(true) el.appendChild(cloneChild.children[0]) next = next.nextElementSibling } }) }, []) async function getTMDB_TopRated() { const category = "popular" try { const data = await movieApi.getMoviesfromTM(category) console.log(data) setTMDB_TopRated_Data(data) } catch (error) { console.log(error) } } return (
{console.log(TMDB_TopRated_Data)}

Bootstrap Multi Slide Carousel

Slide 1
Slide 2
Slide 3
Slide 4
Slide 5
Slide 6
advances one slide at a time
{TMDB_TopRated_Data ? TMDB_TopRated_Data.map((moviePoster, index) => (
)) : (
영화를 불러올 수 없습니다:(
)}
) } export default BoxOffice