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

217
Vistas
When I get to last item of the react carousel, it takes two clicks to center back to the first item

So when im on the last item and i click next it will move to next item but wont move the scrollbar back to the beginning unless if I hit next again but then the index is now on the second item not the first.

const nextSlide = () => {
   if (current === length - 1) {
     setCurrent(0);
     listRef.current.scrollIntoView({
       behaviour: "smooth",
       block: "nearest",
       inline: "center",
     });
   } else {
     setCurrent(current + 1);
     listRef.current.scrollIntoView({
       behaviour: "smooth",
       block: "nearest",
       inline: "center",
     });
   }
 };

here is the codebox: https://codesandbox.io/s/boring-sea-bfds7?file=/src/App.js

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