Usage Examples
Calling a Convex function from the CLI
npx convex run myFunctions:myQuery '{"first": 1, "second": "Hello"}'Calling Convex from a React component (example)
import { useQuery } from "convex/react";
import { api } from "@/convex/_generated/api";
export function Example() {
const profile = useQuery(api.users.getUserProfile, { userId: "user_123" });
if (profile === undefined) return <div>Loading…</div>;
if (profile === null) return <div>Not found</div>;
return <div>{profile.name}</div>;
}Source captured: 2026-10-11