5 Replies
Hi @SeeMe. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Refine uses React Query for data fetching and caching. When you fetch data using the
useList
hook, Refine automatically caches the data. It uses structured keys to identify and cache server responses for queries and mutations. These keys also help optimize performance by reusing cached data when needed.
Here is an example of how to use the useList
hook:
By default, Refine has 5 minutes of cache time and 0 seconds of stale time for queries. This means that if a query is re-used in 5 minutes, it will be populated with cached data and in the meantime, it will be refetched in the background. If the query is not re-used in 5 minutes, it will be refetched immediately.
For more information, you can refer to the Refine documentation on state management (https://refine.dev/docs/guides-concepts/general-concepts#state-management) and useList hook (https://refine.dev/docs/data/hooks/use-list).
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@515570518443819018> kapa.ai is still learning and improving, please let us know how it did by reacting below
quickest-silver•6mo ago
how to cahea with const { dataGridProps } = useDataGrid({
resource: 'listings',
meta: { pagination: { current: 1, pageSize: 25, mode: 'server' } },
});
const { dataGridProps } = useDataGrid({
resource: 'listings',
meta: { pagination: { current: 1, pageSize: 25, mode: 'server' } },
});@kapa.ai
kapa.ai
@kapa.ai how to cache with const { dataGridProps } = useDataGrid({
resource: 'listings',
meta: { pagination: { current: 1, pageSize: 25, mode: 'server' } },
});
Let me check the knowledge base for you. One moment! :books:
----------------------
The
useDataGrid
hook in Refine uses the useList
hook under the hood to fetch data, which means it also benefits from the caching mechanism provided by React Query. When you fetch data using the useDataGrid
hook, the data is automatically cached by React Query.
Here is an example of how to use the useDataGrid
hook:
In this example, the useDataGrid
hook fetches data from the 'listings' resource and provides the necessary props for the DataGrid
component. The fetched data is automatically cached by React Query.
For more information, you can refer to the Refine documentation on useDataGrid hook (https://refine.dev/docs/ui-integrations/material-ui/hooks/use-data-grid/) and useList hook (https://refine.dev/docs/data/hooks/use-list).
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@515570518443819018> kapa.ai is still learning and improving, please let us know how it did by reacting below