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

166
Vistas
How can I make this infinite? I want to move the first element of an array to the last position using React Js

I creating this automatic infinite slider in React Js but it is not infinite. I am thinking that the best way to make it infinite is to move the first element to the end and make that in the setInterval in that way my array is always exchanging positions.

export const Slider = ({ images }) => {
    const [position, setPosition] = useState(0);

    useEffect(() => {
        const interval = setInterval(() => {
            setPosition(prev => prev + 0.1);
        }, 1000);
    }, []);

    const containerVar = {
        hidden: {
            x: 0,
        },
        show: {
            x: -250 * position,
            transition: { repeat: Infinity, duration: 2, ease: 'linear' },
        },
    };
    return (
        <Container
            as={motion.div}
            variants={containerVar}
            initial='hidden'
            animate='show'
        >
            {images.map(({ name, ...imagesData }) => (
                <CardClients key={name} name={name} {...imagesData} />
            ))}
        </Container>
    );
};
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