MCPcopy Create free account
hub / github.com/TanStack/query / defaultQueryFn

Function defaultQueryFn

examples/solid/default-query-function/src/index.tsx:14–22  ·  view source on GitHub ↗
({ queryKey })

Source from the content-addressed store, hash-verified

12
13// Define a default query function that will receive the query key
14const defaultQueryFn: QueryFunction<unknown> = async ({ queryKey }) => {
15 const response = await fetch(
16 `https://jsonplaceholder.typicode.com${queryKey[0]}`,
17 {
18 method: 'GET',
19 },
20 )
21 return response.json()
22}
23
24// provide the default query function to your app via the query client
25const queryClient = new QueryClient({

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected