Closed vincentpham13 closed 3 years ago
Hey @vincentpham13. Sorry for the late response. The image could be anywhere, but I prefer to put it alongside the component file. As you see in this example:
export default () => <div>
<img src={require('./my-image.jpg')} />
</div>
the relative path is showing that the image is alongside the component itself. So to make it more clear, suppose that the component in the previous example is in this path: /components/MyAwesomeComponent/index.js
, then the image file is here /components/MyAwesomeComponent/my-image.jpg
.
Which folder did you mean to put the images? I created an
images
folder inside thepublic
folder but still got the error. As your guide, the image should be located in the same directory of the code file, that's so weird.