Replies: 2 comments 3 replies
-
And a related question: How would |
Beta Was this translation helpful? Give feedback.
0 replies
-
I think it should work, the QueryClient is just a vessel that is provided via context. Be aware that with |
Beta Was this translation helpful? Give feedback.
3 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.
-
In the Default Query Function example, the query client is created "outside React" and then injected into the
<QueryClientProvider>
like this:However, I (unfortunately) need to fetch the
baseUrl
for mydefaultQueryFn
from some settings provided to the app. Is it a problem to create theQueryClient
"inside React", and "store" the created client in e.g.useMemo
oruseRef
?Would that work? And how would
react-query
react if thequeryClient
instance was to be recreated? In my case that won't happen, because thebaseUrl
ultimately comes from server-side configuration files, but ifreact-query
would handle it poorly, I suppose it would for example be a bad idea to useuseMemo
in this case since it's not guaranteed to never re-run. 🤔Beta Was this translation helpful? Give feedback.
All reactions