swr

Cache and revalidate React data fetching with SWR hooks.

246|42|Updated Mar 4, 2026
One-click install
npx skills add https://github.com/vercel/vercel-plugin --skill swr-vercel
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: swr
Source: https://github.com/vercel/vercel-plugin/tree/main/skills/swr
Command: npx skills add https://github.com/vercel/vercel-plugin --skill swr-vercel

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Client-side data fetching in React can be noisy and inefficient; SWR provides a simple hook-based solution with built-in caching and background revalidation to keep UIs up-to-date with minimal boilerplate.

Core Features & Use Cases

  • Caching and revalidation for fast, fresh UI
  • Mutations with optimistic UI and pagination/infinite loading
  • Dedicated hooks: useSWR, useSWRMutation, useSWRInfinite for data workflows

Quick Start

Install swr and start using useSWR to fetch and cache data in your React components.

Frequently Asked Questions about swr

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fetch and cache API data in React?

Fetch and cache API data in React using the useSWR hook, which provides a simple hook-based solution with built-in caching and automatic background revalidation to keep UIs up-to-date efficiently.

What is stale-while-revalidate data fetching in React?

Stale-while-revalidate is a caching strategy where SWR serves cached data immediately for fast initial responses, then fetches fresh API data in the background to automatically update the UI components.

How do I handle optimistic UI and mutations in React?

Handle optimistic UI and mutations in React using the dedicated useSWRMutation hook, which allows you to apply local data updates immediately while synchronizing with API endpoints in the background.

How do I implement paginated or infinite loading in React?

Implement paginated or infinite loading in React using the useSWRInfinite hook, which manages data fetching workflows by automatically requesting and caching additional pages of API data as needed.

Can I configure global settings for React data fetching?

Yes, you can configure global settings for React data fetching using SWRConfig, which allows you to define shared fetchers, revalidation rules, and error handling across all UI components.

Does SWR work without external dependencies?

Yes, SWR operates without external dependencies, allowing you to integrate caching and revalidation directly into React components by installing the standalone package and defining a custom fetcher.