Open
Description
const usePost = createQuery({ queryKey: ["posts"], fetcher: (variables: Variables): Promise<Data> => { return fetch(
/posts/${variables.id}`).then((res) => res.json());
},
// u can also pass middleware to cutomize this hook's behavior
});
const useAddTodo = createMutation({
mutationFn: async (variables: { title: string; content: string }) =>
fetch("/post", {
method: "POST",
body: JSON.stringify(variables),
}).then((res) => res.json()),
});
`
mutationFn throws type error with "@tanstack/react-query": "^5.51.11".
Metadata
Metadata
Assignees
Labels
No labels