Variable: useSWR
constuseSWR:SWRHook
Defined in: node_modules/swr/dist/index/index.d.ts:28
A hook to fetch data.
Link
Example
import useSWR from 'swr'
function Profile() {
const { data, error, isLoading } = useSWR('/api/user', fetcher)
if (error) return <div>failed to load</div>
if (isLoading) return <div>loading...</div>
return <div>hello {data.name}!</div>
}