Skip to content
Back to skills

React Server Rendering

ASecurity

> Pre-render React components on the server for improved SEO and initial load performance

  • 20 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 11, 2026
developmenttypescriptreactnextjsexpressapiperformance

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned September 11, 2026

npx -y skills add Intense-Visions/harness-engineering --skill react-server-rendering --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of React Server Rendering?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for React Server Rendering
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/intense-visions-react-server-rendering/badge)](https://www.skillsdirectory.com/skills/intense-visions-react-server-rendering)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
# React Server Rendering

> Pre-render React components on the server for improved SEO and initial load performance

## When to Use

- Public-facing pages where SEO and crawler indexability matter
- Applications where First Contentful Paint performance is critical
- You need personalized content rendered per-request (not suitable for static generation)
- Using Next.js Pages Router (`getServerSideProps`), Remix (`loader`), or custom Express + `renderToString`

## Instructions

1. In Next.js Pages Router, export `getServerSideProps` to fetch data server-side:
   ```typescript
   export async function getServerSideProps(context: GetServerSidePropsContext) {
     const data = await fetchData(context.params.id);
     return { props: { data } };
   }
   ```
2. In Remix, export a `loader` function:
   ```typescript
   export async function loader({ params }: LoaderFunctionArgs) {
     return json(await fetchData(params.id));
   }
   ```
3. The server renders the full HTML; the browser displays it immediately (no blank page flash).
4. React hydrates the server-rendered HTML on the client, attaching event handlers.
5. 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.

## Source

https://patterns.dev/react/server-side-rendering

## Process

1. Read the instructions and examples in this document.
2. Apply the patterns to your implementation, adapting to your specific context.
3. 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.

Files in this skill

  • SKILL.md2.7 KB
  • skill.yaml739 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.