Error: No QueryClient set, use QueryClientProvider to set one
I have a library where I am using react query and that library I am consuming in my app. I have set the query client in my app but it gives me error that no queryClient has been set
useGetFeaturePermission is in my library

10 Replies
harsh-harlequin•3y ago
What's your setup? Monorepo? This usually indicates you have two versions of react-query installed somehow
vicious-goldOP•3y ago
I have two repos in my setup and 2nd repo is indirectly consuming the 1st. I have react-query in my 2nd repo and in my app these repos are being used and the error is coming in my app ( app is directly consuming both the repos ).
harsh-harlequin•3y ago
How have you setup dependencies / peerDependencies? Which tool do you use to bundle the 1st repo?
vicious-goldOP•3y ago
I have setup manually
harsh-harlequin•3y ago
well then there is something wrong with your setup
vicious-goldOP•3y ago
@TkDodo 🔮 Hey I have used rollup to bundle the repo
foreign-sapphire•3y ago
@Jay Shrivastava Did you ever figure this out? Using rollup to bundle the repo fixed this for you? Currently having the same error in a really similar setup of my own
If I figure it out I'll post here of course 😄
vicious-goldOP•3y ago
not yet but trying
thanks 👍
foreign-sapphire•3y ago
@Jay Shrivastava Management ended up getting pissed at me for taking so long on this feature, so I abandoned the approach for now, and just will pass props between the applications 😅 . However looking at other messages on here I found a few solutions that looked promising if I had time to try them:
1) Moved ClientQueryProvider component to a higher level and it worked for this person: https://discord.com/channels/719702312431386674/1070665041206071298/1070717730820476968
2) Switched from babel to typescript and it worked for this person: https://discord.com/channels/719702312431386674/1061632155345748060/1081082882233212938
extended-salmon•3y ago
For me it worked to delete "react-query" from package.json, somehow had installed it alongside "@tanstack/*"