Initial Data as Cache
I want to use react query as a offline backup cache. However I want to save a whole database table. Would it make sense to fetch all data like with pagination)
and then manually add all the routes like
So I always have all data in the cache just in case I loose connection.
Is this a valid way of doing it? Or is this something react query is not made to be.
https://tanstack.com/query/latest/docs/framework/react/guides/initial-query-data#initial-data-from-the-cache-with-initialdataupdatedat
api/ratingsand then manually add all the routes like
api/ratings/1api/ratings/2api/ratings/3So I always have all data in the cache just in case I loose connection.
Is this a valid way of doing it? Or is this something react query is not made to be.
https://tanstack.com/query/latest/docs/framework/react/guides/initial-query-data#initial-data-from-the-cache-with-initialdataupdatedat
There are many ways to supply initial data for a query to the cache before you need it: Declaratively: Provide initialData to a query to prepopulate its cache if empty Imperatively: Using initialData...
