snapshot of https://github.com/TanStack/query.git (main, 2026-09-16; blobs > 131072B omitted)
This commit is contained in:
24
integrations/react-next-14/app/client-component.tsx
Normal file
24
integrations/react-next-14/app/client-component.tsx
Normal file
@@ -0,0 +1,24 @@
|
||||
'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>
|
||||
}
|
||||
Reference in New Issue
Block a user