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