> ## Documentation Index
> Fetch the complete documentation index at: https://dev.moonpay.com/llms.txt
> Use this file to discover all available pages before exploring further.

# useMoonPay()

> Read the SDK client from any component below the provider.

`useMoonPay()` returns the SDK client made available by [`<MoonPayProvider>`](/platform/sdk-reference/react-native/provider). Call it from any function component below the provider to access integration methods.

```tsx ConnectScreen.tsx theme={null}
import { useMoonPay } from "@moonpay/platform-sdk-react-native";

export function ConnectScreen() {
  const { client } = useMoonPay();

  const handleConnect = async () => {
    const result = await client.getConnection();
    if (!result.ok) {
      console.error(result.error.message);
      return;
    }
    console.log(result.value);
  };

  // ...
}
```

***

## Return value

`useMoonPay()` returns an object with a single `client` property. The client exposes every integration method — see the [`MoonPayProvider`](/platform/sdk-reference/react-native/provider#client-methods) reference for the full list.

| Field    | Type     | Required | Description                                           |
| -------- | -------- | -------- | ----------------------------------------------------- |
| `client` | `object` | ✅        | The SDK client used to call MoonPay Platform methods. |

## Errors

`useMoonPay()` throws if called outside a `<MoonPayProvider>`:

```
useMoonPay must be used within a <MoonPayProvider>
```

Mount the provider higher in the tree, or call the hook from a child of the provider.
