I would like to make the state isLoading changed to true when recentTransactionsRecipient and recentTransactionsSender is not null.
I would like to do a promise, then
componentDidMount() {
this.Auth.recentTransactionsRecipient(this.props.id)
.then(res => {
if (res) {
this.setState({
recentTransactionsRecipient: res,
});
}
})
.catch(() => {
/* just ignore */
});
this.Auth.recentTransactionsSender(this.props.id)
.then(res => {
if (res) {
this.setState({
recentTransactionsSender: res,
});
}
})
.catch(() => {
/* just ignore */
});
}
this.Auth.recentTransactionSender(this.props.id)in the first then block. Then you can use.thento receive the second response. Otherwise store both requests in an array and usePromise.allas @mehamasum already answered.