Reputation: 23
In my react project when I used src=""
to provide address for an img
element it didn't get rendered while I use the same image address with import
it worked well.
This is when I used src
attribute
Why is this happens?
My working directory:
/public
index.html
/src
App.js
index.js
/components
Contact.js
/images
felix.png
Upvotes: 0
Views: 35
Reputation: 345
You need to add image to public directory so you can directly access it through src like :
<img src="/your-image-name.png" />
Upvotes: 4