Store certain query responses locally #4761
Replies: 4 comments 2 replies
-
| I don't understand what you're actually asking. Can you give some specific details of what you're trying to do? |
Beta Was this translation helpful? Give feedback.
-
| with the example from https://redux-toolkit.js.org/rtk-query/usage/queries: // Or from '@reduxjs/toolkit/query/react' import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query' import type { Post } from './types' const api = createApi({ baseQuery: fetchBaseQuery({ baseUrl: '/', }), tagTypes: ['Post'], endpoints: (build) => ({ // The query accepts a number and returns a Post getPost: build.query<Post, number>({ // note: an optional `queryFn` may be used in place of `query` query: (id) => ({ url: `post/${id}` }), ...I would like to store the results on device for a certain period. We are using React Native to fetch which do not change that often. Therefore it would be useful to:
|
Beta Was this translation helpful? Give feedback.
-
| Thanks. I am looking for that indeed. But this is just for in-memory cache. I am looking for on device local KV storage so it would work with React Native restarts. |
Beta Was this translation helpful? Give feedback.
-
| I think what you are looking for is documented here |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Is it possible to store certain query responses on device, fetch the query, and replace the stored value? As a faster cache.
Beta Was this translation helpful? Give feedback.
All reactions