Skip to content
TypeWire

@tahanabavi/typefetch-react

v1.1.0

React adapter for the TypeFetch query engine — useQuery, useMutation, TypeFetchProvider.

useMutation

Returns mutate (fire-and-forget) and mutateAsync (awaitable). No onSuccess refetch and no key — the client's declared relations refetch the watching query for you:

tsx
import { useMutation } from "@tahanabavi/typefetch-react";

function RenameButton({ id }: { id: string }) {
const rename = useMutation(api.modules.user.updateUser);
return (
<button
disabled={rename.isPending}
onClick={() => rename.mutate({ path: { id }, body: { name: "Ada" } })}
>
{rename.isPending ? "saving…" : "rename"}
</button>
);
}

Because the engine is transport-agnostic, the same hook drives a typesocket acked event — useMutation(socket.modules.chat.sendMessage) is just another source, in the same cache.