({ queryKey }: { queryKey: QueryKey })
| 6 | |
| 7 | // Define a default query function that will receive the query key |
| 8 | const defaultQueryFn = async ({ queryKey }: { queryKey: QueryKey }) => { |
| 9 | const response = await fetch( |
| 10 | `https://jsonplaceholder.typicode.com${queryKey[0]}`, |
| 11 | ) |
| 12 | if (!response.ok) throw new Error('Failed to fetch data') |
| 13 | return await response.json() |
| 14 | } |
| 15 | |
| 16 | // provide the default query function to your app with defaultOptions |
| 17 | const queryClient = new QueryClient({ |
nothing calls this directly
no outgoing calls
no test coverage detected