I want to retrieve data dynamically and insert it as a slide in my slider. I am using Swiper to do this. However, I run into problems because Swiper does not update as the number of slides in the array increases. Only when I reinitialize Swiper after the new slides are available does Swiper find the new array. I have found the observer parameter to reinitialize Swiper when the children are updated. However, I can not set this to active, i.e. observer:true is not possible.
How do I activate the observer Parameter. I have tried the following approach?
<Swiper
slidesPerView={1.2}
spaceBetween={10}
loop={false}
centeredSlides={true}
observer={true}
observeParents={true}
pagination={{
clickable: true,
}}
onSlideChange={
(swiper) =>
handleIndexChange(swiper.activeIndex)
}
onSwiper={(swiper) => console.log(swiper)}
>
{ShowItems}
</Swiper>