Can I really use useQueryClient outside a component in a normal regular function?
Hi all can I really use useQueryClient outside a component in a normal regular function?
3 Replies
optimistic-gold•3y ago
You can use it inside a hook if that’s what you’re referring too! But not just any function, whenever you call a react hook inside a function, that function becomes a hook itself and must therefore obey the rules of hooks
metropolitan-bronze•3y ago
Hi. What you can still do is pass your queryClient as parameter or through a store to access it outside of React world.
fascinating-indigoOP•3y ago
Very interesting, thanks for the feedback fellows.