Unsure about handling error responses with useQuery #1099
-
Hi, I got stuck recently when working with useQuery and trying to handle error responses from Axios. I think I understand what the issue is, but I'm not sure that I fully grok the correct pattern to implement instead. Here was the issue I was having:
that was being used in a components click handler, like so:
So, I think I understand what's happening. react-query doesn't throw as long as the I know that useMutation has the config option So yeah, this isn't a feature request but more of a "what am I missing here and what's the best way of doing this?". Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
useQuery should Never really be used for mutations to the server. Sign out is definitely a mutation. By using useQuery, you’re potentially and probably running the sign out function many times more than expected. |
Beta Was this translation helpful? Give feedback.
useQuery should Never really be used for mutations to the server. Sign out is definitely a mutation. By using useQuery, you’re potentially and probably running the sign out function many times more than expected.