Is it considered acceptable to directly access cached data using queryClient.getQueryData within a React component? #6239
Unanswered
shehan-sandaruwan
asked this question in
Q&A
Replies: 2 comments
-
Would this help? |
Beta Was this translation helpful? Give feedback.
0 replies
-
you always want |
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'm actively involved in a React project that utilizes react-query, and I've encountered a situation where I must update real-time data obtained via a WebSocket connection. Since we've opted not to use a state management library like Redux, we're leveraging the capabilities provided by react-query.
My approach involves directly updating the query cache when WebSocket data arrives. My primary concern is whether it's considered acceptable to access query cache data directly within a React component. This allows me to trigger component re-renders and present the user with the most up-to-date information.
Beta Was this translation helpful? Give feedback.
All reactions