Replies: 1 comment
-
|
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
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I wonder if it's possible to invalidate
useMutation()
via QueryClient instance?From what I have seen and tested, it looks like it's not designed this way. I was able to invalidate and refresh
useQuery
, however it seems like it does not work the same way foruseMutation()
.By reading documentation, I was able to find out that
useMutation()
is mainly used for create, update and delete, thus is seems why it's not supporting to invalidation/refetching.I am using some library to display data from API in form of table. The best way to connect this library with react-query is to use
useMutation
. I have certain events that occur and at this moment, I would like to refetch query key provided inuseMutation
hook.Some of the blogs on the Internet suggest to use
useQuery
instead, but in this case, I need to have local state with list of parameters to be passed to custom hook which encapsulatesuseQuery
inside. Using custom hook and creating local state from component to component seems to be cumbersome.What is your approach to such problem? Any help/recommendation/useful links would be appreciated.
Beta Was this translation helpful? Give feedback.
All reactions