# Next.js support

```typescript
"use client";

export default function Home() {
  const handleConnect = async () => {
    const { AddressPurpose, default: wallet } = await import("sats-connect");
    const response = await wallet.request("getAccounts", {
      purposes: [AddressPurpose.Stacks, AddressPurpose.Payment],
    });
    console.log(response);
  };
}
```

Alternatively, if `sats-connect` is being used in a single component, the component should be imported using `dynamic`:

```typescript
const MyComponentUsingSatsConnect = dynamic(
  () => import("@/components/MyComponentUsingSatsConnect"),
  {
    ssr: false,
  }
);
```

If you don't need the wallet selector UI packaged with Sats Connect, you can use the equivalent methods directly from `@sats-connect/core` without needing to load it dynamically.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.xverse.app/sats-connect/guides/next.js-support.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
