How to cache data in ReactJS/Redux app?

Hello!
Write the application to React/Redux. There is an array of 2500 objects requested from the server. I would like somewhere to cache it, but don't know where..
You can save it in state, but when you refresh the page it will load again...
March 23rd 20 at 19:09
2 answers
March 23rd 20 at 19:11
Solution
Save to local storage
Redux Persist you will help
There are still redux-offline , but it is less popular
March 23rd 20 at 19:13
Solution
If you need to after you refresh the page remained, then localStorage is your first candidate.
If the objects always/for a long time the same, maybe easier to cache at the HTTP level, put it in a separate url, check the headers, and the browser itself from its cache give it to you, and invaliditaet the cache.
Okay, and if you save in localStorage and do check empty or not, how to understand that the array has changed and it should be overwritten in the vault?

The second option seems to be too perfect, changes happen about once a year) - fred_OConner commented on March 23rd 20 at 19:16
@fred_OConner, the problem of invalidation as understand it is only you with their data can solve.
for example update once a month. or after the application is launched in the background to query and update. or something like that. In short, about invalidation of the cache here: https://www.martinfowler.com/bliki/TwoHardThings.html

This does not apply to method caching - with any will be the same. - Orlando_Funk commented on March 23rd 20 at 19:19
@fred_OConner, place a marker (any id/date of last update/version/hash). Request from the server the current token, if different - perezapustit. - domenick.Klocko commented on March 23rd 20 at 19:22

Find more questions by tags ReactFrontendCaching