You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
The way
useSWRMutation
works makes it impossible to have properly typed conditional usages.Take a REST endpoint:
PUT books/:id
.If I wanted to create a reusable hook to update a book I have to do this:
This means I can't use
useUpdateBookMutation
when I don't have an id always present.If the
useSWRMutation
interface allowed to pass the url parameter as part of the trigger callback though, this would be trivial.Is this impossible to achieve with SWR or am I missing something obvious?
Beta Was this translation helpful? Give feedback.
All reactions