在下面的示例中,我需要在fetch方法中调用fetchData之前重置一些值。 async await会等待reset方法中的所有函数完成后再继续吗?
或者你需要执行以下操作吗?
感谢您的选择 :)
fetch = async () => {
await this.reset();
this.props.fetchData();
};
reset = () => {
this.props.resetFilter();
this.props.resetClient();
this.props.resetUser();
};
或者你需要执行以下操作吗?
fetch = () => {
this.reset().then(() => {
this.props.fetchData();
});
};
reset = async () => {
await this.props.resetFilter();
await this.props.resetClient();
await this.props.resetUser();
};
感谢您的选择 :)