useSWR For CRUD operation #2021
-
Hi, This is a question before going further with SWR. Is useSWR a right candidate for fetching & updating the data ? Thank you |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Take a look at disabling Revalidate on Focus in the SWR docs if you want to avoid lots data refresh – you could also look at toggling some more settings through the options object (which you can set as global config for all hook calls or pass in to individual hook calls) In terms of other CRUD operations like Think it's been in 2.0 pre-releases since v2.0.0-beta.0 if you want to try it out |
Beta Was this translation helpful? Give feedback.
Take a look at disabling Revalidate on Focus in the SWR docs if you want to avoid lots data refresh – you could also look at toggling some more settings through the options object (which you can set as global config for all hook calls or pass in to individual hook calls)
In terms of other CRUD operations like
POST
andPUT
looks like it's going to be in SWR 2.0 and a new hookuseSWRMutation
was added in #1450Think it's been in 2.0 pre-releases since v2.0.0-beta.0 if you want to try it out