Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

140
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda