Getting type error when using string to invalidate queries
Hey,
I am following the invalidation query docs to invalidate all queries with the term
rates as the first element in the query key array by using
I am using the useQueryClient hook to get the queryClient.
This clears the queries I want to clear, but I am getting a type error when I use the string:
if I try putting it in an array:
the type error goes away but the query invalidation does not work. How can i fix this? Thanks3 Replies
xenophobic-harlequin•3y ago
queryKeys need to be arrays
other-emeraldOP•3y ago
Hey. Why would the plain string clear the query but not the array though?
xenophobic-harlequin•3y ago
invalidation doesn't "clear". It's best if you'd show a codesandbox reproduction