Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

163
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!