-
Ok, I'n new to reactQuery and cant wrap my head around this. I have a page that calls this function:
Here is the function:
On the page that calls updateUserSettingsMutation I need to await it to finish before the code continues. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
or use |
Beta Was this translation helpful? Give feedback.
.mutate
doesn't return a Promise because it does error handling for you. you can use either the providedonSuccess
callback on.mutate
to continue:or use
mutateAsync
, which returns aPromise
. But if you usemutateAsync
, please make sure to also handle errors with either.catch
or withtry/catch
in an async function to avoid unhandled promise rejections.