T
TanStack3y ago
conscious-sapphire

How to use hooks in react-query global onError handler

Is there any way to use hook in onError handler since the queryClient is outside of a Component? For example how i could open a Modal or a Notification component.
No description
3 Replies
continuing-cyan
continuing-cyan3y ago
move the QueryClient into the component and into react useState
continuing-cyan
continuing-cyan3y ago
useState for one-time initializations
Why you shouldn't rely on useMemo for guaranteed referential stability but prefer useState instead
conscious-sapphire
conscious-sapphireOP3y ago
Oh thank you!! This is very helpful

Did you find this page helpful?