<?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 Dinesh Pandiyan on Medium]]></title>
        <description><![CDATA[Stories by Dinesh Pandiyan on Medium]]></description>
        <link>https://medium.com/@flexdinesh?source=rss-4a319ae8561a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*fqw6O5cdVBuE2KFqqcC02A.jpeg</url>
            <title>Stories by Dinesh Pandiyan on Medium</title>
            <link>https://medium.com/@flexdinesh?source=rss-4a319ae8561a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 08 Apr 2026 20:48:42 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@flexdinesh/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[Progressive Rendering — The Key to Faster Web]]></title>
            <link>https://medium.com/the-thinkmill/progressive-rendering-the-key-to-faster-web-ebfbbece41a4?source=rss-4a319ae8561a------2</link>
            <guid isPermaLink="false">https://medium.com/p/ebfbbece41a4</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[expressjs]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Dinesh Pandiyan]]></dc:creator>
            <pubDate>Sun, 10 Nov 2019 21:46:15 GMT</pubDate>
            <atom:updated>2019-11-10T21:46:15.362Z</atom:updated>
            <content:encoded><![CDATA[<h3>Progressive Rendering — The Key to Faster Web</h3><figure><img alt="progressive rendering" src="https://cdn-images-1.medium.com/max/1024/1*dpeBox0wkgmSlDIPWIIk9w.png" /><figcaption>Progressive Rendering</figcaption></figure><p><strong><em>Progressive Rendering is the technique of sequentially rendering portions of a webpage in the server and streaming it to the client in parts without waiting for the whole page to rendered.</em></strong></p><p><em>Note: The content of this post may be relevant to all types of servers but written within the context of a node.js server. The perf metrics are assumptive and may differ based on network bandwidth and latency.</em></p><p>To understand progressive rendering we must first understand how client side rendering and server side rendering work.</p><h3>Client Side Rendering</h3><p>Client side rendering is the technique in which the server sends a simple HTML without any content in the body and script tags in the head. This is what <a href="https://github.com/facebook/create-react-app">create-react-app</a> builds output.</p><p>Typical page load behaviour in CSR —</p><ol><li>Browser requests the server for HTML</li><li>Server sends HTML with script tags in head and no content in body</li><li>Browser parses the HTML and makes http requests to load the scripts</li><li>Once the scripts are loaded, the browser parses them and makes API requests and loads all the content asynchronously</li></ol><figure><img alt="Client Side Rendering" src="https://cdn-images-1.medium.com/max/1024/1*vKrzuL0dy60XAI8GS521pA.png" /><figcaption>Client Side Rendering</figcaption></figure><p>Since the all the <strong>content starts loading only after loading the initial JavaScript</strong>, it takes a <strong>longer time</strong> to show any <strong>content</strong> on the page. If the user is on a <strong>slow network</strong>, the <strong>content is blocked</strong> for an even <strong>longer time</strong> due to <strong>lower bandwidth</strong> and <strong>higher latency</strong>.</p><figure><img alt="Client Side Rendering FP metric" src="https://cdn-images-1.medium.com/max/1024/1*GvuX8GaVLOQivzwyLXaV2A.png" /><figcaption>Client Side Rendering FP metric</figcaption></figure><h4>Pros</h4><ol><li>Once the initial JavaScript is loaded, the <strong>content can be loaded asynchronously</strong>. We can load the<strong> critical content first</strong> and then load <strong>non-critical content later</strong>.</li><li>Server serves static HTML and initial load JavaScript bundles can be <strong>cached</strong> in the browsers which may benefit frequent users.</li></ol><h4>Cons</h4><ol><li>Initial load JavaScript <strong>blocks content load</strong>. The larger your bundle size is, the longer it will take to show content on the page.</li><li>API requests to load content have to travel all over the world to fetch data as they are <strong>not co-located</strong> with the browser location. This may take even longer in slower networks due to high latency and low bandwidth.</li><li><strong>SEO</strong> scores take a huge hit since search engines don’t execute JavaScript (arguably) and only an empty page is indexed. This matters when you want your page to be public and searchable.</li></ol><h3>Server Side Rendering</h3><p>Server side rendering is the technique in which the whole HTML is rendered on the server and sent to client. This is what <a href="https://nextjs.org">Next.js</a> or <a href="https://www.gatsbyjs.org">Gatsby</a> (build time server render) does.</p><p>Typical page load behaviour in SSR —</p><ol><li>Browser requests the server for HTML.</li><li>Server makes API requests (usually co-located) and renders the content in the server.</li><li>Once the page is ready, the server sends it to the browser.</li><li>The browser loads and parses the HTML and paints the content on the screen without waiting for the JavaScript bundle(s) to load.</li><li>Once the JavaScript bundle(s) are loaded, the browser hydrates interactivity to DOM elements, which is usually attaching event handlers and other interactive behaviours.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yD9-0iK2Ul8cAnOvIbwKng.png" /><figcaption>Server Side Rendering</figcaption></figure><p>Since the APIs are usually co-located with the server, the content is loaded <strong>super fast (faster than CSR)</strong> and the HTML is sent to the browser. Initial <strong>JavaScript load doesn’t block content load</strong> as the HTML sent by the server already has the content.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZJsCoG_GV9kyKWbfETGbAA.png" /><figcaption>Server Side Rendering FP metric</figcaption></figure><h4>Pros</h4><ol><li>Since the server serves <strong>HTML with content</strong>, neither the browser nor search engines have to depend on JavaScript for the content.</li><li>Content is <strong>not</strong> blocked by the time taken to load JavaScript bundle(s).</li><li>Page loads a lot <strong>faster than CSR</strong>.</li></ol><h4>Cons</h4><ol><li>The entire HTML has to be rendered on the server before sending it to the client. This means, even the non-critical content has to rendered on the server to before sending the response HTML to the client.</li></ol><h3>Progressive Rendering</h3><p>Progressive Rendering (aka <strong>Progressive Server Side Rendering</strong>) is a technique in which once you <strong>render the critical content</strong> on the server, you start <strong>streaming it to the client without waiting for non-critical content</strong>. You then stream the non-critical content later once it’s rendered on the server. The <strong>browser</strong> starts to <strong>progressively render </strong>(paint) the HTML on the page as soon as a chunk for critical content is received. Non-critical content is then later rendered (paint) on the page when the browser receives it from the server.</p><p>Typical page load behaviour in PSSR —</p><ol><li>Browser requests the server for HTML.</li><li>Server makes API requests (usually co-located) and <strong>renders the critical content first in the server and streams it to the browser</strong>.</li><li>The browser receives the <strong>chunk</strong> of HTML and renders (paints) it on the screen.</li><li>The server renders non-critical content <strong>after</strong> rendering critical content and <strong>streams</strong> it to the client.</li><li>The browser receives and renders (paints) the non-critical content later.</li><li>Once the entire page is loaded, the browser hydrates interactivity to DOM elements, which is usually attaching event handlers and other interactive behaviours.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i5WWiWt3t3rAS7hgxRTuBQ.png" /><figcaption>Progressive Rendering</figcaption></figure><p>Progressive rendering <strong>bridges the benefits of both CSR and SSR</strong>. Content is rendered quickly since the APIs are co-located in the server and at the same time, <strong>critical content can be rendered quickly without having to wait for non-critical content.</strong></p><blockquote>With Progressive Rendering, you can make your site load faster asynchronously <strong>without relying on JavaScript to load content</strong>.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BzEMw2ibavDzi2G4bUseEQ.png" /><figcaption>Progressive Rendering FP metric</figcaption></figure><p>The whole idea of progressive rendering depends on the concept of <strong>streaming HTML from the server to client</strong>. You can read more about it <a href="https://www.freecodecamp.org/news/node-js-streams-everything-you-need-to-know-c9141306be93">here</a>.</p><p>You often get magnitudes of performance boost if you do PSSR right. Here’s an example of the same website rendered with<strong> SSR vs PSSR</strong>. <em>(Assuming the site is loaded over a low bandwidth network with high latency).</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8bSwIj9gKEKoFFpZnTJBFQ.gif" /><figcaption>SSR vs PSSR</figcaption></figure><p>To put things into perspective, perf profiling <strong>SSR vs PSSR</strong> gives a clear perf boost in how quickly content shows up in the page.</p><figure><img alt="SSR vs PSSR" src="https://cdn-images-1.medium.com/max/1024/1*PkbUQGx88OioCvAQYxabLA.png" /><figcaption>SSR vs PSSR</figcaption></figure><h4>How to progressively render a page?</h4><p>Node.js has this <a href="https://nodejs.org/api/stream.html#stream_readable_streams">Readable</a> API which will let you pipe a readable stream. An example code to stream HTML might look like this</p><pre>router.get(&quot;/stream&quot;, async function(req, res, next) {<br>  res.status(200);<br>  res.type(&quot;text/html; charset=utf-8&quot;);</pre><pre>// myRendered renders the HTML content<br>const DOCTYPE = await myRendered.DOCTYPE();<br>  const openHTML = await myRendered.openHTML();<br>  const head = await myRendered.head();<br>  const openBody = await myRendered.openBody();</pre><pre>res.write(`${DOCTYPE}${openHTML}`);<br>  res.write(head);<br>  res.write(openBody);</pre><pre>const pageChunks = [<br>    myRendered.header,<br>    myRendered.criticalContentOpen,<br>    myRendered.nonCriticalContentOpen,<br>    myRendered.nonCriticalContentClose,<br>    myRendered.criticalContentClose,<br>    myRendered.closeBody,<br>    myRendered.closeHTML<br>  ];</pre><pre>const pageStream = new Readable({<br>    async read(size) {<br>      if (!pageChunks.length) {<br>        pageStream.push(null);<br>      } else {<br>        const chunkToRender = pageChunks.shift();<br>        const renderedChunk = await chunkToRender();<br>        pageStream.push(renderedChunk);<br>      }<br>    }<br>  });</pre><pre>// stream content as soon as they are rendered<br>pageStream.pipe(res);<br>});</pre><p>The example for this website built with <a href="https://expressjs.com">Express</a> and vanilla JS is here —</p><p><a href="https://github.com/flexdinesh/progressive-rendering">https://github.com/flexdinesh/progressive-rendering</a></p><p>The idea is you <strong>predictably slice portions of your HTML content and stream it to the browser as soon as it is rendered.</strong></p><h4>Pros</h4><ol><li>Render on server but stream critical content to client without waiting for non-critical content.</li><li>Content is not blocked by the time taken to load JavaScript bundle(s).</li><li>Page loads a lot faster than both CSR and SSR.</li><li>Build fruitful user experiences even for users on slower networks.</li></ol><h4>Cons</h4><ol><li>The browser will hydrate the DOM and attach event listeners only after the whole page is loaded. Even though content shows up quickly, interactivity will be enabled only after non-critical content is loaded. (<em>But showing up content a lot quicker is still a win).</em></li><li>There is no established framework for progressive rendering and is highly dependent on the web application and its limitations.</li></ol><h4>Tips for effective progressive rendering</h4><ul><li>Load critical CSS in the head</li><li>Using CSS grid for layouts removes the dependency on the order of how the content is streamed</li></ul><p>That’s all folks.</p><p>Drop a comment below or <a href="https://twitter.com/intent/tweet/?text=Hey%20@flexdinesh%20I%20read%20your%20post%20about%20Progressive%20Rendering%20">start a conversation</a> with the author in <a href="https://twitter.com/flexdinesh">Twitter</a> on what you think about this article.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ebfbbece41a4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-thinkmill/progressive-rendering-the-key-to-faster-web-ebfbbece41a4">Progressive Rendering — The Key to Faster Web</a> was originally published in <a href="https://medium.com/the-thinkmill">Thinkmill</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React Dev Tools — Debug Like a Ninja]]></title>
            <link>https://medium.com/the-thinkmill/react-dev-tools-debug-like-a-ninja-c3a5d09895c6?source=rss-4a319ae8561a------2</link>
            <guid isPermaLink="false">https://medium.com/p/c3a5d09895c6</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[devtools]]></category>
            <category><![CDATA[tutorial]]></category>
            <dc:creator><![CDATA[Dinesh Pandiyan]]></dc:creator>
            <pubDate>Sat, 14 Sep 2019 11:02:46 GMT</pubDate>
            <atom:updated>2019-09-20T06:16:08.368Z</atom:updated>
            <content:encoded><![CDATA[<h3>React Dev Tools — Debug Like a Ninja</h3><figure><img alt="React Dev Tools — Debug like a ninja" src="https://cdn-images-1.medium.com/max/1024/1*vwNrlUSs4Q2JCsWc9JJsBw.png" /></figure><blockquote>Hands down console.log() was, is and will always be the <strong>greatest debugging tool</strong> of all time.</blockquote><p>React team launched a <strong>new version</strong> of the <strong>React Dev Tools</strong> (v4) a few weeks ago and it’s <strong>fantabulous</strong>. It gives you <strong>debugging superpowers</strong> to navigate through your tree, trace data flow, spot weak links and optimise for perf.</p><p>There are <strong>two separate tabs</strong> <strong>(Components, Profiler)</strong> now as opposed to the old version which had only one React tab.</p><figure><img alt="Dev Tools" src="https://cdn-images-1.medium.com/max/1024/1*w1hePByhgMPI32PXJxnTgw.png" /></figure><p>New Dev Tools has great many improvements over the old version. To highlight a few —</p><ul><li>🏎 Faster</li><li>🎣 Hooks support</li><li>🧐 Advanced tree filter</li><li>🤠 Better search UX</li><li>👮‍♀️ Badges for HOCs</li><li>🎯 Remembers selection after page reload</li></ul><h3>Top 10 Features</h3><p>Dev Tools can do a lot of things. We’re are not going to dive into the nitty gritty details of each and every feature. Instead we’ll take a look at the <strong>top 10 helpful features</strong> that help us save time and write better React code.</p><h4>Components Tab</h4><ol><li>Live edit state/props</li><li>Search through tree</li><li>Advanced tree filter</li><li>Rendered by</li><li>Owners tree</li><li>Quick Navigation</li><li>Utils</li></ol><h4>Profiler Tab</h4><ol><li>Profile initial mount</li><li>Why did this render?</li><li>Rendered at</li></ol><h3>1. Live Edit State/Props</h3><p>You can live edit the state and props of a component and instantly see the results in the page.</p><figure><img alt="Live edit state and props" src="https://cdn-images-1.medium.com/max/1024/1*3RLDGKkZngCzfuxi61kA5Q.gif" /></figure><h3>2. Search Through Tree</h3><p>The search bar comes handy when you want to quickly find and jump to a component in the tree. Now that the <strong>Dev Tools can remember stuff </strong>the <strong>selected node is saved between reloads</strong> and you don’t have to repeat the action every time you reload the page.</p><figure><img alt="Search through tree" src="https://cdn-images-1.medium.com/max/1024/1*0c1JIHJRs1N9RX2JBa4BKA.gif" /></figure><h3>3. Component Filter</h3><p>Filter is a powerful feature to reduce visual noise and focus on what matters at the moment in a huge tree. You can filter with a variety of options like context, HOCs, host(DOM) nodes, component name, etc.</p><figure><img alt="Component filter" src="https://cdn-images-1.medium.com/max/1024/1*ChPXzBXxRTPXkElTgVSZ9Q.gif" /></figure><h3>4. Rendered By</h3><p>Rendered By is a list of <strong>owner/parent components </strong>that rendered the selected component. You can quickly jump to a parent component by selecting an entry from the list.</p><figure><img alt="Rendered by" src="https://cdn-images-1.medium.com/max/1024/1*ekuimJhLzc1JxDLNLY0jlQ.gif" /></figure><h3>5. Owners Tree</h3><p>Owners Tree gives you an <strong>eagle eye view</strong> of a particular component and its sub-tree and hides the rest of the component tree.</p><p>To enter into owners tree view, you have to <strong>double click</strong> a component in the tree.</p><figure><img alt="Owners tree" src="https://cdn-images-1.medium.com/max/1024/1*8-rJTh6j0StDr959kAzOkA.gif" /></figure><h3>6. Quick Navigation</h3><p>Switching between Elements tab (browser dev tools) and Components tab (react dev tools) is pretty easy and the corresponding node is auto selected in these tabs.</p><p>To find the corresponding DOM node in the Elements tab, <strong>select the component and click the small eye icon</strong> on the right pane. It will take you to the Elements tab with the corresponding DOM node selected.</p><p>To find the corresponding React node from Elements tab, <strong>just select a node in Elements tab and click the Components tab</strong>. React Dev Tools will automatically select the corresponding component.</p><figure><img alt="Quick navigation" src="https://cdn-images-1.medium.com/max/1024/1*yrboX0DNGA5hzPbwkvyuGA.gif" /></figure><h3>7. Utils</h3><p>Components tab offers three small handy utils.</p><ol><li>Suspend component</li><li>Inspect matching DOM element</li><li>Log component data to console</li></ol><h4>Suspend Component</h4><p>You can easily switch between the waiting(loading) and resolved states of <a href="https://reactjs.org/docs/code-splitting.html#reactlazy"><strong>Suspense</strong></a><strong> </strong>components.</p><figure><img alt="Suspend component" src="https://cdn-images-1.medium.com/max/1024/1*fsayD-RnFvWKAN2WTiJvog.gif" /></figure><h4>Inspect matching DOM element</h4><p>We already saw this in <strong>Quick Navigation</strong>. You can select a component and click the <strong>eye icon</strong> on the right pane to jump to its corresponding node in Elements tab to inspect it.</p><figure><img alt="Inspect matching DOM element" src="https://cdn-images-1.medium.com/max/1024/1*4vA7mDDmbOdBPyugPfGCBw.gif" /></figure><h4>Log component data to console</h4><p>This is a handy utility that logs the entire component meta data to the console. The log gives details like props, hooks, corresponding DOM nodes and the component file location in the file system.</p><p>To log component data to console, select the component and <strong>click the small bug icon in the right pane</strong>.</p><figure><img alt="Log data to console" src="https://cdn-images-1.medium.com/max/1024/1*7oO2We69Q6vjUUiprakBMA.gif" /></figure><h3><strong>Intro to Profiler</strong></h3><p>The next three features are going to be about the Profiler. Before diving into them, we’ll take a look at how profiler works and the key metrics that are used during profiling.</p><p>Every profiling session has two important colour graphs —</p><ol><li>Commit graph</li><li>Component graph</li></ol><figure><img alt="Profiler intro" src="https://cdn-images-1.medium.com/max/1024/1*s8gkGYrZfDHDyyiep6-_0w.png" /></figure><h4>Commit Graph</h4><p>Commit graph gives you a list of commits (whole tree) during the session. <strong>Each commit denotes a user activity or side-effect that triggered a render in the tree .</strong>You will see it coloured from orange to green with <strong>orange</strong> denoting the <strong>costliest</strong> (took most time) commit and <strong>green</strong> denoting the <strong>cheapest</strong> (took least time) commit.</p><h4>Component Graph</h4><p>Component graph gives you info on which component rendered <strong>during a single commit</strong>. You can select each commit from the commit graph to see its component graph. It is also colour coded with cost information —</p><ol><li><strong>Dark Grey</strong> — Component did <strong>not</strong> render but a <strong>part of its sub-tree</strong> rendered</li><li><strong>Transparent Grey </strong>— <strong>Neither</strong> the component nor its subtree rendered</li></ol><p>3. <strong>Coloured</strong> — <strong>Both</strong> the component and its entire subtree rendered</p><h3>8. Profile Initial Mount</h3><p>Initial mount and first render is usually a perf heavy op in most React applications. In older versions of Dev Tools, it was impossible to profile and audit the initial mount phase. But the latest version provides an option to profile and audit the initial mount.</p><figure><img alt="Profile initial mount" src="https://cdn-images-1.medium.com/max/1024/1*lPsmgceapwprlUyIyHPArg.gif" /></figure><h3>9. Why Did This Render?</h3><p>This is the most powerful feature of the Dev Tools yet and it tells you why a component rendered during a profiling session. A component might have rendered for one or many of these reasons —</p><ol><li>Props changed</li><li>State changed</li><li>Hooks changed</li><li>Parent component rendered</li></ol><p>You can profile an activity and see why a component rendered during the profiling session <strong>to spot weak links</strong> and prevent unnecessary renders in the tree.</p><figure><img alt="Why did this render" src="https://cdn-images-1.medium.com/max/1024/1*oTZB8QDpdg65pRVSvKMgyA.gif" /></figure><p><em>Note: You have check this setting — “Record why each component rendered while profiling” to see this info in the right pane of the Profiler Tab.</em></p><h3>10. Rendered At</h3><p>Rendered At info on the right pane gives you two time metrics —</p><ol><li>When exactly the component rendered during the profiling session</li><li>How long it took for the component to render during the profiling session</li></ol><p>Eg. <strong>2.2s for 2.3ms</strong></p><p>Here, <strong>2.2s</strong> means the component rendered at <strong>2.2s(2200ms)</strong> from the start of the profiling session which is <strong>0s</strong>. And <strong>2.3ms</strong> is the amount of time it took for the component to render.</p><figure><img alt="Rendered at" src="https://cdn-images-1.medium.com/max/1024/1*YzgMYR2S7lSRsAZLgESoWA.gif" /></figure><p>That’s all folks.</p><p>If you’re interested in exploring all the features, the React team has built a site just for that — <a href="https://react-devtools-tutorial.now.sh">Interactive Dev Tools</a>.</p><p>Play around with Dev Tools and drop a comment below or <a href="https://twitter.com/intent/tweet/?text=Hey%20@flexdinesh%20I%20read%20your%20post%20about%20@reactjs%20Dev%20Tools%20">start a conversation</a> with the author in <a href="https://twitter.com/intent/tweet/?text=Hey%20@flexdinesh%20I%20read%20your%20post%20about%20@reactjs%20Dev%20Tools%20">Twitter</a> on what you think.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c3a5d09895c6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-thinkmill/react-dev-tools-debug-like-a-ninja-c3a5d09895c6">React Dev Tools — Debug Like a Ninja</a> was originally published in <a href="https://medium.com/the-thinkmill">Thinkmill</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>