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

162
Vistas
Why is my page blinking even if I set interval to be cleared?

I have set code to change transform property in React. Initially, it is set to --scaleX as 1, then after 6 seconds first setTimeout change it in 0 and 6 seconds after (meaning 12 second from start) setInterval activates and runs every 12 seconds, doing also a change of that style every 6 seconds (total setInterval duration is 12 seconds). A sample of the code is shown below.

useEffect(() => {
   setTimeout(() => {
      redRef.current.style.setProperty("--scale", "scaleX(0)");
    }, 6000);

    let repeatSec = setInterval(() => {
      redRef.current.style.setProperty("--scale", "scaleX(1)");

      setTimeout(() => {
        redRef.current.style.setProperty("--scale", "scaleX(0)");
      }, 6000);
    }, 12000);

    return () => {
      clearInterval(repeatSec);
    };
  }, []);

But, even though I have cleared the interval, the page works and the style changes every 6 seconds, but the page is constantly blinking on strange way. For example, suddenly everything disappears and becomes white, but it returns when I scroll up/down.

Also, flickering occurs in some places at whole the site.

Why is that happening and what should I correct here to prevent it?

about 4 years ago · Santiago Gelvez
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