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

Function List

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

Source from the content-addressed store, hash-verified

1130 const initialData = { pages: [1, 2, 3, 4], pageParams: [0, 1, 2, 3] }
1131
1132 function List() {
1133 useInfiniteQuery({
1134 queryKey: key,
1135 queryFn: ({ pageParam }) =>
1136 sleep(50).then(() => {
1137 fetches++
1138 return pageParam * 10
1139 }),
1140 initialData,
1141 initialPageParam: 0,
1142 getNextPageParam: (_, allPages) => {
1143 return allPages.length === 4 ? undefined : allPages.length
1144 },
1145 })
1146
1147 return null
1148 }
1149
1150 function Page() {
1151 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