Is it possible to destructure image folder files in React Component?

I’m creating a react app. I have an image folder with a few files. In order for React to render the image I have to import it like I import other modules. Something like this:

image import into a Component

What I want to do is import the whole image folder, and then find a way to access each file in my Component. for example:

import img from '.../img'

In my JSX, I want to be able to access each of the files from the imported image folder.

Is it possible to do?

140 thoughts on “Is it possible to destructure image folder files in React Component?”

Leave a Comment