How to get it autoplay
muhaimincs opened this issue · 2 comments
muhaimincs commented
How to get it autoplay
Emiliano-Bucci commented
@muhaimincs Hi! Sorry for the delay :) The autoplay
functionality isn't built inside the Carousel, as every developer may have particular/different needs, and i wanted to maximum the extensibility of the library. In order to implement the autoplay
functionality you can do the following:
useEffect(() => {
const interval = setInterval(() => {
slideToNextItem();
}, 3000);
return () => {
window.clearInterval(interval);
};
}, [slideToNextItem]);
return (
<div>{carouselFragment}</div>
)
Let me know if you need anything else! :)
muhaimincs commented
understood. Thanks!