<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Avinashuchadiya on Medium]]></title>
        <description><![CDATA[Stories by Avinashuchadiya on Medium]]></description>
        <link>https://medium.com/@avinashuchadiya?source=rss-b31bc1cbbf19------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*wsm5Qf9419gvh-TPJJO0Rg.png</url>
            <title>Stories by Avinashuchadiya on Medium</title>
            <link>https://medium.com/@avinashuchadiya?source=rss-b31bc1cbbf19------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 05:26:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@avinashuchadiya/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[CSR vs SSR vs SSG vs ISR in Next.js: How Do You Actually Decide?]]></title>
            <link>https://avinashuchadiya.medium.com/csr-vs-ssr-vs-ssg-vs-isr-in-next-js-how-do-you-actually-decide-293203ea75fa?source=rss-b31bc1cbbf19------2</link>
            <guid isPermaLink="false">https://medium.com/p/293203ea75fa</guid>
            <category><![CDATA[client-side-rendering]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[rendering]]></category>
            <category><![CDATA[nextjs]]></category>
            <dc:creator><![CDATA[Avinashuchadiya]]></dc:creator>
            <pubDate>Mon, 07 Sep 2026 07:20:04 GMT</pubDate>
            <atom:updated>2026-09-07T07:20:04.997Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Kt11wcEFKUluyvIzMeSgUA.png" /></figure><h3>I recently had a conversation about React and Next.js rendering strategies.</h3><p>The candidate knew the definitions.</p><p>They could explain:</p><ul><li>CSR</li><li>SSR</li><li>SSG</li><li>ISR</li></ul><p>But then came the more important question:</p><blockquote><strong><em>How do you decide which one to use?</em></strong></blockquote><p>And that’s where things got interesting.<br>Because in a real application, knowing what CSR, SSR, SSG, and ISR stand for isn’t enough.<br>You need to understand <strong>why you would choose one over another.</strong></p><p>And no, the answer isn’t simply:</p><blockquote><strong><em>SSR because of SEO.</em></strong><em> 😄</em></blockquote><p>Let’s make this practical.</p><p><strong>First, a quick refresher</strong></p><p>Before deciding which strategy to use, let’s quickly understand what each one means.</p><h3>CSR: Client-Side Rendering</h3><p>The browser receives the application and JavaScript, and the client fetches and renders the data.<br>A simplified flow looks like:</p><pre>Browser<br>   ↓<br>Download JavaScript<br>   ↓<br>React renders<br>   ↓<br>Fetch data<br>   ↓<br>Display content</pre><p>CSR can make sense when the application is highly interactive and SEO isn’t a major concern.</p><p>Examples:</p><ul><li>Admin dashboards</li><li>Internal tools</li><li>Project management applications</li><li>Highly interactive web applications</li></ul><h3>SSR: Server-Side Rendering</h3><p>The server generates the HTML for a request and sends it to the browser.</p><pre>Browser<br>   ↓<br>Request<br>   ↓<br>Server fetches data<br>   ↓<br>Server generates HTML<br>   ↓<br>Browser receives HTML</pre><p>This is useful when the content needs to be <strong>fresh or request-specific</strong> and you want meaningful HTML available on the initial response.</p><p>Examples:</p><ul><li>Personalized pages</li><li>Frequently changing content</li><li>Pages where initial HTML is important for discoverability or user experience</li></ul><h3>SSG: Static Site Generation</h3><p>The page is generated ahead of time rather than being rendered for every request.</p><pre>Build time<br>   ↓<br>Generate HTML<br>   ↓<br>Store static output<br>   ↓<br>Serve to users</pre><p>This works well when the content doesn’t change frequently.</p><p>Examples:</p><ul><li>Documentation</li><li>Marketing pages</li><li>Blog posts</li><li>Company websites</li></ul><h3>ISR: Incremental Static Regeneration</h3><p>ISR sits somewhere between static generation and request-time rendering.</p><p>You can generate a page statically and then allow it to be regenerated periodically as the underlying data changes.</p><p>Conceptually:</p><pre>Generate page<br>     ↓<br>Serve cached page<br>     ↓<br>After configured period<br>     ↓<br>Regenerate page</pre><p>This is useful when content is <strong>mostly static but needs periodic updates</strong>.</p><p>Examples:</p><ul><li>Product pages</li><li>News or content pages</li><li>Catalog pages</li><li>Frequently viewed content that doesn’t need to be generated for every request</li></ul><h3>So how do you actually choose?</h3><p>This is the part I’d focus on in an interview.<br>Instead of memorizing four definitions, ask yourself <strong>six questions</strong>.</p><h3>1. How fresh does the data need to be?</h3><p>Start here.<br>Ask:</p><blockquote><strong><em>How often does this data change, and how quickly does the user need to see those changes?</em></strong></blockquote><p>If the content changes rarely, static generation may be enough.<br>If it changes periodically, ISR could be a good fit.<br>If it needs to be generated based on every request, SSR may make more sense.</p><p>And if the data is primarily fetched and updated through client interactions, CSR may be appropriate.</p><p>Think:</p><pre>Rarely changes<br>      ↓<br>     SSG</pre><pre>Changes periodically<br>      ↓<br>     ISR</pre><pre>Changes per request<br>      ↓<br>     SSR</pre><pre>Mostly client-driven<br>      ↓<br>     CSR</pre><p>It’s not a strict rule, but it’s a useful starting point.</p><h3>2. Do I really need server rendering on every request?</h3><p>This is an easy thing to overlook.</p><p>If a page can be generated ahead of time, why generate it again every time someone requests it?<br>For example, imagine a documentation page that changes once every few weeks.<br>Rendering it on every request doesn’t necessarily provide much value.</p><p>Generating it ahead of time and serving the resulting content can reduce unnecessary server work and make the page easier to cache.</p><p>So ask:</p><blockquote><strong><em>Does this page actually need request-time rendering?</em></strong></blockquote><p>If the answer is no, consider a static approach.</p><h3>3. How interactive is the page?</h3><p>Not every page needs to be heavily interactive.<br>Consider a blog article.<br>The majority of the page might simply be:</p><pre>Title<br>Author<br>Published date<br>Article content<br>Images</pre><p>That content doesn’t necessarily require the browser to construct everything from scratch.</p><p>Now compare that with something like an analytics dashboard:</p><pre>Filters<br>Charts<br>Dropdowns<br>Date ranges<br>Real-time interactions<br>User controls</pre><p>That’s a very different application.</p><p>The more client-side interaction you have, the more important client-side React behavior becomes.<br>And this is where an important distinction comes in:</p><p><strong>Rendering strategy and client-side interactivity aren’t mutually exclusive.</strong></p><p>A page can be initially rendered on the server and still contain highly interactive client-side components.</p><h3>4. Does SEO matter?</h3><p>SEO can influence the decision, but it shouldn’t be your entire decision.</p><p>For a public product page, blog article, or documentation page, having meaningful content available in the initial HTML can be valuable for search engines and link previews.</p><p>But imagine an internal company dashboard.</p><p>Is Google indexing your sales dashboard really the primary requirement?</p><p>Probably not.</p><p>So instead of saying:</p><blockquote><em>SSR = SEO</em></blockquote><p>Think:</p><blockquote><strong><em>Does this content need to be discoverable and available as meaningful initial HTML?</em></strong></blockquote><p>That’s a much better architectural question.</p><h3>5. What kind of initial user experience do we want?</h3><p>Another important consideration is what the user sees when they first visit the page.</p><p>Suppose your page requires several client-side requests before anything meaningful appears.</p><p>The user may initially see:</p><pre>Loading...</pre><p>and then wait for the application to fetch and render the content.</p><p>For some applications, that’s perfectly acceptable.<br>For others, showing meaningful content as early as possible can significantly improve the experience.</p><p>So ask:</p><blockquote><strong><em>How important is the initial content before the client-side application is fully ready?</em></strong></blockquote><p>This can influence whether you want content available through server or static rendering.</p><h3>6. Is the content personalized?</h3><p>This is one of the biggest architectural considerations.<br>Imagine an e-commerce website.<br>Some content might be the same for everyone:</p><pre>Product name<br>Product description<br>Product images<br>Specifications</pre><p>That content could potentially be statically generated or cached.<br>But other information might be user-specific:</p><pre>Recommended products<br>Shopping cart<br>Wishlist<br>Account information<br>Location-specific information</pre><p>That data may need request-specific or client-side handling.</p><p>And that’s why real applications rarely fit neatly into:</p><blockquote><em>This entire application uses SSR.</em></blockquote><p>or:</p><blockquote><em>This entire application uses CSR.</em></blockquote><p>Modern applications are usually <strong>combinations of different rendering approaches.</strong></p><h3>A practical example: E-commerce</h3><p>Let’s say we’re building an e-commerce product page.<br>We might have:</p><p><strong>Product</strong> <strong>information</strong></p><pre>Product name<br>Description<br>Images<br>Specifications</pre><p>This content may change occasionally.</p><p><strong>ISR could be a reasonable approach</strong> if periodic regeneration is sufficient.</p><h3>Add to Cart</h3><pre>Quantity<br>Add to Cart<br>Cart state</pre><p>These interactions need client-side behavior.</p><p><strong>Client components can handle the interaction.</strong></p><h3>Personalized recommendations</h3><pre>Recommended for you<br>Recently viewed</pre><p>This could depend on the user.</p><p><strong>Request-specific or client-side data fetching may be appropriate</strong>, depending on the architecture.</p><h3>Search-engine-facing product content</h3><p>The product information may benefit from being available in the initial HTML.</p><p>So we can end up with something conceptually like:</p><pre>Product Page<br>│<br>├── Product information<br>│      └── ISR / cached server-rendered content<br>│<br>├── Add to Cart<br>│      └── Client interaction<br>│<br>├── Product reviews<br>│      └── Server/client depending on requirements<br>│<br>└── Personalized recommendations<br>       └── Request-specific/client-side data</pre><p>That’s much closer to how real applications are designed.</p><h3>My mental model for interviews</h3><p>When I’m trying to quickly reason about a page, I think about it like this:</p><p>RequirementPossible directionHighly interactive applicationCSR / client-side interactionsFresh or request-specific contentSSRContent can be generated ahead of timeSSGMostly static but periodically changingISRImportant initial HTMLServer/static renderingHighly personalized contentRequest-specific or client-side rendering</p><p>The important word here is <strong>possible.</strong></p><p>These aren’t rigid rules.</p><p>The final decision depends on the application’s requirements, caching strategy, data-fetching architecture, infrastructure, and user experience goals.</p><h3>The bigger lesson</h3><p>I think this is where frontend interviews sometimes become too focused on terminology.</p><p>You can memorize:</p><blockquote><em>CSR = Client-Side Rendering<br>SSR = Server-Side Rendering<br>SSG = Static Site Generation<br>ISR = Incremental Static Regeneration</em></blockquote><p>And still struggle when someone asks:</p><blockquote><strong><em>Which one would you use?</em></strong></blockquote><p>Because architecture isn’t about memorizing definitions.</p><p>It’s about understanding <strong>trade-offs.</strong></p><p>When I get this question, I’d rather walk through:</p><ol><li>How fresh is the data?</li><li>Does the page need request-time rendering?</li><li>How interactive is it?</li><li>Does SEO/discoverability matter?</li><li>What initial experience do we want?</li><li>Is the content personalized?</li></ol><p>Then choose the approach based on those requirements.</p><p>And remember:</p><p><strong>You don’t necessarily choose one rendering strategy for the entire application.</strong></p><p>A single application can combine static content, server-rendered content, cached/regenerated content, and client-side interactions.</p><p>That’s usually a much better mental model than trying to put the entire application into one rendering bucket.</p><h3>Final takeaway</h3><p>If you’re preparing for a React or Next.js interview, don’t stop at:</p><blockquote><strong><em>What is SSR?</em></strong></blockquote><p>Practice answering:</p><blockquote><strong><em>Why would you choose SSR over ISR here?<br>Why not just make this page static?<br>What happens if this data becomes personalized?<br>Which parts actually need to be interactive?</em></strong></blockquote><p>Those questions force you to think like an engineer rather than simply recall terminology.</p><p>And that’s ultimately what rendering strategies are about:</p><p><strong>not choosing the most popular strategy; choosing the strategy that fits the requirements.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=293203ea75fa" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>