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

Function App

examples/react/default-query-function/src/index.tsx:36–59  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

34})
35
36function App() {
37 const [postId, setPostId] = React.useState(-1)
38
39 return (
40 <QueryClientProvider client={queryClient}>
41 <p>
42 As you visit the posts below, you will notice them in a loading state
43 the first time you load them. However, after you return to this list and
44 click on any posts you have already visited again, you will see them
45 load instantly and background refresh right before your eyes!{' '}
46 <strong>
47 (You may need to throttle your network speed to simulate longer
48 loading sequences)
49 </strong>
50 </p>
51 {postId > -1 ? (
52 <Post postId={postId} setPostId={setPostId} />
53 ) : (
54 <Posts setPostId={setPostId} />
55 )}
56 <ReactQueryDevtools initialIsOpen />
57 </QueryClientProvider>
58 )
59}
60
61function Posts({
62 setPostId,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected