()
| 12 | const queryClient = new QueryClient() |
| 13 | |
| 14 | function App() { |
| 15 | const [postId, setPostId] = React.useState<string | null>(null) |
| 16 | |
| 17 | return ( |
| 18 | <QueryClientProvider client={queryClient}> |
| 19 | <p> |
| 20 | As you visit the posts below, you will notice them in a loading state |
| 21 | the first time you load them. However, after you return to this list and |
| 22 | click on any posts you have already visited again, you will see them |
| 23 | load instantly and background refresh right before your eyes!{' '} |
| 24 | <strong> |
| 25 | (You may need to throttle your network speed to simulate longer |
| 26 | loading sequences) |
| 27 | </strong> |
| 28 | </p> |
| 29 | {postId !== null ? ( |
| 30 | <Post postId={postId} setPostId={setPostId} /> |
| 31 | ) : ( |
| 32 | <Posts setPostId={setPostId} /> |
| 33 | )} |
| 34 | <ReactQueryDevtools initialIsOpen /> |
| 35 | </QueryClientProvider> |
| 36 | ) |
| 37 | } |
| 38 | |
| 39 | function Posts({ |
| 40 | setPostId, |
nothing calls this directly
no outgoing calls
no test coverage detected