The server renders the full HTML; the browser displays it immediately (no blank page flash).
React hydrates the server-rendered HTML on the client, attaching event handlers.
Use cache headers appropriately — per-request SSR bypasses CDN caching.
Details
SSR sends fully-rendered HTML from the server. The browser displays content immediately while React hydrates in the background, making the UI interactive.
SSR vs SSG:
SSG (Static Generation): HTML generated at build time. Fast, cacheable, but requires rebuild for updates.
SSR: HTML generated per-request. Always fresh, but has server cost and latency.
ISR (Next.js): Static with time-based revalidation — best of both for many cases.
Hydration mismatch: If server-rendered HTML differs from what client React would render, React throws a hydration error. Common causes: Date.now(), Math.random(), browser-only APIs in render paths. Suppress with suppressHydrationWarning for known-safe mismatches.
React 18 streaming:renderToPipeableStream streams HTML to the browser progressively, enabling Suspense boundaries to stream in chunks. Improves TTFB for slow data.
Read the instructions and examples in this document.
Apply the patterns to your implementation, adapting to your specific context.
Verify your implementation against the details and edge cases listed above.
Harness Integration
Type: knowledge — this skill is a reference document, not a procedural workflow.
No tools or state — consumed as context by other skills and agents.
Success Criteria
The patterns described in this document are applied correctly in the implementation.
Edge cases and anti-patterns listed in this document are avoided.
1---2name: react-server-rendering3description: React Server Rendering4---5# React Server Rendering67> Pre-render React components on the server for improved SEO and initial load performance89## When to Use1011- Public-facing pages where SEO and crawler indexability matter12- Applications where First Contentful Paint performance is critical13- You need personalized content rendered per-request (not suitable for static generation)14- Using Next.js Pages Router (`getServerSideProps`), Remix (`loader`), or custom Express + `renderToString`1516## Instructions17181. In Next.js Pages Router, export `getServerSideProps` to fetch data server-side:19 ```typescript20 export async function getServerSideProps(context: GetServerSidePropsContext) {21 const data = await fetchData(context.params.id);22 return { props: { data } };23 }24 ```252. In Remix, export a `loader` function:26 ```typescript27 export async function loader({ params }: LoaderFunctionArgs) {28 return json(await fetchData(params.id));29 }30 ```313. The server renders the full HTML; the browser displays it immediately (no blank page flash).324. React hydrates the server-rendered HTML on the client, attaching event handlers.335. Use `cache` headers appropriately — per-request SSR bypasses CDN caching.3435## Details3637SSR sends fully-rendered HTML from the server. The browser displays content immediately while React hydrates in the background, making the UI interactive.3839**SSR vs SSG:**4041- **SSG (Static Generation):** HTML generated at build time. Fast, cacheable, but requires rebuild for updates.42- **SSR:** HTML generated per-request. Always fresh, but has server cost and latency.43- **ISR (Next.js):** Static with time-based revalidation — best of both for many cases.4445**Hydration mismatch:** If server-rendered HTML differs from what client React would render, React throws a hydration error. Common causes: `Date.now()`, `Math.random()`, browser-only APIs in render paths. Suppress with `suppressHydrationWarning` for known-safe mismatches.4647**React 18 streaming:** `renderToPipeableStream` streams HTML to the browser progressively, enabling Suspense boundaries to stream in chunks. Improves TTFB for slow data.4849## Source5051https://patterns.dev/react/server-side-rendering5253## Process54551. Read the instructions and examples in this document.562. Apply the patterns to your implementation, adapting to your specific context.573. Verify your implementation against the details and edge cases listed above.5859## Harness Integration6061- **Type:** knowledge — this skill is a reference document, not a procedural workflow.62- **No tools or state** — consumed as context by other skills and agents.6364## Success Criteria6566- The patterns described in this document are applied correctly in the implementation.67- Edge cases and anti-patterns listed in this document are avoided.
Run npx skillmds@latest add intense-visions/react-server-rendering in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
React Server Rendering It is listed under Web & Frontend on SkillMD.
This skill has not completed SkillMD's automated safety review yet. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
Intense-Visions (@intense-visions) published this skill. Their other Agent Skills are listed on their SkillMD profile.