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

243
Views
How to call specific image after importing all images from a folder in ReactJS?

I want to import all icons from an icon folder and then find the specific icon and display it on the screen. I have imported all the icons with the below code:

const images = this.importAll(require.context('./icons', false, /\.(png|jpe?g|svg)$/));
console.log(images);

importAll(r) {
  return r.keys().map(r);
}

Below is the screenshot of the console log [imported all images][1]

Now If I want to find a specific icon so how should I find it the name of the image file is not clear as highlighted in the screenshot.

const found = images.find(element => element = 'r04d.png');
console.log(found)

the above code output is shown below:

[output of found][2]

the name of the image file is not clear, how should I refer to this file and use it when required, please advise. [1]: https://i.stack.imgur.com/qc1ff.png [2]: https://i.stack.imgur.com/hbZbt.png

about 4 years ago · Santiago Gelvez
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!