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

113
Views
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
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!