react-server-components
БесплатноБез исполняемых скриптовНе проверенTeaches React Server Components for zero-bundle server rendering. Use when components only need server-side data access and don't require client-side…
от PatternsDev★ 261 звезда на GitHubОб этом скилле
React Server Components
Table of Contents
React's Server Components enable modern UX with a server-driven mental model. This is quite different from Server-side Rendering (SSR) of components and results in significantly smaller client-side JavaScript bundles.
When to Use
- Use this when you want to reduce client-side JavaScript by running data-fetching and rendering on the server
- This is helpful for improving performance with zero-JS-cost server-rendered components in Next.js 13+ App Router
When NOT to Use
- When the component needs client-side interactivity — state (
useState), effects (useEffect), and event handlers require Client Components - For components that depend on browser-only APIs (e.g.,
window,localStorage,IntersectionObserver) - When the component is already small and the server/client boundary adds more complexity than it saves
Instructions
- Use Server Components (default in frameworks like Next.js App Router) for data fetching and non-interactive UI
- Add
'use client'directive only to components that need interactivity (event handlers, state, effects) - Server Components can use heavy libraries (markdown parsers, date formatters) at zero client bundle cost
- Server Components complement SSR — they are not a replacement for it
- Use Server Functions or Server Actions (
'use server') for form submissions and mutations when your framework supports them
Details
Update (React 19 / modern frameworks): React Server Components are now a production feature for framework users. Unlike classic SSR, RSCs let you render part of your UI on the server without shipping that component's JavaScript to the client. The Container/Presentational pattern is a strong fit here: the "container" can be a Server Component that fetches data and passes it to an interactive Client Component.
In Next.js App Router, you no longer use
getServerSideProps—instead, any React component in theapp/directory can be async to fetch data on the server. React Server Components are not a replacement for SSR—they complement it. You typically use RSC for the majority of the page (rendered and streamed as part of SSR), and add'use client'directives for components that need interactivity.The
'use server'directive is for Server Functions or Server Actions, not for marking a component as a Server Component. Server Components have no directive; they are the default in frameworks that support them unless you opt into'use client'.
React Server Components are now production-ready in frameworks like Next.js App Router. The following resources are the most useful starting points:
- The React Server Components reference is the best current overview.
- The RFC is still useful for deeper implementation context.
- Next.js App Router documentation for the modern approach to Server Components
- Shopify Hydrogen and Server Components
Server-side rendering limitations
Today's Server-side rendering of client-side JavaScript can be suboptimal. JavaScript for your components is rendered on the server into an HTML string. This HTML is delivered to the browser, which can appear to result in a fast First Contentful Paint or Largest Contentful Paint.
However, JavaScript still needs to be fetched for interactivity which is often achieved via a hydration step. Server-side rendering is generally used for the initial page load, so post-hydration you're unlikely to see it used again.
Note: While it's true that one could build a server-only React app leveraging SSR and avoiding hydrating on the client at all, heavy interactivity in the model often involves stepping outside of React. The hybrid model that Server Components enable will allow deciding this on a per-component basis.
With React Server Components, our components can be refetched regularly. An application with components which rerender when there is new data can be run on the server, limiting how much code needs to be sent to the client.
Before Server Components, using a markdown renderer and sanitizer would add to the bundle:
// *Before* Server Components
import marked from "marked"; // 35.9K (11.2K gzipped)
import sanitizeHtml from "sanitize-html"; // 206K (63.3K gzipped)
function NoteWithMarkdown({text}) {
const html = sanitizeHtml(marked(text));
return (/* render */);
}
Server Components
React's new Server Components complement Server-side rendering, enabling rendering into an intermediate abstraction format without nee
Установить react-server-components в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл react-server-components?
Teaches React Server Components for zero-bundle server rendering. Use when components only need server-side data access and don't require client-side interactivity like state or event handlers.
Как установить скилл react-server-components?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл react-server-components запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic