Trying to find an answer regarding react-query.
What's the difference between useQuery and useMutation?
From what I understand, useQuery's are dependent calls.
useMutation is for posts that require updating the current state (cache invalidation, etc.)
Is that the correct assumption?
From Tanner Linsley:
The difference is the flow of data.
useQueryis used to query async data,useMutationis used to mutate it. Or in the traditional CRUD speak:
- Read: useQuery
- Create/Update/Delete: useMutation
https://twitter.com/tannerlinsley/status/1324384797939003393
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With