swr

Installation
SKILL.md

SWR Data Fetching

Basic Usage

import useSWR from 'swr'

const fetcher = (url: string) => fetch(url).then(res => res.json())

function Profile() {
  const { data, error, isLoading } = useSWR('/api/user', fetcher)

  if (isLoading) return <div>Loading...</div>
  if (error) return <div>Error: {error.message}</div>
  return <div>Hello, {data.name}</div>
}

With TypeScript

Installs
Repository
smithery/ai
First Seen
swr — smithery/ai