react-alice-carousel icon indicating copy to clipboard operation
react-alice-carousel copied to clipboard

Changing ActiveIndex no working

Open u-rogel opened this issue 1 year ago • 1 comments

Thanks for the great component!

When I change activeIndex prop, the carousel is not updating accordingly. This is my example usage:

import { useEffect, useState } from 'react'
import AliceCarousel from 'react-alice-carousel'
import 'react-alice-carousel/lib/alice-carousel.css'

const slide = [
  'Hello',
  'World'
]

function App() {
  const [activeIndex, setActiveIndex] = useState(0);

  useEffect(() => {
    setTimeout(() => {
      setActiveIndex(1)
    }, 1000)
  }, [])

  return (
      <AliceCarousel
        activeIndex={activeIndex}
        items={slide.map((item) => {
          return (
            <div key={item} className='red'>
              <h3>{item}</h3>
            </div>
          )
        })}
      />
  )
}

export default App

u-rogel avatar Jun 05 '24 13:06 u-rogel