I have to call some API for every 10 minutes in my react native application. So, I have defined timer in ComponentDidMount method along with Setinterval, But, It is calling only once, It is not calling repeatedly.
componentDidMount() {
this.timer = setInterval(() => this.callAPI(), 600000);
}
callApi = async () => {
//calling some api here
}
Any suggestions?
Finally I fixed this issue by following.
setInterval(() => this. callAPI(), 600000);
The above method calling every 10 minutes delay. Hope this will help someone in future.