usegetidentity issue in App.tsx
when I am introducing :
type IUser = {
id: number;
name: string;
role: string;
avatar: string;
};
function App() {
const { data: user } = useGetIdentity<IUser>();
I get the following error:
Uncaught Error: No QueryClient set, use QueryClientProvider to set one
which is surprising since App is correctly wrapped in the index.tsx with QueryClient
2 Replies
Hi @sarsar55.. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
The
useGetIdentity
hook is part of the Refine framework and is used to get the current user's identity. It calls the getIdentity
method from the authProvider
under the hood and returns the result of react-query
's useQuery
[^1^].
The error message you're seeing suggests that there's no QueryClient
set. This is a requirement for using react-query
hooks, including useGetIdentity
.
In your case, you mentioned that your App
is correctly wrapped with QueryClient
in index.tsx
. However, without seeing the actual code, it's hard to pinpoint the exact issue.
Ensure that your QueryClientProvider
is correctly set up and wraps your entire app component. Here's an example of how it should look:
If you're still facing issues, it might be a good idea to check the official Refine documentation or seek help from the community on GitHub or other platforms.
^1^]: [Refine Documentation - useGetIdentity (https://refine.dev/docs/authentication/hooks/use-get-identity)
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@791625518440120320> kapa.ai is still learning and improving, please let us know how it did by reacting below