trpc giving me a hooks error?
when a button is pressed im getting a hooks error, i think because im using this function as a consequence of the button press. What is the correct way to call this?


5 Replies
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Rules of Hooks – React
A JavaScript library for building user interfaces
useMutation is a hook and can only be called in a function component as the error said. You need to do something like this
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
aaah, thanks people, that makes sense ❤️