MCPcopy Index your code
hub / github.com/TanStack/query / getStaticProps

Function getStaticProps

examples/react/nextjs/src/pages/index.tsx:16–29  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

14}
15
16export async function getStaticProps() {
17 const queryClient = new QueryClient()
18
19 await queryClient.prefetchQuery({
20 queryKey: ['posts', 10],
21 queryFn: () => fetchPosts(10),
22 })
23
24 return {
25 props: {
26 dehydratedState: dehydrate(queryClient),
27 },
28 }
29}
30
31export default Home

Callers

nothing calls this directly

Calls 3

prefetchQueryMethod · 0.95
fetchPostsFunction · 0.90
dehydrateFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…