T
TanStack3y ago
rising-crimson

Use createQuery without Context API?

Hi, is there anyway to use createQuery without using the Context API for fetching the QueryClient to use? I am trying to use createQuery outside the context of a Svelte component to fetch some data. I want createQuery to return a Svelte store like it does today. I just want to pass my own QueryClient instead of relying on Context.
4 Replies
like-gold
like-gold3y ago
Hi @speros , this feature is coming in v5, you can use it now by adding @tanstack/svelte-query@^5.0.0-alpha.43 to your package.json You then add your queryClient as the second param in your functions (e.g. createQuery({...}, queryClient)
rising-crimson
rising-crimsonOP3y ago
Thanks! Is there anywhere I can find out more about the plans for v5? What the proposed changes are, expected release timing, etc?
like-gold
like-gold3y ago
Migrating to TanStack Query v5 | TanStack Query Docs
Breaking Changes v5 is a major version, so there are some breaking changes to be aware of:
like-gold
like-gold3y ago
I've been using the alpha in production without issues!

Did you find this page helpful?