<?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 M Gopalakrishnan on Medium]]></title>
        <description><![CDATA[Stories by M Gopalakrishnan on Medium]]></description>
        <link>https://medium.com/@mgopalakrishnan0211?source=rss-4587c8806cbb------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*znTUHKvK645PyyayebTw8A.jpeg</url>
            <title>Stories by M Gopalakrishnan on Medium</title>
            <link>https://medium.com/@mgopalakrishnan0211?source=rss-4587c8806cbb------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 04:51:47 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mgopalakrishnan0211/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[What is AMP?]]></title>
            <link>https://mgopalakrishnan0211.medium.com/what-is-amp-c322ade78631?source=rss-4587c8806cbb------2</link>
            <guid isPermaLink="false">https://medium.com/p/c322ade78631</guid>
            <category><![CDATA[amp]]></category>
            <category><![CDATA[dom-reflow]]></category>
            <category><![CDATA[accelerated-mobile-pages]]></category>
            <category><![CDATA[how-amp-works]]></category>
            <category><![CDATA[amp-validations]]></category>
            <dc:creator><![CDATA[M Gopalakrishnan]]></dc:creator>
            <pubDate>Sun, 29 Nov 2020 10:01:28 GMT</pubDate>
            <atom:updated>2020-11-29T10:01:28.394Z</atom:updated>
            <content:encoded><![CDATA[<p>AMP stands for Accelerated Mobile Page and represented with this symbol.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/39/0*_45D0BWdTGjpv6Nu" /></figure><p>It is an open-source HTML framework developed by the AMP Open-Source Project. It was originally created by Google as a competitor to Facebook Instant Articles and Apple News. AMP is optimized for mobile web browsing and intended to help web pages load faster.</p><p>It is primarily used to build static content pages to ensure that the content is rendered as quickly as possible. There are only a few extra extensions needed for the rich content, as well as some restrictions that ensure a reliable performance.</p><p><strong>What is DOM reflow?</strong></p><p>A reflow computes the layout of the page. A reflow on an element recomputes the dimensions and position of the element, and it also triggers further reflows on that element’s children, ancestors and elements that appear after it in the DOM. Then it calls a final repaint. Reflowing is very expensive, but unfortunately it can be triggered easily. Reflow occurs when you:</p><ul><li>insert, remove or update an element in the DOM</li><li>modify content on the page, e.g. the text in an input box</li><li>move a DOM element</li><li>animate a DOM element</li><li>take measurements of an element such as offset Height or getComputedStyle</li><li>change a CSS style</li><li>change the className of an element</li><li>add or remove a stylesheet</li><li>resize the window</li><li>scroll</li></ul><p><strong>How many AMP categories are available?</strong></p><p>Using Basic Knowledge of AMP HTML tags and CSS we can develop:</p><ol><li>AMP Website</li><li>AMP Story</li><li>AMP Ads</li><li>AMP E-Mails</li></ol><p>The AMP Validator isn’t just a convenience for you during development. It’s also used by platforms like Twitter or Google who integrate your AMP pages into their content and search results. More so, they usually don’t request the pages directly from your server but make use of the Google AMP Cache, a free service that caches your pages and makes them available across the world, so they load even faster.</p><h4><strong>How Does AMP Work?</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/0*mMT66X7E95zxYW-s" /></figure><ol><li>JavaScript may be used to modify almost any portion of a web page, but it may also be used to block DOM construction and delay the rendering of pages. To avoid the delay of rendering pages because of JavaScript, AMP allows for only asynchronous JavaScript.</li><li>Resources that are external, like iframes, ads, or images, must state their size within the HTML of the page so that AMP is able to determine the size of each element as well as its position before all the resources are downloaded. AMP will load the layout of the page before the resources have been downloaded.</li><li>Using AMP HTML, the only styles that are allowed are those that stay inline. Additionally, the inline sheet of style has a threshold of 50 kilobytes. This size is large enough for even the most sophisticated pages.</li><li>AMP helps pages to load extremely quickly. Preconnected API (Application Programming Interface) is a new system that is used to make sure that HTTP requests are successful as soon as possible. This page is likely to be ready by the time that the user physically selects on it, allowing for the instant loading of the page. This type of prerendering can be applied to content on the web, but it can likewise take up a lot of CPU and bandwidth. Both these things can be reduced by using AMP.</li><li>Every time that something is measured on a page, it will trigger a recalculation of the style. This is expensive because the web browser has to adjust the entire page layout. Within AMP pages, all the DOM readings happen before anything is written.</li></ol><p>The Style &lt;amp-boilerplate&gt; tag initially hides the content of the body until the AMP JavaScript library is loaded, then the content is rendered. AMP does this to prevent unstyled content from rendering, also known as Flash Of unstyled Content (FOUC).</p><blockquote>&lt;style amp-boilerplate&gt;</blockquote><blockquote>body{</blockquote><blockquote>-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;</blockquote><blockquote>-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;</blockquote><blockquote>-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;</blockquote><blockquote>animation:-amp-start 8s steps(1,end) 0s 1 normal both</blockquote><blockquote>}</blockquote><blockquote>@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</blockquote><blockquote>@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</blockquote><blockquote>@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</blockquote><blockquote>@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</blockquote><blockquote>@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</blockquote><blockquote>&lt;/style&gt;</blockquote><blockquote>&lt;noscript&gt;</blockquote><blockquote>&lt;style amp-boilerplate&gt;</blockquote><blockquote>body{</blockquote><blockquote>-webkit-animation:none;</blockquote><blockquote>-moz-animation:none;</blockquote><blockquote>-ms-animation:none;</blockquote><blockquote>Animation:none</blockquote><blockquote>}</blockquote><blockquote>&lt;/style&gt;</blockquote><blockquote>&lt;/noscript&gt;</blockquote><p>This is done to ensure that the maximum of a single recalculation of styles per frame. When a property, such as layout, is changed, it edits the geometry of the website like its height and width. When the layout is edited, the browser needs to check all other elements and reorganize the flow of the page. All the areas that are influenced by this will need to be recalculated and then these elements will need to be composited back together again.</p><p><strong>What are the rules to be followed?</strong></p><ol><li>With AMP, you must use a streamlined version of CSS.</li><li>You are only permitted to use the JavaScript library that AMP provides — since you are not in control, you may experience lazy loading. This might be the only downside to AMP.</li><li>For AMP sites to work every time, they must be properly validated.</li><li>No forms are allowed on AMP plugin pages.</li><li>For a better experience, custom fonts must be specially loaded.</li><li>To avoid quirky-looking images, make sure to declare height and width with AMP image Tags.</li><li>Use AMP-approved extensions if you want to have videos on your page.</li></ol><p><strong>How to check a Page is AMP Validated?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/710/0*CA5p3hy7ZF1-1v4N" /></figure><h4><strong>Example of AMP Pages in Real World</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/502/0*rXKGdMkbQuEo5hhI" /></figure><p><strong>Advantages of AMP</strong></p><ul><li>Insanely fast-loading web pages that users love</li><li>Increased mobile browser visibility for content marketers</li><li>Improved mobile search engine rankings</li><li>Flexible ad support</li><li>User tracking made simple</li></ul><p><strong>Disadvantages of AMP</strong></p><ul><li>No JavaScript will be allowed other than an <a href="https://github.com/ampproject/amphtml/tree/master/src">off-the-shelf AMP library</a></li><li>Images will only load when you scroll down to them (lazy load functionality)</li><li>A streamlined version of your CSS will be required</li></ul><p>Normally, When a page is not optimized for mobile use, you risk the chance of increased bounce rates — 40% of users leave a page if it does not load within 3 seconds. The end product of AMP drastically improves the performance of mobile websites on the internet — so much so that the load time is often appearing to be instant.</p><p>Faster mobile pages + readable content = better user experience</p><p>It consists of normal HTML with a few restrictions and added specialized tags and does not require a lot of additional work. AMP JS works to make sure that the most important content is loaded quickly and clearly, while third party content such as ads are not at the forefront so that users will see their preferred content as soon as possible. AMP has discovered that content that loads quickly leads to faster reading, and in turn that results in more consumption.</p><p><strong>Conclusion</strong></p><p>AMP is incredibly powerful. As an upgrade to mobile-friendly pages, it helps you meet Google’s expectations that you optimize your site for speed.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c322ade78631" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduction to Styled-Components]]></title>
            <link>https://mgopalakrishnan0211.medium.com/introduction-to-styled-components-4f258515f4e9?source=rss-4587c8806cbb------2</link>
            <guid isPermaLink="false">https://medium.com/p/4f258515f4e9</guid>
            <category><![CDATA[styled-components]]></category>
            <category><![CDATA[css-in-js]]></category>
            <category><![CDATA[css3]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[emotions]]></category>
            <dc:creator><![CDATA[M Gopalakrishnan]]></dc:creator>
            <pubDate>Sat, 07 Mar 2020 14:32:44 GMT</pubDate>
            <atom:updated>2020-03-07T14:53:33.722Z</atom:updated>
            <content:encoded><![CDATA[<h3>What are Styled Components?</h3><p>Styled Components is a CSS-in-JS styling framework that uses tagged template literals in Javascript and the awesome power of CSS to provide a platform that allows you to write actual CSS to style react Components. With Styled Components we don’t have to worry about class name collisions.</p><p>In essence, Styled Components are easy-to-make react components you write with the styled-components library, which are the new ways to use CSS in modern JavaScript. It is said to be the successor of CSS Modules, a way to write CSS that’s scoped to a single Component, and not leak to any other element on the page.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d0826f52ec9f2d070a90cada585f6eed/href">https://medium.com/media/d0826f52ec9f2d070a90cada585f6eed/href</a></iframe><p>We use Backtick (`) which is called Tagged Templates, it’s plain JavaScript and it’s a way to pass an argument to the function.</p><p>Not only Buttons, like section, h1 but also input and many more where Styled Components offer other functions you can use to create other components. This is how styled-components render CSS in JavaScript.</p><p>It is not pseudo CSS but an inline CSS with its limitations and is a regular CSS that we already know. We can use media queries ( To make Responsive websites ), nesting and anything else we might need.</p><h3>Installation:</h3><p>Adding Styled Components is one of the easiest things. We just need to install it using NPM or Yarn and add an import statement in all the files in which you are going to use styled Components.</p><p>Install styled-components using npm or yarn:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8e22cdef86984a81ff3e655c61777129/href">https://medium.com/media/8e22cdef86984a81ff3e655c61777129/href</a></iframe><p>That’s it! Now you have to add this to import:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/187d6a087548e7046e69e990c0786b83/href">https://medium.com/media/187d6a087548e7046e69e990c0786b83/href</a></iframe><h3>Problem Faced in current CSS / SCSS we use in our application:</h3><p>Types of CSS we use in our Product.</p><ol><li>Traditional CSS</li><li>SASS (A preprocessor)</li><li>Inline CSS</li></ol><p><strong>1. Traditional CSS:</strong></p><p>it is stored in external CSS files, which then pass a string as the className prop to reference them like so:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8eed9c6d547185272c593e593b9acf96/href">https://medium.com/media/8eed9c6d547185272c593e593b9acf96/href</a></iframe><p>If we have worked with a large web application, we can attest to the fact that the CSS files begin to get really bulky, clumsy and very complex. So SASS came into existence.</p><p>Although SASS helps, it starts to become the same thing with the sheer number of SCSS files a project can have and the abstraction starts to even become complex in itself.</p><p><strong>2. SASS:</strong></p><p>These are also stored in external CSS files, and we pass a string as the className prop to reference them. This kind is especially used to align and rearrange the code structure in a simple way. So that we don’t need to create a new className for each HTML element. Though we can write nested styles, it still becomes clumsy and cloudy while writing a large application.</p><p><strong>3. Inline CSS :</strong></p><p>In JSX, Javascript expressions are written inside curly braces, and since JavaScript objects also use curly braces, the styling is written inside two sets of curly braces “{{}}”. Since it is written in a Javascript object, properties with two names, like background-color, must be written with camel case syntax as shown below.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ea4b7cc0bf41161ea7202917402bb28e/href">https://medium.com/media/ea4b7cc0bf41161ea7202917402bb28e/href</a></iframe><h3>Styled Components Libraries:</h3><p>There are many Libraries in Styled Components that can be used in our Application. But there are only a few which satisfy our needs. all the Libraries regarding Styled Components are listed below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7oUy3UW16j0zlhEE" /></figure><p>Emotion is one of the Famous and most rated Styled Components in Github and kind of supports all the extensions needed.</p><h3>Pros and Cons of Styled Components:</h3><p>There are many advantages in using Styled Components. Some are:</p><ol><li><strong>Freedom to Build Custom components with CSS</strong></li></ol><p>With Styled-Components, the UI design focus shifts from just merely styling HTML elements or React components through className to defining styled components that contain their own styles and are so easily reusable across the entire project.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1fea025a6638429cc567044b6d07a606/href">https://medium.com/media/1fea025a6638429cc567044b6d07a606/href</a></iframe><p>We can define style like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fd3fe6fb7ddfb41fe3dee13f034fa335/href">https://medium.com/media/fd3fe6fb7ddfb41fe3dee13f034fa335/href</a></iframe><p>Would be converted like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/01924864c236beada914c1fa56154c72/href">https://medium.com/media/01924864c236beada914c1fa56154c72/href</a></iframe><p>Now we can add classname’s and append new styles to it.</p><ol><li><strong>Inline Styling:</strong></li></ol><p>But with styled-components, we can see a kind of inline styling, here is a sample code for demo:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/37a96da4fd1c9977bb3fecdfea9ab56a/href">https://medium.com/media/37a96da4fd1c9977bb3fecdfea9ab56a/href</a></iframe><p>Compile output:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9057dd9f1deb03621fec1860b5c0eeda/href">https://medium.com/media/9057dd9f1deb03621fec1860b5c0eeda/href</a></iframe><p>But with styled-components…</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/148acc4bf4de4a5f16d37962a1687baa/href">https://medium.com/media/148acc4bf4de4a5f16d37962a1687baa/href</a></iframe><p>Above HashNumber are created internally using given styles and these are converted on the basis of ComponentID and evaluatedStyles.</p><p><strong>3. No-Class Policy:</strong></p><p>Styled-components enforce the use of props in the place of classes. This no-class policy has helped them make more developers tow the route of best practices for controlling the behavior of a component.</p><p>Initially, you would write:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b12ae3dcc66f1f5d9a58104200e61af4/href">https://medium.com/media/b12ae3dcc66f1f5d9a58104200e61af4/href</a></iframe><p>But now, it should be like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bc2b4afcdd92603eba6a871f2cdcb4b9/href">https://medium.com/media/bc2b4afcdd92603eba6a871f2cdcb4b9/href</a></iframe><p><strong>Cons:</strong></p><ul><li>It increases Paint time.</li><li>The styled-components community is small and they might not get enough support and as early as they need it. In case of difficult bugs, cases or errors must be used..</li><li>Some say the performance of the application gets downgraded with an increase in load but from Styled Components V4. it has improved, though not up to the mark.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*P53oZYG8tFkQlwMv" /></figure><p>Styled Components Mounting and updating Component trees benchmark explained below with the image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*rFJ00XDKx8WhMAxt" /></figure><h3>References:</h3><p><strong><em>Tagged Template Literals:</em></strong></p><ul><li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals">https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals</a></li><li><a href="https://exploringjs.com/es6/ch_template-literals.html">https://exploringjs.com/es6/ch_template-literals.html</a></li></ul><p><strong><em>Styled Components:</em></strong></p><ul><li><a href="https://blog.logrocket.com/8-reasons-to-use-styled-components-cf3788f0bb4d/">https://blog.logrocket.com/8-reasons-to-use-styled-components-cf3788f0bb4d/</a></li><li><a href="https://flaviocopes.com/styled-components/">https://flaviocopes.com/styled-components/</a></li><li><a href="https://www.styled-components.com/docs/api">https://www.styled-components.com/docs/api</a></li><li><a href="https://medium.com/styled-components/how-styled-components-works-618a69970421">https://medium.com/styled-components/how-styled-components-works-618a69970421</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4f258515f4e9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>