How to Implement Data Polling With React, Redux, and Thunk

Introduction

In my previous article, Loading Data in React: Redux-Thunk, Redux-Saga, Suspense, and HooksI compared different ways of loading data from the API. Quite often in web applications, data needs to be updated frequently to show relevant information to the user. Short polling is one of the ways to do it. Check out this article for more details and alternatives.

Briefly, we are going to ask for new data every N milliseconds. We then show this new data instead of the previously loaded data. This article gives an example of how to do it using React, Redux, and Thunk.