
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeAdd 'use client' at the very top of your component file (before any imports):
'use client'
import Image from 'next/image'
// ... other imports
export default function YourComponent() {
// your component code with onClick handlers
}Why This Happens:
In Next.js 13+ with the App Router, all components are React Server Components by default. Server Components render on the server and can't include interactive JavaScript like event handlers (onClick, onChange, etc.).
When you add 'use client' at the top of the file, you're telling Next.js to treat this as a Client Component, which runs in the browser and can handle user interactions.
Best Practice:
If you're working with Sanity and Next.js, you typically want to:
'use client')'use client' only to components that need interactivity (buttons, forms, state management)For your specific code, since you have onClick handlers for connectWallet() and disconnectWallet(), the entire component needs to be a Client Component, so add 'use client' at the top of the file.
This is a common gotcha when you're new to Next.js 13+ and the App Router. The 'use client' directive is how you opt into client-side interactivity!
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store