System Information
- Strapi Version: 4.10.7:
- Operating System: macos 13.4:
- Database: sqlite:
- Node Version: v18.16.1:
- NPM Version: 9.5.1:
- Yarn Version: 1.22.19:
Hello everyone,
I am currently developing a custom plugin for Strapi and am trying to integrate @tanstack/react-query to manage data queries within my components. Unfortunately, I am encountering an issue that is halting my progress.
I have wrapped my App component in a QueryClientProvider as shown below:
const App = () => {
const queryClient = new QueryClient();
return (
<QueryClientProvider client={queryClient}>
{/* ... */}
</QueryClientProvider>
);
};
And I am using the useQuery hook in my HomePage component:
const HomePage = () => {
const { get } = useFetchClient();
const queryClient = useQueryClient();
const { data: response, error, status } = useQuery({/* ... */});
// ...
};
Despite this, I am continually receiving the following error when running my application:
Error: No QueryClient set, use QueryClientProvider to set one
I have double-checked that my HomePage component is indeed a child of App and thus should have access to the context provided by QueryClientProvider.
I am open to any suggestions or advice that might help me resolve this issue. If anyone has encountered and overcome this issue before, your help would be greatly appreciated.
Thank you in advance for your time and assistance.