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

133
Vistas
How do I animate react-bootstrap progress bar from 0 to N on page load?

I am using the react-bootstrap ui library for the progress bar. I want it to animate the progress bar from 0 to 70 on page load.

How do I achieve it?

Here is the code

Component.js

<ProgressBar
        animated
        now={70}
        className="progress-bar"
      />

Component.style

.progress-bar {
  width: 400px;
}

Expected OutPut: It should animate from 0 to 70 on page load. enter image description here

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

The animate property doesn't animate the progress, but animates the stripes on the progress bar.

From the docs:

Animate's the stripes from right to left

What you need is a timer that updates the now property. Probably something like this:

const MyComp = () => {
 const [progressNow, setProgressNow] = useState(0)

 const updateProgressNowHandler = setInterval(() => {
  if (progressNow >= 70 ){
   setProgressNow(70)
   clearInterval(updateProgressNowHandler)
  }
  setProgressNow(s => s+1)
 }, 50)

 return 
  <ProgressBar
        animated
        now={progressNow}
        className="progress-bar"
      />
}

This is by no means production ready.

You need to make sure that you clear the interval when the component unmounts.

If there is a chance that the component will be re-rendered (which most likely will happen) you need to keep track of the progress already made and start with the counter from the last value.

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