INNER CODE UNIT · JavaScript

HeroCarousel

imranhsayed/woo-next · src/components/home/hero-carousel/index.js:5

const HeroCarousel = ({heroCarousel}) => {

    if ( isEmpty(heroCarousel) || ! isArray( heroCarousel ) ) {
    	return null;
    }

    const autoPlay = true;
    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 = () => {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…