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.
useQuery
is used to query async data,useMutation
is used to mutate it. Or in the traditional CRUD speak:
- Read: useQuery
- Create/Update/Delete: useMutation
https://twitter.com/tannerlinsley/status/1324384797939003393