type of a TRPC mutation
What is the type of a TRPC mutation if I want to pass it into a component
4 Replies
Just call useMutation in that component?
Why do you need to pass it as a prop?
in general. i agree with @whatplan
but to answer the question:
sometimes it can make sense to have a reusable component that accepts any mutation as a prop, in which case you can use
@tanstack/react-query
s UseMutationResult
typeThanks for replying. I use the same mutation in the parent component as well as in the child. Seems inefficient to repeat oneself.
typescript seems to accept that - thank you 🙂