I am working with react and want to implement an image in the img html tag.
My code, which is in Testimonials.js looks like this:
<img className="s-img-switch" src="images/hero.jpg" alt="" />
and it doesn't work. I also tried like this:
<img className="s-img-switch" src="./images/hero.jpg" alt="" />
<img className="s-img-switch" src="../components/images/hero.jpg" alt="" />
but it also doesn't work. But when I put an URL, for example like this:
<img className="s-img-switch" src="https://media.moddb.com/images/members/5/4550/4549205/dog.jpg" alt="" />
it works.
Also, if I import the image in Testimonials.css like this:
background-image: url("./images/hero.jpg");
it also works. So that would mean that the image is ok.
This is what I see when I inspect the page, no matter what I do:
I can't seem to find an answer for this, so all help would be very much appreciated.