Replies: 2 comments 1 reply
-
could you provide a working example on codesandbox.io? |
Beta Was this translation helpful? Give feedback.
-
Sorry for the delay. Here is a working example: In the
Another option to handle this issue is like here: Any thoughts? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
One issue that really bothers me - How can I sync data which saved on the cache of react-query with some other UI state management library (like Redux)?
For example -
I'm fetching from the server a list of ids (in a hook called
useIds
).On the first fetch only (of the same query key) I would like to save the first id on redux reducer (as
selectedId
) in order to change it in the future.Of course, I can write a simple
useEffect
which syncing the data and updating the state but I may use this custom hook (useIds
) in a lot of places and I'm feeling a bit uncomfortable to put thisuseEffect
in all places.Do you have any thoughts on how to do it right?
Beta Was this translation helpful? Give feedback.
All reactions