# Usage Examples

### Calling a Convex function from the CLI

```bash
npx convex run myFunctions:myQuery '{"first": 1, "second": "Hello"}'
```

### Calling Convex from a React component (example)

```ts
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>;
}
```