query
query copied to clipboard
replace custom context with custom queryClient
context
in v4, we introduced the possibility to pass a custom context to all react-query hooks. This allowed for proper isolation when using MicroFrontends. See the migration guide for examples and details.
However, context is a react only feature. All that context does is give us access to the query client. We could achieve the same isolation by allowing to pass in a custom query client instead of a custom context that then serves the query client.
vue-query does have this api already, so it makes sense to streamline it in react as well.
see also:
- https://github.com/TanStack/query/discussions/4360
proposal
- replace custom context param on react hooks with custom queryClient param