I need to request static files from a react component's render method based on a dynamic prop, it's id
in my particular case. My folder structure is similar to this, the number of images in each gallery folder is arbitrary :
-hardcode
-id_1
-gallery1
-img1.jpg
-img2.jpg
-gallery2
-img1.jpg
-img2.jpg
-data.json
-id_2
-gallery1
-img1.jpg
-img2.jpg
-img3.jpg
-gallery2
-img1.jpg
-data.json
-id_3
...
Ideally, I need to get an array of image files that gallery1 and gallery2 folders contain and also get contents of data.json based on id
. What would be the best way to implement that?