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

120
Vistas
React rerending on updating state from function

I have a Question component and I receive callback finish when the question is finished. I want to show loading when I run operations from the finish function. But When I try to setState({isLoading: true}), It's been called repeatedly.

I am using the Class component. and here's the Question component I have used.

<QuestionCard
    questionData={question}
    next={this.next}
    previous={this.previous}
    finish={this.finish}
/>

And the finish function is as -

finish = () => {
   console.log('Finish')
   this.setState({isLoading: true})
}

So When I update the state of isLoading, it seems the component is re-rendered, and the finish function is called continuously. How I can stop this to work once and my loader to start loading?

I know there are some other questions also like this but those are not solving my issue. So please suggest solution for this.

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