developed-pinkD
Refine15mo ago
4 replies
developed-pink

How to cache data when using useList hook?

Currently calling the hook like this:
const { data: componentsData, isLoading } = useList({
  resource: 'components',
  meta: { variables: { customerCode, environmentCode } },
  queryKey: ["components", customerCode, environmentCode], // Unique key for caching
  cacheTime: 5 * 60 * 1000, // Cache for 5 minutes
  staleTime: 1 * 60 * 1000, // Keep data fresh for 1 minute
});
Was this page helpful?