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

139
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
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