useMutation where no variables are required #3974
Unanswered
danieljmann96
asked this question in
Q&A
Replies: 2 comments 2 replies
-
works fine for me as variables are inferred to |
Beta Was this translation helpful? Give feedback.
0 replies
-
@TkDodo If you want to use the onSuccess/onError callbacks, it seems like you have to pass undefined to mutate(). Do you know if there's a way to avoid that? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I've been using react-query for a while now and I'm loving it!
One (very) small issue I have with useMutation is the need to pass it an empty object even when the mutation function doesn't have any params, at least for TypeScript anyway. My use case is I have a booking app, and there is a function that just permanently deletes anything soft deleted longer than 2 weeks ago. This requires no parameters. This is currently what I'm doing:
The below would be preferable but gives a type error, as the "args" parameter is required in "mutate"
What is the best practice for doing mutations without parameters?
Beta Was this translation helpful? Give feedback.
All reactions