Since setState works asynchronously, it does not update the state immediately. How do I update a state variable inside a loop.
The functionality is to validate multiple fields and to store if the field value is valid for a particular row index. However since the state changes do not reflect immediately, I am not receiving the desired output.
Please suggest the best way to handle this.