server-ssr

Coordinates SSR HTML generation, hydration, and data fetching for Next.js and Express applications.

1|3|Updated Sep 4, 2023
One-click install
npx skills add https://github.com/grvpanchal/elegant --skill server-ssr
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: server-ssr
Source: https://github.com/grvpanchal/elegant/tree/main/skills/server-ssr
Command: npx skills add https://github.com/grvpanchal/elegant --skill server-ssr

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill addresses common challenges in implementing Server-Side Rendering (SSR), including HTML generation, client-side hydration, data prefetching, and hydration mismatches, ultimately improving page load speed and SEO.

Core Features & Use Cases

  • SSR Implementation: Provides patterns for initial HTML generation, client hydration, and data prefetching via getServerSideProps/renderToString.
  • Hydration Mismatch Debugging: Offers guidelines for resolving "window is not defined" errors and other hydration issues.
  • SSR vs SSG vs CSR: Assists in making informed decisions between SSR, Static Site Generation (SSG), and Client-Side Rendering (CSR).
  • Use Case: Ideal for enhancing a Next.js or Express application with SSR capabilities, ensuring efficient data fetching and proper state serialization.

Quick Start

Add this skill to your project to implement SSR on your pages and improve SEO performance.

Frequently Asked Questions about server-ssr

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

FAQPage Schema
How do I resolve a hydration mismatch when implementing server-side rendering in Next.js?

To resolve a server-side rendering hydration mismatch in Next.js, you must align initial HTML generation with client-side data hydration. This Skill provides patterns to fix issues like undefined window errors and ensure proper state serialization.

When should I choose server-side rendering over static site generation or client-side rendering?

Choose server-side rendering over static site generation or client-side rendering when you need dynamic, per-request data fetching combined with fast initial page loads. This Skill helps compare SSR, SSG, and CSR to determine the best approach for your SEO goals.

How do I handle data fetching and state serialization for server-side rendering with Express?

Handle data fetching and state serialization for server-side rendering in Express by coordinating initial HTML rendering with client hydration. This Skill offers implementation patterns using renderToString and similar methods to manage application state effectively.

Do I need to know React and Node.js before adding server-side rendering to my web application?

Yes, you need a solid understanding of React/JSX and Node.js before adding server-side rendering. This Skill requires prerequisite knowledge of server-rendering concepts to properly implement initial HTML generation and client-side state management.

Why does my server-side rendering code throw a window is not defined error?

Your server-side rendering code throws a window is not defined error because client-side objects are accessed during initial HTML generation. This Skill provides debugging guidelines to resolve these common hydration issues and separate server and client execution contexts.