How to detect and refresh outdated data in React Native app with redux-persist

700 views Asked by At

In a React Native app, usingRedux and Redux-Persist, what is the best way to identify what content needs to be updated?

I have an app that does a few requests at startup. When I enabled redux-persist I started to avoid a request if it was already done at another time. But I have no idea how best to identify whether or not to make the request again to update the data stored by redux-persist.

I read about the use of ETags andLast-Modified, but this implies implementing this in the API also right?

Any guidance for this functionality implemented in the right way?

1

There are 1 answers

3
Sandro Machado On BEST ANSWER

Yes, you also need to update your API.

Another solution is to use push notifications to notify that the data changed and perform a new request every time the notification is received. But this also means implementing some code on server side.

You need a way to know that the data changed, for that reason you always need to implement some code in server side.