()
| 2 | import { useQuery } from '@tanstack/react-query' |
| 3 | |
| 4 | const 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 | |
| 24 | export default App |
nothing calls this directly
no test coverage detected