Here is my path to the image: ../src/assets/images/img_name.jpg"
And path to the file.js: src/file_name.js
If I implement my code in file.js like this:
- Import img_name from
"../src/assets/images/img_name.jpg"
- Then reference the img path in href tag:
<img src={img_name}></img>
It will work but If I dont import and reference the img like this: <img src='../src/assets/images/img_name.jpg'></img>
It won't work no more. Can anyone explain why??
I use create-react-app