QueryClientProvider v5 context
Hey I'm reading the migrating to v5 docs: https://tanstack.com/query/latest/docs/framework/react/guides/migrating-to-v5
Under the header "The contextSharing prop has been removed from QueryClientProvider"
https://tanstack.com/query/latest/docs/framework/react/guides/migrating-to-v5#the-contextsharing-prop-has-been-removed-from-queryclientprovider
It recommends using the context property for sharing the query client across packages/apps:
If you wish to use the same query client across multiple packages of an application, you can create a QueryClient in your application and then let the bundles share this through the context property of the QueryClientProvider.
context was removed from the QueryClientProvider in v5 as well though?
No context on latest v5+:
https://tanstack.com/query/latest/docs/framework/react/reference/QueryClientProvider#queryclientprovider
context on v4:
https://tanstack.com/query/v4/docs/framework/react/reference/QueryClientProvider
Migrating to TanStack Query v5 | TanStack Query React Docs
Breaking Changes
v5 is a major version, so there are some breaking changes to be aware of:
QueryClientProvider | TanStack Query React Docs
Use the QueryClientProvider component to connect and provide a QueryClient to your application:
`tsx
QueryClientProvider | TanStack Query React Docs
Use the QueryClientProvider component to connect and provide a QueryClient to your application:
`tsx
3 Replies
adverse-sapphire•16mo ago
yes, sorry, custom context was replaced with custom queryClient to be react agnostic: https://tanstack.com/query/latest/docs/framework/react/guides/migrating-to-v5#removed-custom-context-prop-in-favor-of-custom-queryclient-instance
Migrating to TanStack Query v5 | TanStack Query React Docs
Breaking Changes
v5 is a major version, so there are some breaking changes to be aware of:
adverse-sapphire•16mo ago
I think we wrote the contextSharing removal first so the migration docs are not up-to-date. Please file a PR if you can 🙏
adverse-sapphireOP•16mo ago