How to import image in react with typescript

Hello, I need help I don’t know how to import images to React project, I am just starting with the React course with typescript

Can you please tell us what you are trying to say/do?

importing images!

import = you bring images from somewhere else location to the location of your desire (say project/src/assets/images)

what does it have anything to do with TypeScript or JavaScript?

1 Like

I am working on a project that requires an .svg logo file and also other images I have created a folder in my public directory called image where I stored all my images.

The challenge is, I want to use the images and svg file in my components but I don’t know how to go about it.

import ImageName from './path/to/image_or_svg';

ImageName = name it whatever you feel appropriate (choose the one suits)

<img src={ImageName} alt="Image" />
2 Likes