Search code examples
reactjsimagepathsrc

correct path for image tag


enter image description hereGood evening,

i wanted to ask, what is the rule when you create paths for image tags or modules? I have in VScode inside the public folder and pictures folder. I want to get the picture to my about.js file which is in the src folder. My question is what is the path. And what is the rule?

I put an image down so that you can see where i am currently.

[![image of vs code](https://i.sstatic.net/iNUel.png)](https://i.sstatic.net/iNUel.png)


i tried to add two dots like this ../puplic/pictures....... and than i tried it with one.


Solution

  • One dot = "current directory" Two dots = "Up one level"

    So when you're giving the path "../public/*" you're telling your script to:

    • Go to the parent directory
    • Search for public/*

    What it looks like from your screenshot is that you should give the following path:

    ../pictures/X.jpg