---
title: "client swr dedup"
description: "SWR enables request deduplication, caching, and revalidation across component instances."
type: skill
canonical_url: https://claudary.paisolsolutions.com/skills/client-swr-dedup
source: "Claudary"
difficulty: intermediate
author: "Claude Code Knowledge Pack"
date: 2026-07-10T11:14:05.443Z
license: CC-BY-4.0
attribution: "client swr dedup — Claudary (https://claudary.paisolsolutions.com/skills/client-swr-dedup)"
---

# client swr dedup
SWR enables request deduplication, caching, and revalidation across component instances.

## Overview

---
title: Use SWR for Automatic Deduplication
impact: MEDIUM-HIGH
impactDescription: automatic deduplication
tags: client, swr, deduplication, data-fetching
---

## Use SWR for Automatic Deduplication

SWR enables request deduplication, caching, and revalidation across component instances.

**Incorrect (no deduplication, each instance fetches):**

```tsx
function UserList() {
  const [users, setUsers] = useState([])
  useEffect(() => {
    fetch('/api/users')
      .then(r => r.json())
      .then(setUsers)
  }, [])
}
```

**Correct (multiple instances share one request):**

```tsx
import useSWR from 'swr'

function UserList() {
  const { data: users } = useSWR('/api/users', fetcher)
}
```

**For immutable data:**

```tsx
import { useImmutableSWR } from '@/lib/swr'

function StaticContent() {
  const { data } = useImmutableSWR('/api/config', fetcher)
}
```

**For mutations:**

```tsx
import { useSWRMutation } from 'swr/mutation'

function UpdateButton() {
  const { trigger } = useSWRMutation('/api/user', updateUser)
  return <button onClick={() => trigger()}>Update</button>
}
```

Reference: [https://swr.vercel.app](https://swr.vercel.app)

---

Source: [Claudary](https://claudary.paisolsolutions.com/skills/client-swr-dedup) · https://claudary.paisolsolutions.com
