ian
ian•9mo ago

Why is the useQuery from "convex-helpers/react" named the same

I just added a long-requested helper: a useQuery that matches the TanStack Query return type:
import { useQuery } from "convex-helpers/react";

const { status, data, error } = useQuery(api.foo.bar, args);
import { useQuery } from "convex-helpers/react";

const { status, data, error } = useQuery(api.foo.bar, args);
also with booleans if you prefer:
const { data, error, isSuccess, isPending, isError } = useQuery(api.foo.bar, args);
const { data, error, isSuccess, isPending, isError } = useQuery(api.foo.bar, args);
Available in convex-helpers@0.1.40
3 Replies
Matt Luo
Matt Luo•9mo ago
Why is the useQuery from "convex-helpers/react" named the same as the one from the official 'convex/react' package? Is the idea that in the future - the product will take on the functionality of the useQuery from convex-helpers, - and the future code change in the app will just be an import change?
ian
ianOP•9mo ago
The motivation was just aesthetics, to match tRPC / React Query / TanStack Query. My guess is that folks who use it will prefer it in all call-sites so there won't be a lot of import collisions. I went back & forth on other names, but nothing felt right. It's a bit sub-optimal for auto-import and LLM comprehension, I'll admit
Matt Luo
Matt Luo•9mo ago
useRichQuery almost had its moment 💸

Did you find this page helpful?