I am trying to setState after an operation succeeds (which is succeeding) but it fail when trying to setState.
.then(function () {
this.setState({ success: true, loading: false });
}).catch((error) => {
console.log("Error on creating document: ", error);
})
..it catches the error which says :
"error = TypeError: Cannot read property 'setState' of undefined at eval"
it seems to me that it cannot find this context but why?
EDIT:
this didnt help How to access the correct `this` inside a callback?