Condition on props.images of Array reactjs, provide result in Carousel React based on condition

I have a list of images in Array for example this: ["img1.webp","img2.webp","img3.webp","img4.webp",....]

I have passed this array to another component where this.props.Arrayofimg has all the images. The result I want to get:

I would like to iterate over the Array, with given conditions on the list for example:

if (image === img1,img2,img6)
   display 4 other img in /src
if (.......)
   display 4 other img in /src

And so on it will be multiple if conditions. These 4 other images will be in the folders and should be displayed in Carousel.

I am new to react so I wish someone could help me here Thank you