Home > Software design >  Image file suggestions not showing up in react application
Image file suggestions not showing up in react application

Time:07-19

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.

screenshot of import statement

screenshot of image location in the src folder

CodePudding user response:

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

CodePudding user response:

Hi Just Moeed first import the image you in the screenshot in post import Image in this Image in src the name of import

  • Related