react-query - What's the difference between useQuery and useMutation hook?

Viewed 6169

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?

2 Answers

The best answer to this query which I found is : UseMutation: is used to create/update/delete data it's also used to re-fetch data. while UseQuery: is used to fetching data credit goes to:https://github.com/Avi98

Related