Replies: 1 comment
-
apart from the obvious "why would you invalidate in an effect" question, I see two soluions:
|
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
-
We use wrapped versions of
useQuery
in many cases.Wrapped ones let us use react-query in an easier way, preventing us from writing invalid query keys, etc.
At the same time, they make the query key invisible and it causes a small problem.
There is no way to get the query key of
usePets({ id: 1 })
until we discover the definition of that custom hook.My suggestion is to add
queryKey
property touseQuery
's return value. Then we can get the query key like below.Beta Was this translation helpful? Give feedback.
All reactions