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

149
Views
My react app freezes/lags on mobile devices

I created an app but it freezes on mobile devices, i don't know what is the issue.

The app on netlify : https://mlvo.netlify.app/

On computers it works very fine and it's fluid, but on mobile devices it works on landing in the page, but after 2/3 actions, it freezes.

Can someone help me please?

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Opening your app and checking the console, you can see that it is not working fine on desktop either. There is an infinite console.log being called from Planning.js. enter image description here

You need to go back and look at what could be causing that. (Without seeing the code, this looks like an issue with useEffect causing an infinite rerender and hitting your console logs.)

The reason it may seem to be ok on a desktop is likely because desktops have more resources than phones, so you don't see as much performance drop-off from repeated console logs.

about 4 years ago · Juan Pablo Isaza Report

0

It looks there is a side effect that trigger your app to run in an infinite loop.

Why this behavior

You have 2 useEffects the first one which loads after the component mounts, that makes an api hit, and set your state to the response.data. the second one has the eventlist as one of it's dependencies, when the dependency change, react triggers another rerender, and hence the dependency change, and so on and so forth.

const [eventList, setEventList] = useState([]);
useEffect(() => {
    Axios.get('https://mlvo-planning.herokuapp.com/read').then((response) => {
      setEventList(response.data);
    })

  });

  useEffect(() => {
    if(eventList){
    eventList.map((l)=>{
      console.log(moment(l.eventDate, "DD-MM-YYYY").format("ddd DD MMM"));
    });
  }
  },[eventList]);

How to prevent this behavior?

The infinite loop is fixed by correct management of the useEffect(callback, dependencies) dependencies argument.

An efficient way to avoid the infinite loop is to properly manage the hook dependencies — control when exactly the side-effect should run.

I highly encourage you to read more about the useEffect hook

about 4 years ago · Juan Pablo Isaza Report
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!