react-use-client-boundary

Guide placement of the "use client" directive in Next.js React Server Components.

Updated Apr 26, 2026
One-click install
npx skills add https://github.com/suwandre/my-opencode-config --skill react-use-client-boundary-suwandre
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: react-use-client-boundary
Source: https://github.com/suwandre/my-opencode-config/tree/main/skills/react-use-client-boundary
Command: npx skills add https://github.com/suwandre/my-opencode-config --skill react-use-client-boundary-suwandre

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill clarifies when and how to apply the "use client" directive to establish correct client boundaries within React Server Components in Next.js, preventing unnecessary client boundaries and runtime errors.

Core Features & Use Cases

  • Clear rules for placing "use client" at the boundaries between server and client components.
  • Guidance on when to avoid adding directives to nested components and how to minimize client boundaries for performance.
  • Real-world scenarios showing how to convert server components into client components safely and how to reason about partial hydration.

Quick Start

Determine the correct boundary by adding "use client" at the top-level client components and avoid placing it on pure-presentational children.

Frequently Asked Questions about react-use-client-boundary

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
When should I use the "use client" directive in Next.js server components?

Apply the "use client" directive at the top-level boundary when a component requires client interactivity, state, or partial hydration. Place it at the highest necessary level and avoid adding it to pure-presentational children to minimize client boundaries and maintain performance.

How do I safely convert a Next.js server component to a client component?

To convert a server component into a client component, add the "use client" directive at the top of the file. Ensure you enforce clear client boundaries by keeping nested children as server components when possible to avoid redundant directives and runtime errors.

What happens if I add the "use client" directive to nested components in React?

Adding the directive to nested components creates unnecessary client boundaries, increasing the client bundle size. You should avoid placing it on pure-presentational children and instead apply it only at the top-level interactive boundary to optimize performance.

Does React state management require a "use client" boundary in Next.js?

Yes, implementing stateful logic requires a client boundary. You must define the interactive component with the "use client" directive to enable state management and partial hydration within the Next.js server component architecture.

Why does my Next.js component throw a runtime error without the "use client" directive?

Runtime errors occur when interactive features like state or event handlers are used in server components. Adding the "use client" directive establishes the correct boundary, enabling client-side hydration and resolving these server component boundary errors.