Creating an update mutation with tRPC
Hi everyone, I'm trying to use an update mutation in this way:
But when trying to call it here:
I get squiggly lines under
id: myId
saying the following:
It seemed to me that I was supposed to use the useMutation in the same way as UseQuery, but this does not seem to work. Anyone know how this is supposed to be done? My apologies if this is a nooby question, I am quite new to web development1 Reply
Hey!
What you're trying to do is to call the
useMutation
hook itself from inside of a function, and inside your submit function call the mutate
property in order to execute your mutation.
Here is an example of how it should look like: