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