INNER CODE UNIT · JavaScript
slideDuration
imranhsayed/woo-next · src/components/home/hero-carousel/index.js:12
const slideDuration = 2; // in seconds
const activeIndexRef = useRef( { activeIndex: 0 } );
const slideRef = useRef( 0 );
const [ slide, setSlide ] = useState( 0 );
const [ restartSlide, setRestartSlide ] = useState( 0 );
const { activeIndex } = activeIndexRef.current;
/**
* Change to next slide.
*/
const nextSlide = () => {
if ( 1 === heroCarousel.length ) {
return null;
}
/**
* If if autoplay is set to true