For a React application that needs to refresh parts of Redux state tree presented to the user in set intervals, are there any downsides to just using setTimeout() to trigger the Redux action creator (for example inside a ComponentDidMount() lifecycle method)and get a json from an endpoint instead of using a proper polling framework such as Meteor.
One use case I can think of is to refresh the user inbox for new messages.
It is generally advised to move your async stuff to redux-middleware:
setState in a then function then it is not guaranteed that component will still be mounted when Promise resolves. setTimeout or setInterval - someone may forget to unsubscribe from them when component unmounts and react will throw error.componentWillMount, componentWillUpdate and componentWillReceiveProps).redux-saga or redux-observable make such async task easy to accomplish. However... if you have a very simple situation then moving your code trough middleware may add unnecessary complexity. So, in the end, it's best to do what will be easier to understand and handle in future.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With