[React] Adding an image source as a property for each component

Hi there, could anybody tip me how to connect an image for each component as a property? I’m novice one and maybe I do smth wrong. I’m trying to pass as a property an image source for each component from the main app component and then I just assign it to minor components as this.props.src is it appropriate or not?


you may find that some people would not help you just because you are posting a picture of a screen with your code

if you post your code (copy&paste here) or create a pen (codepen.io) or a repl (repl.it) or somewhere else online you may find more help
And also if you state clearly the library or framework you are using in the title of your thread

I’m sorry I can’t help you with this, I am not experienced with this framework

I use react js library, ok thank you for advise.

As @ILM says, please post code, not screenshots. Screenshots are impossible to debug - you’re effectively asking people to manually write your code by coping it from a screenshot to test if it works, and people are generally not going to do that.

In this case I have, and your code works fine. However I can see you’re directly linking to Google images URL, so even without being able to see the full string I can tell you what you have there isn’t the URL for an image. Google image URLs are not the web addresses of images . So the code is fine but the img tag doesn’t have a valid src for the image.


Also, I’m genuinely surprised this actually works:

<img src = {blah} />

Avoid putting random spaces in, it should look like this:

<img src={src} />