-
Hello, I just created my first React website and I wanted to deploy it using Github pages. When I run the site locally using npm run dev, everything looks right and the images load properly. However, they do not load when deployed. I suspect it's an issue with the file path but I'm not sure. Here is the repository for reference: |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
This comment was marked as off-topic.
This comment was marked as off-topic.
-
Hii Marina! Actually I have some suggestions! The images are being used in
import myImage from '../assets/artAssets/myImage.png'; And put it inside an array just like you did with the strings. I did something similar but using object notation. I hope it helps! 😊 If not, let me know!! |
Beta Was this translation helpful? Give feedback.
Hii Marina! Actually I have some suggestions! The images are being used in
Gallery.tsx
, right?You can change the
_URL_
to../assets/artAssets/
and see if it works already, but also I would change the 15, 17, 20 and 22 lines because the image extension is in caps (just in case)You can import all images as components!! Just like:
And put it inside an array just like you did with the strings. I did something similar but using object notation.
I hope it helps! 😊 If not, let me know!!