Skip to content

Commit 3121592

Browse files
authored
Update default fetcher documentation in README.md (#891)
Ran into issues with this when using SWR for local state sharing. It seems that the default value for the fetcher is actually `window.fetch` and not `undefined`: https://github.com/vercel/swr/blob/00c5847ce6e95902920933aa1d49c7143f8ce4ba/src/config.ts#L71
1 parent 96dadd8 commit 3121592

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ const { data, error, isValidating, mutate } = useSWR(key, fetcher, options)
113113
#### Options
114114

115115
- `suspense = false`: enable React Suspense mode [(details)](#suspense-mode)
116-
- `fetcher = undefined`: the default fetcher function
116+
- `fetcher = window.fetch`: the default fetcher function
117117
- `initialData`: initial data to be returned (note: This is per-hook)
118118
- `revalidateOnMount`: enable or disable automatic revalidation when component is mounted (by default revalidation occurs on mount when initialData is not set, use this flag to force behavior)
119119
- `revalidateOnFocus = true`: auto revalidate when window gets focused

0 commit comments

Comments
 (0)