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

138
Views
How to implement loading bar for apis in react?

I want to create a status bar something like in this : https://vaadin.com/learn/tutorials/using-web-components

enter image description here This should be called when a user hits an api.

I tried with https://ant.design/components/progress/#header , by continuously changing the progress every 100ms, but how to exactly make it look continuous as in https://vaadin.com/learn/tutorials/using-web-components

    useEffect(()=>{
    if(loading==true){
        setPercent(0)
       changePercent()
    }
  },[loading])
  const changePercent=()=>{
      if(loading==false){
          return
      }
      if(loadingPercent<99){
        const rotation = loadingPercent + 1;
        setPercent(rotation)
      
      }else{
          setPercent(0)
      }
      requestAnimationFrame(changePercent);
  }

It's showing the progress 1 , and the functions is not being called again

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

0

If you're faking the progress just so the user has something to look at, I think you'll get the smoothest results by using requestAnimationFrame instead of setTimeout and using the time since start of the animation to calculate the current "progress"

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!