dustytrevino
dustytrevino

Reputation: 1

Local images will not display on my react app

Web urls work, local path images work as background images. But, local path images WONT work using img tag.

use case

       <div class="Gallery">
  <div class="ItemOne">
     <img src="images/witcher.jpg" alt="ImageOne"></img>
  </div>
  <div class="ItemTwo">2</div>
  <div class="ItemThree">3</div>
  <div class="ItemFour">4</div>

Upvotes: 0

Views: 115

Answers (1)

caro
caro

Reputation: 21

Import the image first

import ImageOne from 'images/witcher.jpg'

and use it this way

<img src={ImageOne} alt="ImageOne"></img>

Upvotes: 2

Related Questions