Is setState() an async operation? If yes, why is it async operation.

setState is a not a async operation. setState update the state property as soon as it is called in the operation thus triggering a re-render of the component.
setState is a async operation. React batches the setState operations for performance gains. This causes the state property to update and thus re-rendering of component. Making it sync is an expensive operation and may leave the browser or native platform unresponsive.
setState is a synchronous operation. It has to be synchronous because as soon as we update the state value we want it to be reflected on screen. Otherwise user will not see the right date on screen.
setState is not at all async operation because we are not calling any external resource in setState. So it can’t be async operation.
Verified Answer
Correct Option - b

To get all Infosys Certified React Native Developer Exam questions Join Group https://bit.ly/infy_premium_group

We're passionate about offering best placement materials and courses!! A one stop place for Placement Materials. We daily post Offcampus updates and Placement Materials.

Qtr No. 213, New Town Yehlanka Indore 454775

admin@prepflix.in