slow-yellowS
Refine3y ago
10 replies
slow-yellow

React Query context issue with custom hooks

Hello, I am having a very weird issue with the React Query (now TanStack) Client with Refine. I am trying to leverage the same QueryClient set up by the Refine App context wrapper, so I can call my hooks similar to the useCreate and useList hooks. However, my custom hooks cannot see the context created by the Refine App context wrapper. Whenever the pages render (I am using Next.js routing), the refine hooks work jsut fine but my custom hooks get the following error:

Error: No QueryClient set, use QueryClientProvider to set one


Is there something specific I must do to have access to the QueryClient provided by Refine? I dont want to have 2 ReactQuery clients in my app if I can help it. Thanks.
Was this page helpful?