Isn't getQueryData/getQueryState reactive? #2523
Unanswered
chandru89new
asked this question in
Q&A
Replies: 1 comment 7 replies
-
no, they don't create a subscription or re-render your component, they will just give you the data "once". If you want a subscription - that is what |
Beta Was this translation helpful? Give feedback.
7 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've been using getQueryData/getQueryState to fetch cache in a Nextjs project and they pretty much work like reactive elements. So when cache is updated, the components using getQueryData/State update with the latest.
However, I tried to replicate the same thing with a simple one-page codebase for a demo but it doesnt work.
Here's the code: https://codesandbox.io/s/gracious-lake-l0ddr
I am trying to load todos and "view" at almost the beginning of the app through component and then trying to fetch the cached data of todos and view through getQueryData. But this doesnt work at all - even though ReactQuery Dev Tools indicates that the local cache of todos and view is updated.
I wonder what I'm doing wrong here and why in the Nextjs project, getQueryData seems to work like a reactive thing.
Beta Was this translation helpful? Give feedback.
All reactions