Replies: 1 comment
-
|
as long as |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I was just looking in more depth at some of the modern React API functionality, and the behavior of the newer
usefunction in conjunction with theSuspensecomponent has me thinking that it would be possible to eliminate the hook aspect of TanStack Query, assuming you don't needonErrorandonSuccesscallbacks.You could still define your
QueryClientinstance and store it in theQueryClientProvider, but instead of needinguseContextto get the client, theusefunction could be used -- and even better, it can be called from anywhere within a component. Similarly, data fetches can just happen directly against API services, and as long as those fetches return aPromise, you can simply notawaitthe promise like you normally might withinqueryFn, instead accessing it viause, which would be nested under aSuspenseblock.This might already be possible with
ensureQueryor something similar.Beta Was this translation helpful? Give feedback.
All reactions