2
votes

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 are for posts that require updating the current state (cache invalidation, etc)

is that the correct assumption?

1

1 Answers

4
votes

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