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
I wanted defaultOptions's onError to work if useLogin didn't recevie an onError callback.
But if it didn't receive the onError, defaultOptions's onError was also not fired.
I think that's why undefined value in the onError option might be overriding the defaultOptions.
My Solution
So I should defaultOptions to onError manually for useMutaion options.
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
Uh oh!
There was an error while loading. Please reload this page.
-
Problem
I'd like to make a custom hook with useMutation that can receive
onError
function.example like below
I also set defaultOptions for mutations.
I wanted defaultOptions's onError to work if
useLogin
didn't recevie an onError callback.But if it didn't receive the onError, defaultOptions's onError was also not fired.
I think that's why
undefined
value in the onError option might be overriding the defaultOptions.My Solution
So I should defaultOptions to onError manually for useMutaion options.
Is it a best solution? or please let me know better approach.
Beta Was this translation helpful? Give feedback.
All reactions