What is the default Fetcher function? #910
-
I started reading the documentation of SWR and I discovered that exists an optional param to useSwr called fetcher (a function to fetch data). If I just pass the key to useSwr and don't pass a fetcher, what function or code will be executed to fetch the data?
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
https://swr.vercel.app/docs/options#options fetcher = window.fetch(url).then(res => res.json()) |
Beta Was this translation helpful? Give feedback.
-
This is no longner the case since SWR 1.0. The default fetcher function is now |
Beta Was this translation helpful? Give feedback.
https://swr.vercel.app/docs/options#options