import { useRef, useState } from "react"; import { Splide, SplideTrack, SplideSlide } from "@splidejs/react-splide"; import Comment from "./Comment"; type CarouselProps = { items: any; }; const Carousel = ({ items }: CarouselProps) => { const [activeIndex, setActiveIndex] = useState(0); const ref = useRef(null); const handleClick = (index: number) => { setActiveIndex(index); ref.current?.go(index); }; return ( setActiveIndex(newIndex)} hasTrack={false} ref={ref} > {items.map((item: any) => (
))}
{items.map((item: any, index: number) => ( ))}
); }; export default Carousel;