react-query with axios post #801
-
Use case: I started with SWR and landed on their very minimal (not useful) axios example. Something like that would be a great addition to the react-query docs nonetheless. Anyway, after a long discussion, I finally found out that using SWR is actually not recommended for post calls. I was just wondering if that is the same case with react-query since both libraries seem to work pretty similarly. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 10 replies
-
https://react-query.tanstack.com/docs/guides/mutations#basic-mutations |
Beta Was this translation helpful? Give feedback.
-
@wolverineks I was looking to use useQuery() for a simple post as was done in this example. From what I can tell, useQuery is fine for simple POSTs. Can you give feedback on what kind of cutoff there is from when useQuery would not be advisable and useMutation should be used instead? |
Beta Was this translation helpful? Give feedback.
-
useQuery for reading data
useMutation for creating, changing, or deleting data
Tanner Linsley
…On Sep 29, 2020, 5:18 PM -0600, Kevin Sullivan ***@***.***>, wrote:
useQuery could potentially not execute the request, and therefore not mutate the server state
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Beta Was this translation helpful? Give feedback.
https://react-query.tanstack.com/docs/guides/mutations#basic-mutations