0

I want to play my react spring slider to automate sliding after a certain time passes. I have also used auto Play prop with interval props but still I am facing this problem my carosel not sliding automatically. Here, is my code

 import Carousel from "react-spring-3d-carousel";
 import { v4 as uuid } from "uuid";
 slides = [
{
  key: uuid(),
  content: (
    <img
      src="https://picsum.photos/800/801/?random"
      alt="1"
      onClick={() => setVal({ goToSlide: 0 })}
    />
  ),
},
{
  key: uuid(),
  content: (
    <img
      src="https://picsum.photos/800/802/?random"
      alt="2"
      onClick={() => setVal({ goToSlide: 1 })}
    />
  ),
},
{
  key: uuid(),
  content: (
    <img
      src="https://picsum.photos/600/803/?random"
      alt="3"
      onClick={() => setVal({ goToSlide: 2 })}
    />
  ),
},];
  const [val, setVal] = useState(state);
  <Carousel
          slides={slides}
          goToSlide={val.goToSlide}
          offsetRadius={val.offsetRadius}
          showNavigation={val.showNavigation}
          animationConfig={val.config}
          autoPlay={true}
          interval={4}
        />
4

0 回答 0