tRPC useQuery() or useMutation()
I have a component with a form containing a question about a secret name.
When submitting that form I want to validate that the user sent the correct secret name. What should I use? (the name will be in my environment variables)
Im currently trying to implement it with useMutation(). Is this the correct method to use?
This is what I have so far:
its currently working, but i cant f.ex do
console.log(res.result)
I then get an error Cannot read properties of undefined. This is the procedure code: 2 Replies
The first part isn't really the best...
Do this instead
mutations are async, so you would need to await the response
and RQ lets you can define callback functions for such events, like in the example above onSuccess and onError
you have many more, as well as additional config you can check out in the docs
Alright I try it out. Using mutation is ok tho?