Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

237
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda