docs-rsc-sandpack

Embed interactive React Server Component examples in documentation with SandpackRSC.

10|12|Updated Apr 29, 2023
One-click install
npx skills add https://github.com/reactjs/sw.react.dev --skill docs-rsc-sandpack
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: docs-rsc-sandpack
Source: https://github.com/reactjs/sw.react.dev/tree/main/.claude/skills/docs-rsc-sandpack
Command: npx skills add https://github.com/reactjs/sw.react.dev --skill docs-rsc-sandpack

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This Skill enables the creation and modification of interactive React Server Component (RSC) code examples within documentation, streamlining the process of showcasing modern React features.

Core Features & Use Cases

  • RSC Sandpack Integration: Embeds runnable RSC code snippets directly into documentation pages using the <SandpackRSC> component.
  • Server/Client Component Delineation: Clearly defines how server and client code interact within the Sandpack environment, supporting 'use client' and 'use server' directives.
  • Async Component Support: Facilitates examples of asynchronous server components and Suspense.
  • Server Functions (Actions): Demonstrates the implementation and usage of server-side functions callable from client components.
  • Use Case: When documenting new React features that rely on Server Components, use this Skill to provide live, interactive examples that developers can immediately experiment with.

Quick Start

Add an interactive React Server Component example using the docs-rsc-sandpack skill.

Frequently Asked Questions about docs-rsc-sandpack

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

FAQPage Schema
How do I embed interactive React Server Component examples in documentation?

To embed interactive React Server Component examples in documentation, use the `<SandpackRSC>` component to integrate runnable RSC code snippets directly into your pages. This allows developers to immediately experiment with modern React patterns.

Can I use 'use client' and 'use server' directives in Sandpack code examples?

Yes, you can use 'use client' and 'use server' directives in Sandpack code examples. The integration clearly defines how server and client code interact within the Sandpack environment to demonstrate modern React features.

What is the best way to demonstrate async server components and Suspense in docs?

The best way to demonstrate async server components and Suspense in docs is by using the `<SandpackRSC>` component, which specifically facilitates examples of asynchronous server components and their Suspense boundaries.

How do I show server functions callable from client components in React documentation?

To show server functions callable from client components in React documentation, use the `<SandpackRSC>` component. It supports demonstrating the implementation and usage of server-side functions invoked from client-side code.

Do I need specific build scripts to run React Server Components in Sandpack?

Yes, you need specific build scripts to run React Server Components in Sandpack. The integration requires generating a dedicated RSC worker bundle to execute the interactive code examples correctly.