Skip to content

mutationFn not found.  #64

@dev-seahouse

Description

@dev-seahouse

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".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions