Replies: 1 comment
-
you are violating the rules-of-hooks, but it will work as long as the class is only called within a React component, and if its not called conditionally. Try creating a |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This code is an excerpt from my small project.
According to React Hook rules, useQueryClient or useMutation should be called inside a component or another hook, but strangely, calling useQueryClient or useMutation inside a class works without any issues. Has anyone experienced this behavior before, or do you know why this happens?
Also, I use mutationOptions in this way for type safety, but I’m curious why React Query doesn't officially support this pattern.
Beta Was this translation helpful? Give feedback.
All reactions