I have been trying to import image in my react app using the import keyword from a local directory but I can't see any image files in the code suggestion. I have tried to type the entire path without using the suggestions but the image still won't load on my web application. Below are the links to the files.
Simple solution is put images into the public folder and use it like this:
<img src="/img1.jpg" />
in your situation, how do you created your react project? with create-react-app
? if yes https://create-react-app.dev/docs/adding-images-fonts-and-files/ there is simple solution for this... let's give a import image from same path with extension
嗨 Just Moeed 首先在 post import 中导入你在截图中的图像 这个图像在 src 中的导入名称
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.