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

204
Views
Is there a reason this function would or should eventually crash a web app?

I've got a react application and I want to display the time and date with the time updating every minute as it should. I wrote this code but if I leave the app running for an extended period of time I eventually get a crash that tells me the memory has been exceeded.

If there is a better way to do this I'd love some guidance. Thanks.

let currentDate = new Date();    

  setInterval(() => {
    currentDate = new Date();
    setDate({
      time: currentDate.toLocaleTimeString("en-US", {
        hour: "2-digit",
        minute: "2-digit",
      }),
      date: currentDate.toDateString().slice(3),
    });
  }, 60000);
about 4 years ago · Juan Pablo Isaza
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!