Polling API every x seconds with react
Well, since you have only an API and don’t have control over it in order to change it to use sockets, the only way you have is to poll. As per your polling is concerned, you’re doing the decent approach. But there is one catch in your code above. componentDidMount() { this.timer = setInterval(()=> this.getItems(), … Read more