Why does Async Await work with React setState?
问题 I have been using async await with babel in my ReactJS project. I discovered a convenient use with React setState that I would just like to understand better. Consider this code: handleChange = (e) => { this.setState({[e.target.name]: e.target.value}) console.log('synchronous code') } changeAndValidate = async (e) => { await this.handleChange(e) console.log('asynchronous validation code') } componentDidUpdate() { console.log('updated component') } My intention was for the asynchronous