0

When you are entering the first time for the page or refreshing, the first image does not seem. However, when you click the nav buttons, after arriving at the first image, it seems.

.
.
import SimpleImageSlider from "react-simple-image-slider";
.
.
.
const images = [{ url: file0 }, { url: file1 }, { url: file2 }];
.
.
.
return(
  <>
    <section className="shadow-none p-3 mb-5 rounded d-flex justify-content-center">
            <SimpleImageSlider
               width={896}
               height={504}
               images={images}
               autoPlay
               autoPlayDelay={5}
               showBullets
               showNavs
        />
      </section> 
  </>
) ;

Can anyone help?

1 Answers1

0

you need to write the condition before using slider:

images.length > 0

so your code may look like this

   .
.
import SimpleImageSlider from "react-simple-image-slider";
.
.
.
const images = [{ url: file0 }, { url: file1 }, { url: file2 }];
.
.
.
return(
  <>
    <section className="shadow-none p-3 mb-5 rounded d-flex justify-content-center">
    {images.length > 0 &&
            <SimpleImageSlider
               width={896}
               height={504}
               images={images}
               autoPlay
               autoPlayDelay={5}
               showBullets
               showNavs
        />
    }
      </section> 
  </>
) ;