State Management · Junior · Question 42 of 75

How do you send a POST request (create an item) with TanStack Query?

Explanation

Queries read data, mutations change it. const { mutate, isPending } = useMutation({ mutationFn: createTodo }). After success, related queries are usually invalidated so the list refetches.

Further reading

Problem with a question

State Management · Junior · question 42

Test yourself

Take the State Management · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz