Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

243
Vistas
Swiper js and React: How to pass React state when swiping left or right to prev/next slide

I am using Swiper js for my React slider.

I'am looping over an Object and return the Swiper slides.

I have some (filter) buttons as swiper slides, to filter content when selecting/clicking a button (by passing React state).

The active slide (which gets css class swiper-slide-active by the swiper api) should always be centered.

That's working fine from the api with the following props:

centeredSlides and slideToClickedSlide

But when I 'swipe' the slides to left or right, the swiper active slide get centered, but my other logic on the selected button data-active={true} is now not in sync with swipers active slide.

How to fix this?

Here is the CodeSandbox, with an example what I have so far.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda