Mapped Data in Swiper not rendering correctly.
See original GitHub issuereact-id-swiper: ^3.0.0 swiper: ^5.3.6
When mapping data to the swiper component, as I have done in previous versions, the swiper renders all items ignoring the slidesPerView
, centeredSlides
parameters set. Here are my params:
const params = {
containerClass: 'testimony-carousel',
loop: true,
lazy: true,
rebuildOnUpdate: true,
pagination: {
el: '.swiper-pagination',
dynamicBullets: true,
clickable: true
},
centeredSlides: true,
slidesPerView: 1
}
inside the component it is set like this:
<Swiper {...params}>
{
data.testimonies.map((data, i) => (
<Testimony key={i} data={data} />
))
}
</Swiper>
The styling has been imported as well, still just rendering all slides inside the swiper container
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Swiper js for React does not render children properly
I have problem with rendering children into Swiper component. I use swiper in two places (Blog and Portfolio sections) so I created CardsSlider ......
Read more >Swiper React Components
SwiperSlide component can accept render function that receives an object with the following properties: isActive - true when current slide is active; isPrev...
Read more >Swiper slider doesn't rendered and works properly - Questions
I want to add Swiper slider to my react app with F7. But there many issues: The pagination dots are partially rendered -...
Read more >how to get current slide element index in swiper js react
Pagination correctly shows dots for the added slides, so Swiper sees them, but it never changes slide. If first render results in more...
Read more >Encountered Two Children with the Same Key — React Fix
The Problem When you are rendering React components in a map ... and may or may not correctly update your component when it...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I had the same problem @trevans24. Having a look at the Swiper Docs, I’ve figured out that they are wrapping each slide in a
div
with a class namedswiper-slide
. So this code works as expected:Same problem here