/Knowledge/sources/honojs__hono/llms-full/rpc-using-swr--e0710388ce31.md
RPC: Using SWR - hono-docs
RPC: Using SWR Source evidence: /Sources/honojs hono/provenance.md Canonical citation: https://hono.dev/llms full.txt using swr Summary You can also use a Re...
RPC: Using SWR
Source evidence: /Sources/honojs__hono/provenance.md Canonical citation: https://hono.dev/llms-full.txt#using-swr
Summary
You can also use a React Hook library such as SWR. ```tsx import useSWR from 'swr' import { hc } from 'hono/client' import type { InferRequestType } from 'hono/client' import type { AppType } from '../functions/...
Content
You can also use a React Hook library such as SWR.
import useSWR from 'swr'
import { hc } from 'hono/client'
import type { InferRequestType } from 'hono/client'
import type { AppType } from '../functions/api/[[route]]'
const App = () => {
const client = hc<AppType>('/api')
const $get = client.hello.$get
const fetcher =
(arg: InferRequestType<typeof $get>) => async () => {
const res = await $get(arg)
return await res.json()
}
const { data, error, isLoading } = useSWR(
'api-hello',
fetcher({
query: {
name: 'SWR',
},
})
)
if (error) return <div>failed to load</div>
if (isLoading) return <div>loading...</div>
return <h1>{data?.message}</h1>
}
export default App
Metadata
{
"chunk_index": 0,
"citation": "https://hono.dev/llms-full.txt#using-swr",
"coverage_role": "overview",
"qualified_title": "Hono / llms-full / RPC > Using SWR",
"retrieved_at": "2026-07-02T05:51:01Z",
"section_index": 66,
"source_id": "/honojs/hono",
"source_type": "llms_full",
"target_label": "llms-full",
"title": "RPC: Using SWR",
"upstream_url": "https://hono.dev/llms-full.txt",
"version": "2026"
}