Question about using React Query as a global store #9600
Unanswered
Vittor-Emanoel
asked this question in
General
Replies: 1 comment
-
My answer to this is always that it’s not a good idea and that this is not what react-query was made for and that you’re probably missing a bunch of settings to make this better. For example, you haven’t customized garbage collection... I’m talking about this here: |
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.
-
Hi team,
We’re currently using React Query as a sort of client-side store or global state in our application. Here’s a simplified example:
We then update the state via
setQueryData
. Sometimes, developers also attach thequeryClient
to thewindow
object to update the cache globally.My questions are:
Our supervisor believes this approach is fine, but I wanted to confirm best practices with the community.
Beta Was this translation helpful? Give feedback.
All reactions