Skip to content
Discussion options

You must be logged in to vote

Hi 👋

On https://react-query-v3.tanstack.com/guides/queries, what does the fetchTodoList parameter do?

It's the query function and is described above the example:

A function that returns a promise that:

  • Resolves the data, or
  • Throws an error

On https://react-query-v3.tanstack.com/guides/mutations, why is there an axios.post('/todos', newTodo) there? Is react query only for GET requests and not for POST, PUT, and PATCH requests?

It's a POST request because it's a mutation that the POST verb suits best. TanStack Query can be used for any HTTP verb; it's agnostic of the actual network layer. Queries are commonly GET verbs and mutations are commonly anything else, although there's no hard…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by louis-young
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants