> ## Content Index
> Fetch the complete content index at: https://lucas-schiavini.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# No QueryClient set, use QueryClientProvider to set one [Fix]
- URL: https://lucas-schiavini.com/no-queryclient-set-use-queryclientprovider-to-set-one-fix/
- Published: 2024-02-18T12:41:52.000Z
- Updated: 2024-03-14T22:48:08.000Z
- Description: The Biggo answer
- Author: Lucas Schiavini
- Tags: javascript, nextjs, react-query, react, #Import 2026-08-11 14:49

So I am a big dumb dumb. I have a couple of projects all using react-query, and some using @tanstack/react-query.  
  
On one of those I encountered those errors, and here's the code.  

```javascript
"use client";

import {QueryClient, QueryClientProvider} from "@tanstack/react-query";
import React from "react";

interface RootClientComponentProps {
	children: React.ReactNode;
}

// This makes sure this component and its children are rendered on the client-side
export default function RootClientProvider({ children }: RootClientComponentProps) {
	const queryClient = new QueryClient();

	return <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>;
}

```

And here's where I'm using the `useQuery`.

```javascript
import {useQuery} from "react-query";

const { data } = useQuery({
   queryKey: ["yadayada"],
   queryFn: async () => {
      whatever();
   }
});
```

Notice the error?

It's basically because on one side I'm importing as

``````
import {QueryClient, QueryClientProvider} from "@tanstack/react-query";

```

While the other is:

``````
import {useQuery} from "react-query";

```

If your project uses one or the other, pick one and use it, don't mix two imports. If you're working with the newest version, just import everything from `@tanstack/react-query`.

That is it.

---

Like what you see? Check out my [projects](https://lucas-schiavini.com/projects/) and my [youtube channel](https://www.youtube.com/channel/UCOUBUZrvxtaNsO7hrSL4srw?ref=lucas-schiavini.com), or give me a thanks on [Twitter](https://twitter.com/LucasSchiavini?ref=lucas-schiavini.com).