How to use Image from Public Folder in a React

In this blog, we will learn how to use images from the public folder,  if we use a lot of images static in our project then the public folder is best suitable to put an image because we can easily access the file from the public folder, there is no need to import a file.

Let’s  see the following steps on how to use an image from a public folder in a react:


Use Image from Public Folder

  • Create a folder named images inside the public folder.
  • Put your image inside the images folder.
  • Write the following code in your javascript file where you want to use image:
  • <img src={process.env.PUBLIC_URL+"images/logo.png"} />

Categories: web designing react front end developer

Trending Courses

CodeIgniter

Regular : 45 Days

Fastrack : 20 Days

Crash : 10 Days

Advance Digital Marketing

Regular : 6 Months

Fastrack : 3 Months

Crash : 2 Months

React JS

Regular : 45 Days

Fastrack : 25 Days

Crash : 15 Days

Laravel

Regular : 45 Days

Fastrack : 20 Days

Crash : 10 Days

Front End Developer

Regular : 6 Months

Fastrack : 4 Months

Crash : 2 Months

Request For Demo