import React, {Children, useState} from "react"; import {AiFillLeftCircle} from 'react-icons/ai'; export const ImageSlide = ({children}:any) => { const [current, setCurrent] = useState(0); const length = children.length; const array = Children.toArray(children); console.log(array) const nextSlide = () => { setCurrent(current === length - 1 ? 0 : current + 2); }; const prevSlide = () => { setCurrent(current === 0 ? length - 1 : current - 2); }; if(children.length <= 0){ return null; }; return(
{children.map((slide : any, index : any) => { return (
{index === current && ( travel image )}
); })}
); };