<?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 Renganatha Arunachalam on Medium]]></title>
        <description><![CDATA[Stories by Renganatha Arunachalam on Medium]]></description>
        <link>https://medium.com/@renganatha10?source=rss-78fb732d89db------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*1OBYZ41H3YyMQd5U9CWiew.jpeg</url>
            <title>Stories by Renganatha Arunachalam on Medium</title>
            <link>https://medium.com/@renganatha10?source=rss-78fb732d89db------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 17:16:19 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@renganatha10/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[A better way of Handling on error and loading state and its component in Apollo GraphQL]]></title>
            <link>https://medium.com/@renganatha10/a-better-way-of-handling-on-error-and-loading-state-and-its-component-in-apollo-graphql-2a42419debb0?source=rss-78fb732d89db------2</link>
            <guid isPermaLink="false">https://medium.com/p/2a42419debb0</guid>
            <category><![CDATA[graphql]]></category>
            <category><![CDATA[react-apollo]]></category>
            <category><![CDATA[apollo-client]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Renganatha Arunachalam]]></dc:creator>
            <pubDate>Fri, 30 Nov 2018 10:45:03 GMT</pubDate>
            <atom:updated>2018-11-30T10:45:03.550Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4vBsDON_I5R0Eq3zrhhMzQ.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/photos/63JKK67yGUE?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Graham Holtshausen</a> on <a href="https://unsplash.com/collections/3475602/newest?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Apollo Client is one of the many state management libraries in React. The main focus of it is to support state management for GraphQL based backends.</p><h4><strong>There are lots of things to love about Apollo Client, </strong>namely:</h4><ul><li>Declarative Approach</li><li>Data Normalization</li><li>Fetch Policies</li><li>The declarative way of polling</li><li>The declarative way of refetching</li><li>Error management</li><li>Cache management</li></ul><p>Everything else is smooth, but <strong>handling the loading state and error state and its corresponding components on each screen</strong> where a GraphQL query is being used to give that component a larger boilerplate and eventually a file, becomes <strong>hard to maintain.</strong></p><h4>The tougher of handling error and loading state 😟</h4><p>Take a look into this usual component which uses graphql and compose from react apollo to compose three different queries.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9zeJGEPLfVHvee726ge36w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/808/1*wHfLH9-Aw_JSVdnVSGDzdQ.png" /></figure><p>This above component has <strong>three different error state and loading state</strong> and we have to check each one before rendering a view using proper query data to avoid a crash. Same way you have handle all the similar component in the project. It can be even 10, 20 or 100 components . Sounds Hard?.</p><h4>Easy Way of handling error and loading state 😇</h4><p>What if I use the same syntax as of usual graphql and compose but not to manage the error and loading state of each query in each component</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*87uhm1VKHEGel_R8EswW5A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*3eBYYvHVQbObiz7MX0O8vA.png" /><figcaption>Component with render function and its hoc</figcaption></figure><p>Does it look good 😎 ?. You<strong> don’t need to worry about the error and loading state</strong>. commonQueryHoc will handle it and you can concentrate on your render logic using proper data.</p><h3><strong>Comparing Render Functions</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9zeJGEPLfVHvee726ge36w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*87uhm1VKHEGel_R8EswW5A.png" /><figcaption>Comparison Of Both Component</figcaption></figure><h3>Code for commonQueryHOC 😍</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/603664822af4845091580c7878668683/href">https://medium.com/media/603664822af4845091580c7878668683/href</a></iframe><blockquote>You can import this commonQueryHoc instead of graphql and compose.</blockquote><p>HI 👋! I am <a href="https://twitter.com/renganatha10">Renganatha</a>. I work on ReactNative, React, NodeJS at <a href="https://www.geekyants.com/">Geekyants</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2a42419debb0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My Experience With Progressive Web Apps]]></title>
            <link>https://medium.com/progressive-web-apps/my-experience-with-progressive-web-apps-348058714eee?source=rss-78fb732d89db------2</link>
            <guid isPermaLink="false">https://medium.com/p/348058714eee</guid>
            <category><![CDATA[webpack]]></category>
            <category><![CDATA[progressive-web-app]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Renganatha Arunachalam]]></dc:creator>
            <pubDate>Thu, 27 Apr 2017 09:07:21 GMT</pubDate>
            <atom:updated>2017-04-27T09:08:49.109Z</atom:updated>
            <content:encoded><![CDATA[<p>Progressive Web Apps is a paradigm to make webapp more efficient on mobile devices. They are the future.</p><p>I built a Progress Web App of WhatsApp Web using Webpack 2.0, React and Express.</p><p>Note: This is not a complete clone of WhatsApp Web but minimal one to have an understanding of how to create a PWA app.</p><p><a href="https://github.com/rengasahusoft/whatspp-PWA">rengasahusoft/whatspp-PWA</a></p><h3>Case Study</h3><p>Main aim of PWA apps should be making the load time of webapp faster.</p><h3>Server Side Rending</h3><p>Server Side Rendering (App shell architecture) is a way of making the load time faster without JavaScript . Initially we can render a simple HTML, CSS as string from the server. Once the DOM is loaded JS will take over the website (Isomorphic more precisely).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HbZww24UkUAYTLOnfNBdmA.png" /><figcaption>Sample Code of match api from react-router</figcaption></figure><h3>Bundling</h3><p>Various ways are available to bundle the app with minimum size using Webpack.</p><p>I say separating the vendor libraries and components is the best way to reduce the bundling size. Vendor can be browser cached and can be served for multiple request and app components can be attached with build id as app.12312.js to serve as new file for every requests.</p><p>Webpack’s <a href="https://webpack.js.org/plugins/commons-chunk-plugin/">commonChunksPlugin </a>can be used to create a common chunk as separate bundle from source code.</p><p>Gzip all the resources used on the webApp using <a href="https://github.com/webpack-contrib/compression-webpack-plugin">CompressionPlugin</a>.</p><p>Use <a href="https://github.com/developit/preact">Preact </a>instead of React to further reduce bundled size. Add the following lines of code in webpack.config.js to use React.</p><pre>resolve: {<br>    alias: {<br>      react: &#39;preact-compat&#39;,<br>      react-dom: &#39;preact-compat&#39;<br>    }<br> }</pre><p>Plugins like <a href="https://webpack.js.org/configuration/plugins/#plugins">AggressiveMergingPlugin</a>, <a href="https://webpack.js.org/configuration/plugins/#plugins">OccurrenceOrderPlugin </a>are also used to reduce the bundle size.</p><h3>Code Splitting</h3><p>Web pack 2.0 provides a nice way to do the code splitting.</p><p>System.resolve is the way to split the code. Webpack reads for it and creates separate bundles.</p><pre>if (this.props.routeName !== nextProps) {<br>      if (routeName === 2) {<br>        System.import(&#39;./Messages&#39;).then(Component =&gt; {<br>          this.messageComponent = Component.default;<br>          this.forceUpdate();<br>        });<br>      }<br>      if (routeName === 3) {<br>        System.import(&#39;./Details&#39;).then(Component =&gt; {<br>          this.detailsComponent = Component.default;<br>          this.forceUpdate();<br>        });<br>      }<br> }</pre><p>You can see how I have done that for two components which results as below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t3MOaztqPS4uENB_UP-syw.png" /><figcaption>Various bundles based on bundling</figcaption></figure><p>If you examine the above picture Webpack have created four bundles (app.js, bundle.vendor.js, bundle.0.js and bundle.1.js).</p><p>This is because I have separated the app.js for components and vendor.js for Vendor libraries. The remaining two bundles are precisely due to code splitting.</p><p>react-router can be used for Route based splitting out of box with Webpack</p><h3>Workers From Web</h3><p>Web workers and Service workers are most useful feature from web. Both the workers have no access to DOM.</p><p>Web Workers are use to do heavy operation in separate thread of browser and return result to the web app.</p><p>Service workers are useful for caching the request. It acts as an intermediate for every request and caches it. If the same request is made again it responds from SW. Once the responses have arrived from the server, Service Workers replace the particular response from cache. Service Workers are useful receiving Push and doing background sync</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/006b8bf91d537be0ac5436a9d4dece90/href">https://medium.com/media/006b8bf91d537be0ac5436a9d4dece90/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Sy85TBYCjWvXMXOiMY9kXQ.png" /><figcaption>Same Response from the Service Worker</figcaption></figure><h3>More Techniques</h3><ul><li>Webpack 2.0 uses treeShaking feature which is use for leaving the un- imported code from bundles.</li><li>Use pre-cache (resource need urgently), pre-fetch(resource may be needed in feature) and defer. All three attributes are used for loading the scripting without blocking onLoad function.</li><li>Use Web manifest.json to have Native feel when users does Add to Home Screen in Mobile.</li><li>Use <a href="https://chrome.google.com/webstore/detail/lighthouse/blipmdconlkpinefehnmjammfjpmpbjk?hl=en">LightHouse</a> Chrome extension to validate your website</li></ul><h3>Useful Articles</h3><ol><li><a href="https://medium.com/@addyosmani/progressive-web-apps-with-react-js-part-i-introduction-50679aef2b12">Progressive web app with with React.js</a> — Four parts</li><li><a href="https://medium.com/reloading/preload-prefetch-and-priorities-in-chrome-776165961bbf">preload-prefetch-and-priorities-in-chrome</a></li><li><a href="https://medium.com/@paularmstrong/twitter-lite-and-high-performance-react-progressive-web-apps-at-scale-d28a00e780a3">Twitter Lite</a></li><li><a href="https://hackernoon.com/how-i-built-a-super-fast-uber-clone-for-mobile-web-863680d2100f">Uber Clone</a></li><li><a href="https://calendar.perfplanet.com/2016/prefer-defer-over-async/">Prefer defer over Async</a></li><li><a href="https://medium.com/webpack/webpack-bits-getting-the-most-out-of-the-commonschunkplugin-ab389e5f318">Getting most out of CommonChunksPlugin</a></li><li><a href="https://medium.com/@adamrackis/vendor-and-code-splitting-in-webpack-2-6376358f1923">Vendor and Code Splitting in Webpack</a></li><li><a href="https://hackernoon.com/webpack-loaders-and-plugins-for-your-new-progressive-web-app-378e09f469?source=user_profile---------1-----------">Useful webpack plugins</a></li><li>The <a href="https://developers.google.com/web/fundamentals/instant-and-offline/offline-cookbook/">Offline Cookbook</a></li><li><a href="https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/http-caching">Http Browser Caching</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=348058714eee" width="1" height="1" alt=""><hr><p><a href="https://medium.com/progressive-web-apps/my-experience-with-progressive-web-apps-348058714eee">My Experience With Progressive Web Apps</a> was originally published in <a href="https://medium.com/progressive-web-apps">Progressive Web Apps</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>