2021-02-25

Why wont React load my images from the src folder?

I'm trying to get images in my react app to showcase some of the brands my family's company sells. I'm thinking of putting it in like a grid, something like this: Brands Grid (Please excuse my aweful design, its just an idea).

So, I tried adding a picture using this way:

import image from '../images/brandlogos/image.png';

Which didn't work (i'll get to how it didn't work in a bit). So, with some research, I came across this other way, using the require(). And it still doesn't work. const klaxcar = require('../images/brandlogos/klaxcar.png');

Now, this is what I mean by "it doesn't work": Not working

I have no clue what this even means, I'm very new to react. It's weird because I tried to make a slideshow a couple of days ago and it worked. My only guess is, does it have to be a component? Or is there an issue with my file paths? (I put my images folder in src). Any help is very much appreciated.



from Recent Questions - Stack Overflow https://ift.tt/3qRNe8b
https://ift.tt/2NZh77G

No comments:

Post a Comment