-
Hi, In the case of a custom hook that needs to update the cache, what is the recommended way of accessing the
Thanks in advance, and thanks to all for the great work 👍 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
since you have to have a |
Beta Was this translation helpful? Give feedback.
since you have to have a
QueryCientProvider
at the top of your react tree with v3,useQueryClient
will give you that cache. The direct import is only recommended for when you can't use the hook. So unless you need that, I wouldn't even export the client and always retrieve it via the hook. This will make testing easier because you can just wrap your tests with a different Provider and it will just work™️