#Why am I able to only send one arguement to mutation function?

12 messages ยท Page 1 of 1 (latest)

kind valley
#

I'm currently working with the useMutation hook, and I'm encountering an issue. My mutation function expects two arguments, but when I use .mutate(firstArg, secondArg), only the first argument is being passed to my mutation function.

kind valley
#

Why am I able to only send one arguement to mutation function?

tepid spindle
#

I forget the reasoning behind it but you need to pass your variables as one object: deleteSessionMutation.mutate({ sessionId, userId }) and change your deleteSession function to deconstruct them: deleteSession = async ({ sessionId, userId }) => {...}

kind valley
#

ok thanks, thats so weird tho

final smelt
#

because the second argument is an object that has (additional) callbacks

native moon
kind valley
#

Appreciate the hlep and pointing me to documentation

tepid spindle
#

I've come to learn if I have a question Dominik either already documented it or wrote a blog about it lol

final smelt
#

can I tweet this ๐Ÿ˜‚ ?

tepid spindle
#

Haha sure

final smelt
#

can obfuscate your handle if you want

#

or mention you on twitter ๐Ÿ˜‚