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

110
Views
Does this.setState really make component re-render?

something about this.setState in class components is confusing me. in react docs, i read that this.setState may be asynchronous in react docs. im okay with this and i tested it with logging the updated value after this.setState. but it is really confusing me: when we call this.setState, react calls render method of the class to re-render the ui. but this.setState is asynchronous and it means that first render method will be called and ui will be re-rendered by react, then the value in the state will be changed! so how does component show us the updated value? i dont... am i thinking right? thanks for helping.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

this.setState is asynchronous and it means that first render method will be called and ui will be re-rendered by react, then the value in the state will be changed! so how does component show us the updated value? i dont... am i thinking right?

I think you missed something.setState is asynchronous which means that the actions are batched together for performance gains . But why ? since it's not a a WebAPI or server call? This is because setState alters the state and causes rerendering. This can be an expensive operation and making it synchronous might leave the browser to behave unexpectedly.

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