Skip to content

Understanding different types of rendering on Frontend

Rendering is the process of generating the final output from the data and template. In frontend development, rendering refers to how the browser displays content on the screen. There are different types of rendering techniques used in web development, each with its advantages and use cases.

Types of Rendering

1. Server-Side Rendering (SSR)

Server-Side Rendering (SSR) is the traditional method of rendering web pages on the server and sending the fully rendered HTML to the client. The server processes the request, fetches data, and generates the HTML content, which is then sent to the browser for display. SSR is suitable for static websites, blogs, and content-heavy applications.

Key Points of SSR

2. Client-Side Rendering (CSR)

Client-Side Rendering (CSR) is the modern approach where the browser loads a minimal HTML page and uses JavaScript to render the content dynamically. The server sends the raw data (usually in JSON format), and the client-side JavaScript framework (e.g., React, Angular, Vue) processes the data and generates the HTML content. CSR is ideal for single-page applications (SPAs) and interactive web applications.

Key Points of CSR

3. Static Site Generation (SSG)

Static Site Generation (SSG) is a hybrid approach that combines SSR and CSR. The server pre-builds the HTML pages at build time, and the client loads the pre-rendered pages without server processing. SSG is suitable for websites with dynamic content that does not change frequently.

Key Points of SSG

4. Incremental Static Regeneration (ISR)

Incremental Static Regeneration (ISR) is an extension of SSG that allows updating specific pages without rebuilding the entire site. When the content changes, the server regenerates the affected pages on-demand, ensuring the latest data is available without rebuilding the entire site. ISR is suitable for websites with dynamic content that needs frequent updates.

Key Points of ISR

Comparison

Rendering TypeDescriptionAdvantagesDisadvantagesExample Frameworks/Tools
Client-Side Rendering (CSR)Rendering happens in the browser using JavaScript.- Highly interactive and responsive.
- Great for SPAs.
- Slower initial load due to JS execution.
- Poor SEO without additional tools.
React, Angular, Vue.js
Server-Side Rendering (SSR)Content is rendered on the server and sent as fully-formed HTML.- Faster initial load.
- Better SEO.
- Increased server load.
- Slower navigation between pages.
Next.js, Nuxt.js
Static Site Generation (SSG)HTML is pre-rendered at build time and served as static files.- Extremely fast delivery.
- Scalable and low server load.
- Not suitable for frequently changing data unless combined with ISR.Gatsby, Hugo, Next.js (SSG)
Incremental Static Regeneration (ISR)Updates static pages on demand at runtime.- Real-time updates without full rebuild.
- Efficient for rarely changing data.
- More complex to implement than SSG.Next.js (ISR)
Hybrid RenderingCombines CSR, SSR, and SSG for different pages or components.- Tailored optimization for specific needs.
- Versatile for complex apps.
- Increased complexity in development.Next.js, Nuxt.js
Progressive HydrationAdds interactivity incrementally to server-rendered HTML.- Faster perceived load than CSR.
- Early display of critical content.
- Requires fine-grained control over hydration.Astro, Partial Hydration
Edge-Side Rendering (ESR)Rendering occurs at edge servers (CDNs), closer to the user.- Low latency.
- Dynamic rendering without heavy server load.
- Limited computational resources at the edge.Cloudflare Workers, Vercel
Streaming RenderingContent is progressively rendered and sent to the browser as it’s generated.- Reduces time-to-first-byte (TTFB).
- Improved performance for large pages.
- Requires careful state management.React Server Components

Summary

The choice of rendering strategy depends on the type of application, content, and user experience requirements. Here are some guidelines to help you choose the right rendering technique:

By understanding the different types of rendering techniques, you can choose the right approach that best suits your application’s requirements and performance goals. Each rendering strategy has its advantages and trade-offs, so consider your use case carefully before deciding on the rendering method.