Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mutationFn not found. #64

Open
dev-seahouse opened this issue Jul 22, 2024 · 1 comment
Open

mutationFn not found. #64

dev-seahouse opened this issue Jul 22, 2024 · 1 comment

Comments

@dev-seahouse
Copy link

Screenshot 2024-07-22 at 2 38 54 PM
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".

@liaoliao666
Copy link
Collaborator

Can you provide me a codesanbox example? I can not reproduce this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants