Files
upstream-mirror 3a013ccdfe
Some checks failed
autofix.ci / autofix (push) Failing after 4s
Release / Release (push) Has been skipped
GitHub Actions Security Analysis / Run zizmor (push) Failing after 2s
snapshot of https://github.com/TanStack/query.git (main, 2026-09-16; blobs > 131072B omitted)
2026-09-16 01:13:08 +05:00

25 lines
463 B
TypeScript

'use client'
import React from 'react'
import { useQuery } from '@tanstack/react-query'
export function ClientComponent() {
const query = useQuery({
queryKey: ['test'],
queryFn: async () => {
await new Promise((r) => setTimeout(r, 1000))
return 'Success'
},
})
if (query.isPending) {
return <div>Loading...</div>
}
if (query.isError) {
return <div>An error has occurred!</div>
}
return <div>{query.data}</div>
}