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

Function App

integrations/react-vite/src/App.jsx:4–22  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2import { useQuery } from '@tanstack/react-query'
3
4const App = () => {
5 const query = useQuery({
6 queryKey: ['test'],
7 queryFn: async () => {
8 await new Promise((r) => setTimeout(r, 1000))
9 return 'Success'
10 },
11 })
12
13 if (query.isPending) {
14 return <div>Loading...</div>
15 }
16
17 if (query.isError) {
18 return <div>An error has occurred!</div>
19 }
20
21 return <div>{query.data}</div>
22}
23
24export default App

Callers

nothing calls this directly

Calls 1

useQueryFunction · 0.90

Tested by

no test coverage detected