ECMAScript 6 introduced arrow functions, In your case, the anonymous function would not able to access "this" until it bound. They don't have their own this binding. Instead, this is looked up in scope just like a normal variable.
You need to add arrow function at first ".then" and as well as in ".catch"
autoWork(e) {
this.setState({ showWaiting: true });
actions.autoSubmit(exampleVarOne, exampleVarTwo).then((results) => {
dbAction.fetch().then((response) => {
if (response.status === 200) {
const responseData = response.data;
this.setState({ disabledButton: true })
this.setState({ showWaiting: false });
}
}).catch((error) => {
console.log(error);
this.setState({ showWaiting: false });
});
});
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…