react-alice-carousel
react-alice-carousel copied to clipboard
Changing ActiveIndex no working
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