Why is it advised to pass a callback function to setState as opposed to an object?

Technology Community › Category: React › Why is it advised to pass a callback function to setState as opposed to an object?
VietMX Staff asked 5 years ago

Because this.props and this.state may be updated asynchronously, you should not rely on their values for calculating the next state.