this is what im trying to achieve
[]
this is what my code renders
this are the react component codes
this is the link to the codesandbox: https://codesandbox.io/p/sandbox/admiring-resonance-qptjfh?file=%2Fsrc%2Fcomponents%2FAdCarousel.tsx%3A10%2C1
i am trying to render 4 images/company logos per slide, but everything ends up clustered on 1 slide. i have tried to adjust the css to the best of my knowledge, everything i have tried does not work.
For each slide, the code selects a subset of 4 logos using slice. It then maps over this subset, creating an img element for each logo. The key attribute is set to the logoIndex for efficient rendering. i used this method to achieve a dynamic rendering of logos based on the current slide and the position of each logo in the overall array.
thank you in advance
2
Answers
Without seeing your code, I will provide you with a simple example of a React component that uses the popular carousel library, react-slick, to achieve the desired behavior. Make sure you have installed react-slick and slick-carousel using npm or yarn
Install:
Create a simple React component
Now, you can use this component in your parent component:
I suggest you to use swiper for this purpose .
here :
https://swiperjs.com/react