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

Function App

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected