INNER CODE UNIT · JavaScript

GalleryCarousel

imranhsayed/woo-next · src/components/single-product/gallery-carousel/index.js:4

const GalleryCarousel = ({gallery}) => {

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

    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 === gallery.length ) {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…