react-use-client-boundary

Guides correct placement of the "use client" directive in React Server Components.

Updated Apr 29, 2026
One-click install
npx skills add https://github.com/dev-khoi/AURA-conHack-2026 --skill react-use-client-boundary-dev-khoi
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: react-use-client-boundary
Source: https://github.com/dev-khoi/AURA-conHack-2026/tree/main/.opencode/skills/react-use-client-boundary
Command: npx skills add https://github.com/dev-khoi/AURA-conHack-2026 --skill react-use-client-boundary-dev-khoi

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Developers working with React Server Components and Next.js often misuse the "use client" directive, adding it redundantly to every component or omitting it where needed, causing build errors like "useState only works in Client Components" and bloated client bundles. ## Core Features & Use Cases - Boundary Placement Guidance: Explains that "use client" marks a boundary, not a per-component label, so child components inside a client boundary never need the directive. - Decision Flowchart: Provides a step-by-step decision tree for determining whether a component needs the directive based on its importer and its use of hooks, event handlers, or browser APIs. - Error Troubleshooting: Covers fixes for common errors such as passing event handlers from Server Components and using async/await in Client Components. - Use Case: When a Next.js page fails to compile because a form component uses useState, apply this skill to place a single "use client" directive at the form entry point and remove redundant directives from its child input and button components. ## Quick Start Review my Next.js components and tell me exactly where to place the "use client" directive and which redundant directives to remove.

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 add "use client" to a React component?▼

Add "use client" when a component is imported by a Server Component and needs client-side features like React hooks, event handlers, or browser APIs. Components already inside a client boundary do not need the directive.

Do child components need "use client" if the parent has it?▼

No, child components imported by a client component are automatically client components. Adding "use client" to them is redundant and creates confusion about where the actual boundary lies.

Why does "useState only works in Client Components" error occur?▼

This error occurs when a component uses hooks without the "use client" directive while being imported by a Server Component. Fix it by adding the directive to the component using the hook or moving hook usage to a parent client component.

Can I pass event handlers from Server Components to Client Components?▼

No, functions cannot be passed from Server Components to Client Components because they cannot be serialized. Move the event handler logic into the client component or restructure the boundary.

Can a component without "use client" work in both server and client contexts?▼

Yes, pure presentational components without hooks or browser APIs work in both contexts. They render as server components when imported by servers and as client components when inside a client boundary.