Reputation: 229
I am trying to show my local image into html using react.
I have app.js which is calling Header component.
I am trying to add woods.jpg
The image does not exist, why?
I tried different location but couldn't implement it,
src={"../w3images/woods.jpg"}
src={"./w3images/woods.jpg"}
src={"/w3images/woods.jpg"}
src="/w3images/woods.jpg"
Upvotes: 0
Views: 7836
Reputation: 4008
I guess your app is served from public
(there's a folder I see).
Then you must specify a path relative to that folder.
Something like ../src/w3images/woods.jpg
if your index.html is in /public/index.html
.
Upvotes: 0
Reputation: 1416
Your images must be on the public repository to be accessed.
Then, you can have an img like that :
<img src="/w3images/woods.jpg"/>
Upvotes: 3