Skip to content

Commit

Permalink
Fix README.md typo
Browse files Browse the repository at this point in the history
'/api/data' => '/api/user' in "Multiple Arguments"
  • Loading branch information
mingcenwei authored Nov 22, 2020
1 parent 5e48f4b commit 99725c2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ In some scenarios, it's useful to pass multiple arguments (can be any value or o
useSWR('/api/user', url => fetchWithToken(url, token))
```

This is **incorrect**. Because the identifier (also the index of the cache) of the data is `'/api/data'`,
This is **incorrect**. Because the identifier (also the index of the cache) of the data is `'/api/user'`,
so even if `token` changes, SWR will still have the same key and return the wrong data.

Instead, you can use an **array** as the `key` parameter, which contains multiple arguments of `fetcher`:
Expand Down

0 comments on commit 99725c2

Please sign in to comment.