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

Function App

examples/react/basic-graphql-request/src/index.tsx:22–45  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

20}
21
22function App() {
23 const [postId, setPostId] = React.useState(-1)
24
25 return (
26 <QueryClientProvider client={queryClient}>
27 <p>
28 As you visit the posts below, you will notice them in a loading state
29 the first time you load them. However, after you return to this list and
30 click on any posts you have already visited again, you will see them
31 load instantly and background refresh right before your eyes!{' '}
32 <strong>
33 (You may need to throttle your network speed to simulate longer
34 loading sequences)
35 </strong>
36 </p>
37 {postId > -1 ? (
38 <Post postId={postId} setPostId={setPostId} />
39 ) : (
40 <Posts setPostId={setPostId} />
41 )}
42 <ReactQueryDevtools initialIsOpen />
43 </QueryClientProvider>
44 )
45}
46
47function usePosts() {
48 return useQuery({

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected