Multiple QueryClientProvider
Is creating multiple QueryClientProvider in the same application bad?
The requests are being made to the same backend, but some pages want a different refetch interval.
is it a bad practice to have multiple QueryClientProviders? Should I pass the config to the useQuery direct?
1 Reply
fair-rose•3y ago
The refetch interval is configured inside the queryClient itself so I assume you also have multiple
queryClient instances?
Having multiple QueryClientProvider is fine (I think as long as they are not nested) if they share the same queryClient instance. But if you have multiple queryClient instances, then the cache is duplicated and not shared.
If the only issue is having different refetch intervals, I would configure that in useQuery.