Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

117
Views
How to add image in a React component from local path in img tag

I am using the below img tag in my React component but the image is not displaying when I am taking the image source from a local path.

<img class="masthead-avatar mb-5" src="public/css/avataaars.svg" alt="..." />
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

why you are not trying this

import image from "./public/css/avataaars.svg"

<img src={image} alt="image" />

or if you want to use svg as a component you can try

import {ReactComponent as SvgIcon} from "./public/css/avataaars.svg"

<SvgIcon/>
about 4 years ago · Juan Pablo Isaza Report

0

you can try this -:

using require ...

<img src={require(`public/css/avataaars.svg`)} alt="" />
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!