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

Function List

packages/react-query/src/__tests__/useInfiniteQuery.test.tsx:1117–1133  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1115 const initialData = { pages: [1, 2, 3, 4], pageParams: [0, 1, 2, 3] }
1116
1117 function List() {
1118 useInfiniteQuery({
1119 queryKey: key,
1120 queryFn: ({ pageParam }) =>
1121 sleep(50).then(() => {
1122 fetches++
1123 return pageParam * 10
1124 }),
1125 initialData,
1126 initialPageParam: 0,
1127 getNextPageParam: (_, allPages) => {
1128 return allPages.length === 4 ? undefined : allPages.length
1129 },
1130 })
1131
1132 return null
1133 }
1134
1135 function Page() {
1136 const [show, setShow] = React.useState(true)

Callers

nothing calls this directly

Calls 2

sleepFunction · 0.90
useInfiniteQueryFunction · 0.50

Tested by

no test coverage detected