Replies: 1 comment
-
Even I have the similar scenario where, I need to fetch data based on input. Its a GET request, and is made first time not on mount of the component, but while the interaction. So is it fine to go with useMutation when you want to make network call to fetch resource when the component is already mounted. |
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 send a POST request to "fetch" data from an API, as GET doesn't support request body, which means I have to use useMutation to send the POST request. I can't use useQuery to send the request and save the response data in the queryCache.
What I have tried is, I manually saved it in the queryCache on success using queryCache.setQueryData(). But the data in the cache seems to be inactive always rather than being stale.
Is there a conventional way for handling this scenario? What if I want to refetch it periodically?
Beta Was this translation helpful? Give feedback.
All reactions