import React from "react"; const slides = [ "Slide 0", "Slide 1", "Slide 2", "Slide 3", "Slide 4", "Slide 5", "Slide 6", "Slide 7", ]; export const Slide = () => { const [page, setPage] = React.useState(1); const [style, setStyle] = React.useState(""); const firstRightClick = React.useRef(true); const firstLeftClick = React.useRef(true); const slide = React.useRef(0); const handleLeftClick = () => { if (firstLeftClick.current) { //왼쪽 버튼이 true이면 firstLeftClick.current = false;// 왼쪽 버튼은 false로 firstRightClick.current = true; // 오른쪽 버튼은 true로 } else { setPage(page - 1); // 왼쪽 버튼이 false이면 눌렸을때 page-1 } slide.current -= 1; setStyle("-translate-x-full animate-slidetoright"); }; const handleRightClick = () => { if (firstRightClick.current) { firstLeftClick.current = true; firstRightClick.current = false; } else { setPage(page + 1); } slide.current += 1; setStyle("animate-slidetoleft"); }; console.log(`page: ${page}`); console.log(`style: ${style}`); console.log(slides.slice(page - 1, page + 2)); console.log(`slide number: ${slide.current}`); return (