PromptsVault AI is thinking...
Searching the best prompts from our community
Searching the best prompts from our community
Prompts matching the #data-fetching tag
Master data fetching with Tanstack Query (React Query). Features: 1. useQuery for async state management. 2. Query keys for caching strategy. 3. Automatic refetching on window focus. 4. Mutations with invalidation. 5. Optimistic updates for instant UI. 6. Infinite queries for pagination. 7. Prefetching for better UX. 8. DevTools for debugging. Use with axios or fetch and implement retry logic with exponential backoff.
Implement SWR for optimal data experience. Pattern: 1. useSWR hook with cache key. 2. Return stale data immediately. 3. Revalidate in background. 4. Dedupe simultaneous requests. 5. Focus revalidation. 6. Interval polling for real-time feel. 7. Error retry with exponential backoff. 8. Mutation with useSWRMutation. Use globally for all requests and implement dependent fetching for serial queries.
Implement GraphQL with Apollo Client. Setup: 1. ApolloProvider with InMemoryCache. 2. useQuery hook for data fetching. 3. useMutation for data updates. 4. Optimistic UI responses. 5. Cache policies (cache-first, network-only). 6. Fragment composition for reusable fields. 7. Pagination with fetchMore. 8. Local state management. Use codegen for TypeScript types and implement error handling with Error Link.
Architect a data fetching layer with Nuxt 3 composables. Structure: 1. useFetch with key-based caching. 2. useAsyncData for complex queries. 3. Custom composable useApiClient. 4. Global error handling middleware. 5. Loading states with useLoadingIndicator. 6. Optimistic updates pattern. 7. Request deduplication. 8. Stale-while-revalidate strategy. Integrate Pinia for client-side state and implement automatic retries with exponential backoff.