<?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 Gianluca Guarini on Medium]]></title>
        <description><![CDATA[Stories by Gianluca Guarini on Medium]]></description>
        <link>https://medium.com/@gianluca-guarini?source=rss-92b191c27840------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*E2D9nf7K8upbrXUGEggeHw.jpeg</url>
            <title>Stories by Gianluca Guarini on Medium</title>
            <link>https://medium.com/@gianluca-guarini?source=rss-92b191c27840------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 20:42:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@gianluca-guarini/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[Can we replace our mobile native apps with PWAs? I have tried it…]]></title>
            <link>https://gianluca-guarini.medium.com/can-we-replace-our-mobile-native-apps-with-pwas-i-have-tried-it-ea6f4c883bc6?source=rss-92b191c27840------2</link>
            <guid isPermaLink="false">https://medium.com/p/ea6f4c883bc6</guid>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[native]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[pwa]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Gianluca Guarini]]></dc:creator>
            <pubDate>Sat, 24 Apr 2021 14:26:57 GMT</pubDate>
            <atom:updated>2021-04-26T12:54:54.933Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IrhQv4Gvz60iz2ch70rolg.jpeg" /></figure><h3>Introduction</h3><p>There are plenty of articles online about PWAs, and therefore I will not describe what they are nor dig about their implementation details. <strong>I will only present my personal experience as a Software Developer</strong>, trying to stay away from biased opinions.</p><h3>Migrating from Native to PWA</h3><p>All started as a challenge to myself:</p><h3>Gianluca Guarini on Twitter: &quot;I will replace for 1 month all my native apps with their respective PWAs (whenever it&#39;s possible) to see how does it feel. #javascript to the rescue! / Twitter&quot;</h3><p>I will replace for 1 month all my native apps with their respective PWAs (whenever it&#39;s possible) to see how does it feel. #javascript to the rescue!</p><p>Being an Android user, the first apps I wanted to replace were the Google ones. With my big surprise Google Maps, Calendar, Gmail and Youtube don’t have PWAs!</p><figure><img alt="Google calendar on a mobile device" src="https://cdn-images-1.medium.com/max/606/0*HNYsMsLnPB0bQD97" /><figcaption>The Google calendar UI seems to come directly from 2010</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/606/0*KeawZ050s14_3RaY" /><figcaption>Google Maps on mobile wants you to install their native app</figcaption></figure><p><strong>Google seems to push only their native apps. That&#39;s sad, considering the incredible effort they put promoting web standards and developing new javascript APIs to fill the gap between native and web. </strong>Google gives us mobile web applications barely resembling what their respective native apps can do.</p><p>At this point I had to ignore the Google apps and focus on the others I use regularly: Twitter, Spotify, Instagram and Facebook (FB was more a test, I don’t use it anymore).</p><p>The steps to install a PWA are really straight forward</p><ol><li>Open Chrome</li><li>Browse to the site you want to install (for example: <a href="http://www.twitter.com/">www.twitter.com</a>)</li><li>Open the browser settings to tap “Install App”</li><li>(optional) Delete the native app if installed on your device</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/386/0*ZUMtX1P9W6OhIhIN" /><figcaption>Chrome PWA installation Call to Action</figcaption></figure><h3>My First Impression</h3><p>Twitter and Spotify are really well crafted (kudos to their Dev Team), but Facebook and Instagram immediately showed up some problems.</p><p>To me it seems clear that Facebook wants you to install their native apps exactly like Google does. Indeed m.facebook.com doesn’t even bother removing the browser address bar while instagram keeps prompting you with their native app installation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/606/0*YHYNfnwt2x4oMXmO" /><figcaption>I have just installed the Instagram PWA! Why are you asking me to install the native app?</figcaption></figure><p><strong>The Facebook PWAs are too minimal and can’t compete with their respective native apps.</strong> They lack many features, and it seems no effort has been made to improve the user experience on mobile web devices.</p><p><strong>On the other hand Twitter and Spotify work really well</strong>. Spotify can play music in the background and switch songs also when my phone is locked while Twitter pushes notifications like a native app without any perceivable drawback.</p><p>Even if Twitter and Spotify SPAs look exactly like native apps, I noticed that some UI elements don’t feel smooth like when they were native (I expected it a bit as well): animations, loaders, and transitions between views are a bit raw and clunky.</p><h3>One Month After the Migration</h3><p>One month after my migration I am still using regularly all the PWAs mentioned above without big concerns. I got somehow used to them and I don’t miss the native apps at all. Instagram and Facebook are a bit painful to use, but I don’t use them that often to complain much about it.</p><p>I am really happy with Spotify though. Often the native app used to crash when the internet connection was bad and I had to completely restart it. This issue was really annoying especially while driving my auto.</p><p>Using the PWA, in case of issues, I can simply fix them by reloading it (with a “pull to refresh”).</p><p>In the meantime Twitter feels so good that I can’t understand why someone should ever need to install it as native app.</p><h3>Conclusion</h3><p>It has been really fun to test such a new technology. I have learned a lot and think that PWAs represent really the future for many products previously developed as native apps (of course that&#39;s not always the case).</p><p>These PWAs features are too good to be ignored in 2021:</p><ul><li>no updates needed (you load always the latest app version)</li><li>ease of use and distribution (no marketplaces)</li><li>good performance (no performance issues were noticed)</li><li>portability (no need to create several versions of the same app)</li></ul><p>I am a bit disappointed that companies like Facebook and Google, having so many resources to invest on their web products, still force users to use their native apps.</p><p><strong>I believe the future for web developers will be bright and inspiring and I am happy that the community is moving forward in the right direction.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ea6f4c883bc6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Writing a generative contemporary art bot for Instagram]]></title>
            <link>https://gianluca-guarini.medium.com/writing-a-generative-contemporary-art-bot-for-instagram-7caa57d6514?source=rss-92b191c27840------2</link>
            <guid isPermaLink="false">https://medium.com/p/7caa57d6514</guid>
            <category><![CDATA[bots]]></category>
            <category><![CDATA[instagram]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[art]]></category>
            <category><![CDATA[contemporary-art]]></category>
            <dc:creator><![CDATA[Gianluca Guarini]]></dc:creator>
            <pubDate>Thu, 09 Jan 2020 20:17:44 GMT</pubDate>
            <atom:updated>2020-01-09T20:17:44.913Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XX9CW4IKmDTYRCbz" /><figcaption>Photo by <a href="https://unsplash.com/@steve_j?utm_source=medium&amp;utm_medium=referral">Steve Johnson</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><blockquote>I like contemporary art and I am pretty good at coding fancy stuff as well</blockquote><p>During a boring Swiss afternoon I challenged myself to build a contemporary art piece. Once I sketched a few concepts on paper I realized immediately that it was going to involve <strong>social media</strong> and <strong>generative art</strong>.</p><h4>Code Generated Images</h4><p>I am a <em>minimalist,</em> so I didn’t want to pollute my piece using too many elements like I <a href="https://codepen.io/GianlucaGuarini/full/nGqKa">did</a><a href="https://codepen.io/GianlucaGuarini/pen/xzlyw"> in</a><a href="https://codepen.io/GianlucaGuarini/pen/zBAfl"> the</a><a href="https://codepen.io/GianlucaGuarini/full/dxFba"> past</a>. The simplest idea that came to my mind was to generate random colored square images, that could be easily uploaded on any social network platform.</p><blockquote>…I know what you are thinking, I could have used <strong>machine learning algos</strong> and many other interesting technologies but I had just one free afternoon to make it so I decided to keep it really simple and effective…</blockquote><p>After a couple of hours I already had my online <a href="https://github.com/GianlucaGuarini/the-colour-of-the-moment">golang microservice</a> running, providing a <a href="https://the-colour-of-the-moment.now.sh/api/image">super simple API</a> to generate random images like the following one:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*RRC2BTGn98Rh-HveMZ1Fbg.jpeg" /></figure><h4>Social Media</h4><p>Once the image generator microservice was ready I had to decide on which platform I would upload these images.</p><p><strong>Twitter</strong> has already plenty of bots and its API is really developer friendly so this time I decided to use <strong>Instagram</strong> instead because by design it’s better suited to show generated images than its more text-based competitors.</p><p>I created an account called <em>the_colour_of_the_day</em> with the intent of uploading a generated image a day. Unfortunately I realized pretty soon that the Instagram REST API doesn’t <a href="https://developers.facebook.com/docs/apps/review/login-permissions#instagram-content-publish">allow bots</a> (besides the fact that the documentation is really overcomplicated).</p><blockquote>…at this point I opted for the plan B “the hacker way”…</blockquote><h4>Image Uploader</h4><p><strong>Uploading an image on Instagram via web without using their app is not that easy</strong>. However, I figured out that identifying my browser as an iOS device, I could publish them from the web ui. Being already familiar with<a href="https://github.com/puppeteer/puppeteer"> puppeteer</a> and javascript, I wrote a simple upload script. As an example, let’s check the first steps to let my chromium instance log in via node js:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3c810b376723eab4c9dbd69ce00a7330/href">https://medium.com/media/3c810b376723eab4c9dbd69ce00a7330/href</a></iframe><p>After 30 minutes I was able to automate the whole uploading process, letting computers doing what they could best: <em>simplify my life</em>.</p><p>At the moment, my script can download the generated colored image, detect its main color, give it a name (thanks also to<a href="https://github.com/meodai/color-names"> this great library</a> made by my friend<a href="https://twitter.com/meodai"> David</a>), add custom tags to the post and publish it to Instagram.</p><h4>Scheduled Updates</h4><p>I want <a href="https://www.instagram.com/the_colour_of_the_day/">the_colour_of_the_day</a> bot could post one colored image a day for as long as possible, generating a wall of different colors as a contemporary art piece. Of course I didn’t want to do it manually so the last piece of this puzzle was scheduling these daily uploads.Luckily <a href="https://github.com/features/actions">the Github Actions</a> provide already all I needed out of the box:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4e5c37e11f904452ebf9bc3eca9c0bc4/href">https://medium.com/media/4e5c37e11f904452ebf9bc3eca9c0bc4/href</a></iframe><h4>Conclusion</h4><p>I had a lot of fun working with golang and making something a bit fancier than my everyday programming tasks.</p><p>I am really curious to see if <a href="https://www.instagram.com/the_colour_of_the_day/">the_colour_of_the_day</a> will remain online for enough time to become a de facto “post-contemporary art” piece. This is how the current profile page looks like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*glQTkuCMx7KOBj_vtK2vJQ.png" /><figcaption>the_colour_of_the_day Instagram account</figcaption></figure><h4>Some Credits</h4><p>Many thanks to my friends <a href="https://github.com/nirazul">nirazul</a> and <a href="https://github.com/meodai/">meodai</a> for all the help they gave me correcting my poor English on this article ❤️</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7caa57d6514" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I got ya — A story of Croissants, Easter Eggs, a Keylogger, and IT security.]]></title>
            <link>https://gianluca-guarini.medium.com/i-got-ya-a-story-of-croissants-easter-eggs-a-keylogger-and-it-security-c46a133e5321?source=rss-92b191c27840------2</link>
            <guid isPermaLink="false">https://medium.com/p/c46a133e5321</guid>
            <category><![CDATA[gipfeli]]></category>
            <category><![CDATA[go]]></category>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[easter-egg]]></category>
            <category><![CDATA[keylogger]]></category>
            <dc:creator><![CDATA[Gianluca Guarini]]></dc:creator>
            <pubDate>Sat, 09 Nov 2019 15:47:31 GMT</pubDate>
            <atom:updated>2019-11-14T20:29:10.124Z</atom:updated>
            <content:encoded><![CDATA[<h3>I got ya — A story of Croissants, Easter Eggs, a Keylogger, and IT security.</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0sMR-tVzQ_uv844-DYkQ2A.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@dilja96?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Dilyara Garifullina</a> on <a href="https://unsplash.com/s/photos/croissant?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>If you are reading this article it’s because you might have asked yourself:</p><blockquote>what the heck have in common croissants and IT security?!</blockquote><blockquote><strong>Spoiler alert</strong>: this article is not about breakfasts nor about food in general but it’s about me hacking stuff for the sake of it.</blockquote><p>All started a couple of weeks ago, when the head of the IT security in the company where I work for decided to start a funny game to let workers understand the importance of locking our computers when we leave them unattended.</p><p>The rules are simple: if someone will be able to post the word “<strong>Gipfeli</strong>” (Croissants in Swiss German) with your account in our <em>#general</em> chat channel while you are not around, the day after <strong>you will need to bring Croissants to the whole team.</strong></p><p>This game was created with good intentions and it’s meant to improve our security standards but since I am <a href="https://github.com/riot/riot">rioter</a>, love golang having few chances to use it at work and like Easter Eggs I decided to start my <em>counter game</em>.</p><blockquote>My goal was to lock automatically my mac as soon as someone wrote the “Gipfeli” string with my keyboard.</blockquote><p>I wrote <a href="https://github.com/GianlucaGuarini/OSXKeyboard">my first keylogger</a> in go and C four years ago but I never had the chance to use it for something meaningful. But in this case it became the core of my Easter Egg.</p><p>After a hour of work on it I could detect a list of blacklisted words and I could spawn bash terminal commands just using native golang modules, <em>pretty neat</em>! If a blacklisted word was detected I could spawn “pmset sleepnow” to let my mac sleep.</p><p>Once the script was ready and well tested I could finally <a href="https://medium.com/@fahimhossain_16989/adding-startup-scripts-to-launch-daemon-on-mac-os-x-sierra-10-12-6-7e0318c74de1">launch it automatically on boot</a> in a daemon process on my mac.</p><h3>Conclusion</h3><p>Once installed i-got-ya on my machine I have left it unattended waiting that someone could trigger my Easter Egg that of course <em>didn’t work</em> because It can’t detect typos yet 😅 and I had to bring the 🥐 for everyone (again).</p><p>I had so much fun developing something in go taking a break from javascript for a day. Of course making this script doesn’t mean that <a href="https://github.com/GianlucaGuarini/i-got-ya/issues/1">I will not lock my computer in future</a> indeed I have learned that security comes always first!</p><p>Here you can have a look at <a href="https://github.com/GianlucaGuarini/i-got-ya">source code</a> of the script.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c46a133e5321" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Every revolution begins with a Riot.js first]]></title>
            <link>https://gianluca-guarini.medium.com/every-revolution-begins-with-a-riot-js-first-6c6a4b090ee?source=rss-92b191c27840------2</link>
            <guid isPermaLink="false">https://medium.com/p/6c6a4b090ee</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[riotjs]]></category>
            <category><![CDATA[web]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Gianluca Guarini]]></dc:creator>
            <pubDate>Thu, 30 May 2019 13:00:13 GMT</pubDate>
            <atom:updated>2020-01-12T14:54:03.570Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*76S1KrcSEaircAftI6w4ew.jpeg" /><figcaption>Eugène Delacroix — Le 28 Juillet. La Liberté guidant le peuple</figcaption></figure><h3>Preface</h3><p>I started using Riot.js few years ago and it has changed my style of developing web applications.<br><strong>I was tired to learn every day new concepts and convoluted ways to create always the same trivial components</strong> (accordions, overlays, custom input fields…). <br>Working with Riot.js opened my mind, it let me understand that even the most complex feature can be achieved with elegance and few code relying on the power of web components.</p><p>Riot.js was initially created by muut.com and developed by <a href="https://muut.com//blog/technology/riotjs-the-1kb-mvp-framework.html">Tero Piirainen in 2015</a>. I became the main maintainer of it while I was working on its second major release. Helped by an incredible international team of contributors, we were able to massively increase its user base (from 3k npm monthly downloads to 70k).</p><blockquote>However I was unhappy with its original core design and with the new v4 version I took the time (almost 2 years) to completely rewrite and redesign the entire framework and all its ecosystem.</blockquote><h3>The Problem</h3><p>This year (2019) web components support across browser vendors has massively improved but their API doesn’t seem to help much developers solving their simplest problems.</p><blockquote>Frameworks like AngularJS, Ember.js and React.js seemed to simplify our life in the short term. However handling the amount of new concept and their convoluted APIs is a price that not every developer is willing to pay.</blockquote><p>To solve this issue many other libraries like Vue.js and Svelte.js proved that you don’t need a complex API to develop beautiful interfaces. Being that true on one hand, on the other <strong>they add an incredible amount of magic to your code </strong>(reactive properties, Proxy, two-way-data binding, computed, observable…) binding you (and your mind) to specific framework idioms and meta programming techniques that might change on any major release. This is definitely not a future proof approach! Another problem is that even if these tools look simple at beginning, as soon as your projects starts growing, <strong>you will need to handle and understand </strong><a href="https://forum.vuejs.org/t/does-nexttick-work-weirdly/42918"><strong>many</strong></a><strong> </strong><a href="https://stackoverflow.com/questions/46666819/vue-watch-not-triggering"><strong>of</strong></a><strong> </strong><a href="https://github.com/vuejs/vue/issues/7093"><strong>the</strong></a><strong> </strong><a href="https://github.com/sveltejs/svelte/issues/3946"><strong>tricks</strong></a><strong> </strong><a href="https://github.com/sveltejs/svelte/issues/3793"><strong>they</strong></a><strong> use under the hood. </strong>You will often need to deal with dirty hacks here and there to let your code running on several browsers.</p><h3>The Solution</h3><blockquote>Riot.js 4 aims to be the tiniest, simplest and yet most predictable framework for web components. It is designed to offer you everything you wished native web components API looked like.</blockquote><p>Having worked a lot with Vue.js during the last 3 years I am really impressed by the simplicity of its API. <br>Evan You is an incredible talented developer and I was able to take many ideas from Vue.js bringing them to Riot.js 4.</p><p>I avoided any sort of magic or asynchronous rendering strategy to manage the Riot.js components. Observables, two way data bindings and “short cuts” meta programming techniques have no place in Riot.js 4.<br>The components interface is transparent and explicit and there are no Riot.js ways to achieve your goals:<strong> you can develop your components as you prefer</strong>.</p><p>The result is a beautiful API that will be beloved by functional programmers (like me) and at same time it&#39;s impressively simple.</p><p>Let’s have a look for example at a component skeleton:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9Dyz4GU4QvWZBrZuIPjs3g.png" /><figcaption>Skeleton of a Riot.js 4 component</figcaption></figure><p>The code above is self explanatory and it could be easily read by any developer without having to guess what it does.</p><h3>The Rewrite</h3><p>Riot.js 3 was ok and worked pretty well in many production environments but there were issues I couldn’t solve without redesigning it. The old compiler was fragile because based on regular expressions (no real parser ¯\_(ツ)_/¯ ), the runtime expressions evaluation was hard to maintain and it couldn’t be optimized any further and the components syntax was not really Javascript™ compliant.</p><p>With the new version I’ve tried to fix all the above issues adding tons of new improvements. <br>With Riot.js 4 you will get all the following new features out of the box:</p><ul><li>Precise source maps</li><li>Content Security Policy support</li><li>True pure Javascript expressions</li><li>Better &lt;slot&gt;s support</li><li>Better compatibility with other languages like Typescript</li><li>Modern browsers support (NO internet explorer)</li><li>ES2016 Javascript modules</li><li>5x performance boost</li><li>Stabler SSR + HTML hydration</li><li>6kb Library size</li></ul><blockquote>Of course all these features came with a cost, your old components will not work in Riot.js 4</blockquote><p><strong>The old codebase didn’t allow me enhancing the framework any further</strong> and I had to take a decision: I could either rewrite the whole library ecosystem with the risk of loosing part of its community, or I could just leave the maintenance of the old code to someone else. I chose the first option and I couldn’t be happier about that, because by choosing that path I have learnt much more than I though. <br>Here you can check the list of the new Riot.js ecosystem packages I have (re)written for you:</p><ul><li><a href="https://github.com/riot/ssr">@riotjs/ssr</a></li><li><a href="https://github.com/riot/hydrate">@riotjs/hydrate</a></li><li><a href="https://github.com/riot/hot-reload">@riotjs/hot-reload</a></li><li><a href="https://github.com/riot/compiler">@riotjs/compiler</a></li><li><a href="https://github.com/riot/cli">@riotjs/cli</a></li><li><a href="https://github.com/riot/parser">@riotjs/parser</a> credits also to<a href="https://github.com/aMarCruz"> Alberto Martinez</a></li><li><a href="https://github.com/riot/dom-bindings">@riotjs/dom-bindings</a></li><li><a href="https://github.com/riot/webpack-loader">@riotjs/webpack-loader</a></li><li><a href="https://github.com/riot/parcel-plugin-riot">@riotjs/parcel-plugin-riot</a></li><li><a href="https://github.com/riot/now">@riotjs/now</a></li><li><a href="https://github.com/riot/custom-elements">@riotjs/custom-elements</a></li><li><a href="https://github.com/riot/rollup-plugin-riot">rollup-plugin-riot</a></li><li><a href="https://github.com/riot/dom-nodes">dom-nodes</a></li><li><a href="https://github.com/riot/riotify">riotify</a></li></ul><p>Of course you don’t need to migrate you old application to Riot.js 4 but if you want to know how to do so you can read the <a href="https://riot.js.org/migration-guide/">migration guide</a>.</p><h3>The New Look</h3><p>Riot.js logo was updated thanks to the <a href="https://github.com/riot/logo/issues/3">community help</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l4pKXq14nZUa8sr6toqfhw.png" /><figcaption>Designed by <a href="https://github.com/nibushibu">https://github.com/nibushibu</a></figcaption></figure><p>I have designed also a <a href="https://riot.js.org/">new website</a> and the old one was migrated <a href="https://v3.riotjs.now.sh/">here</a>. I will accept <a href="https://github.com/riot/riot.github.io">pull requests</a> to improve the documentation and fix the typos so please help me on that.</p><h3>The Roadmap</h3><p>There is still tons of work to do…</p><ul><li>Update all the <a href="https://github.com/riot/examples">Riot.js examples</a></li><li>Add <a href="https://github.com/riot/riot/issues/2692">the &lt;template&gt; fragments</a> feature</li><li>Improve the memory consumption</li><li>Improve the rendering performance</li><li>Create a Riot.js official state management library</li><li>Update the <a href="https://github.com/riot/route">Riot.js router</a></li><li>Update the <a href="https://github.com/riot/animore">Riot.js animations library</a></li><li>Create new plugins installable via `riot.install`</li></ul><p>I am focused on making the new API as stable as possible and building new features on the top of the new ecosystem. I will still be supporting Riot.js 3 for security patches but Riot.js 4 is the future and I will mainly work on it.</p><h3>The Conclusion</h3><p>Riot.js is not backed by any big company, it’s just me working alone on ~30 Javascript modules during my spare time. I’d love to work part time on the project but for that <a href="https://opencollective.com/riot">I will need your help</a>. It would be great to get someone else on board as contributor working on the Riot.js ecosystem as well, so please if you think that you might be the right person for it let me know it.</p><p>Love or hate it, Riot.js 4 is here to stay. I will do my best to keep the framework as simple as possible without bloating its API with unnecessary stuff. My goal was to create a clean and maintainable software without the uncompelling need to compete with anyone else, it took almost 2 years but in the end I made it!</p><p>If you liked what you have just read and you want to learn a bit more about the framework you can start by reading its documentation on the official <a href="https://riot.js.org/">Riot.js website</a>.</p><p>Let’s riot!</p><h3>The Credits</h3><p>Many thanks to:</p><ul><li><a href="https://github.com/webreflection">Andrea Giammarchi</a> for his <a href="https://github.com/WebReflection/domdiff">domdiff</a> that powers Riot.js loops</li><li><a href="https://github.com/benjamn">Ben Newman</a> for <a href="https://github.com/benjamn/recast">recast</a> and <a href="https://github.com/benjamn/ast-types">ast-types,</a> without them making the new compiler would be impossible</li><li><a href="https://github.com/Rich-Harris">Rich Harris</a> for <a href="https://rollupjs.org/">rollup</a> and for being a constant source of inspiration</li><li><a href="https://github.com/yyx990803">Evan You</a> for his indirect influence on the new Riot.js API</li><li><a href="https://en.wikipedia.org/wiki/Tim_Peters_(software_engineer)">Tim Peters</a> for the <a href="https://en.wikipedia.org/wiki/Zen_of_Python">Zen of Python</a> that has been my mantra during the rewrite</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6c6a4b090ee" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Are AMP pages really faster than HTML?]]></title>
            <link>https://gianluca-guarini.medium.com/are-amp-pages-really-faster-than-html-ceb1c0399a90?source=rss-92b191c27840------2</link>
            <guid isPermaLink="false">https://medium.com/p/ceb1c0399a90</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[amp]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[pwa]]></category>
            <dc:creator><![CDATA[Gianluca Guarini]]></dc:creator>
            <pubDate>Sun, 26 Aug 2018 19:50:13 GMT</pubDate>
            <atom:updated>2018-08-26T21:30:59.019Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Au8q_BBjuzalfALAUxJXmw.png" /><figcaption>AMP vs HTML vs PWA</figcaption></figure><p>Short answer: <strong>NO</strong></p><h3>The Preface</h3><blockquote>The AMP Project is an open-source initiative aiming to make the web better for all. The project enables the creation of websites and ads that are consistently fast, beautiful and high-performing across devices and distribution platforms.</blockquote><p>The quote above used to described shortly the AMP Project by Google on <a href="https://www.ampproject.org/">https://www.ampproject.org/</a> .</p><p><a href="http://ampletter.org/">Many concerns</a> about this technology were raised by web developers from all over the world despite it has been adopted already by many web platforms because of its simplicity.</p><p>Google is really pushing forward this technology and many articles about its benefits keep popping up here and there online. <strong>I have not really a strong opinion about it, and since I am a curious person, I wanted to do a bit of “fact checking”:</strong> I have tried to benchmark its performance against pure HTML and <a href="https://developers.google.com/web/progressive-web-apps/">PWA</a> pages. <br>I was also surprised to find online many resources describing the great advantages of such technology without actually showing any real data to support them.</p><h3>The First Attempt</h3><p>I have quickly setup a <a href="https://github.com/GianlucaGuarini/amp-vs-pwa-vs-HTML">github repo</a> and I tried running a simple <a href="https://developers.google.com/web/updates/2017/05/devtools-release-notes#lighthouse">lighthouse report</a> on 3 different kind of HTML pages: AMP, PWA (with service workers and javascript) and pure HTML.</p><p>My benchmarks were run all locally on <em>Chrome 68.0.3440.106 64bit </em>via <em>audit tab</em> without fetching online assets ever (except for the core javascript of the AMP project).</p><p>The results of my first benchmark were clear: the pure HTML pages and the PWA ones have similar performance, but the AMP pages seem to take almost 3 times longer (3,5 seconds) to become interactive compared to a simple HTML file.</p><p>I published my results on Twitter but I got some critics about my method:</p><h3>Gianluca Guarini on Twitter</h3><p>I have made a quick bench to compare the lighthouse audits of PWA vs AMP vs Normal HTML websites https://t.co/3E7YbLHezh #javascript #html #performance #rendering</p><p>Basically some users complained that my tests were too simple and I should have tested AMP in complex application containing more than a simple &lt;h1&gt; DOM node. Challenge accepted :D</p><h3>The Second Attempt</h3><p>I agreed on the critics to my first benchmark so I decided to add a second one with a bit more DOM resources to fetch. I added 33 images 1 iframe and 1 video (mp4) to my pages to figure out how the 3 technologies would perform in that case.<br>I decided also that I could load the PWA assets lazily with 10 lines of javascript using the <a href="https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API">IntersectionObserver API</a>.</p><p>Also this time it seemed that AMP pages were slower than the other 2 technologies. AMP pages required the injection of additional javascript files to handle <a href="https://www.ampproject.org/docs/reference/components/amp-video">videos</a> and <a href="https://www.ampproject.org/docs/reference/components/amp-iframe">iframes</a>. <strong>It’s worth to mention that the use of Javascript and lazy loading for the PWA demo made it de facto the most performant.</strong></p><p>I have also noticed that AMP pages were not able to load the content of the embedded &lt;iframe&gt; due to an <a href="https://github.com/ampproject/amphtml/blob/master/spec/amp-iframe-origin-policy.md">iframe origin policy</a> issue.</p><h3>The Conclusion</h3><p>In my opinion AMP pages might provide many benefits to inexperienced developers or huge web teams that might struggle with third party ads or many assets to load without knowing how to do it properly. The syntax looks really nice and it’s based on custom elements! I am sure that the Google teams involved in this project know what they are doing and they are pushing it with their best intent but<strong> I am skeptic about the way AMP technology gets sold to the web community: it is simply slower than normal HTML.</strong></p><p>All my tests are all on github <a href="https://github.com/GianlucaGuarini/amp-vs-pwa-vs-HTML">https://github.com/GianlucaGuarini/amp-vs-pwa-vs-HTML,</a>. Please feel free to check them by yourself and correct me if I did something wrong.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ceb1c0399a90" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SPA, or not SPA, that is the question!]]></title>
            <link>https://gianluca-guarini.medium.com/spa-or-not-spa-that-is-the-question-711ace3576cf?source=rss-92b191c27840------2</link>
            <guid isPermaLink="false">https://medium.com/p/711ace3576cf</guid>
            <category><![CDATA[html]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[sap]]></category>
            <category><![CDATA[web]]></category>
            <dc:creator><![CDATA[Gianluca Guarini]]></dc:creator>
            <pubDate>Sun, 21 Jan 2018 16:00:18 GMT</pubDate>
            <atom:updated>2018-02-05T17:57:13.892Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c2TxPA8ga41rPxXQDs-M1A.png" /></figure><h4>Introduction</h4><p>Web development is radically changed in the last few years. The need of high interactivity and the mix of different kind of media contents on the same platform has pushed developers adopting the <a href="https://en.wikipedia.org/wiki/Single-page_application"><strong>SPA</strong> (Single Page Application)</a> approach also when it is not necessary.</p><p>Making a SPA website means that all your website contents will be rendered and managed directly by the Javascript engine (AKA browser) used by the users browsing it. Your users’ browsers will receive contentless web pages that will be populated in a second step becoming interactive gradually once all the loaders will be gone.</p><p>During my working career I had the chance to work on several big SPA projects and in this article I will try to share my experience by listing my 10 reasons why you shouldn’t do a SPA website.</p><h3>10 reasons why you shouldn’t do a SPA website</h3><h4>1. Speed and Performance</h4><p>If you want to deliver your website contents as fast as possible to your users, independently from the devices they will use to reach your page, you should avoid rendering them on the client.</p><p>Rendering the whole HTML of your websites via Javascript in the browser means that you will use a technology that was never meant to be used in that way ignoring what was explicitly invented for doing that well and fast: <strong>Servers</strong></p><blockquote>Sites like google.com, twitter.com, amazon.com… they all render their contents on the server also because of performance reasons so <em>unless you think you are smarter than them consider offering the SPA websites the exception and not your default offer</em>.</blockquote><p>Many developers think that making <em>isomorphic</em> applications pre-rendering HTML on the server will improve their websites performance and that’s true only for the initial rendering. However if all the other pages requested will be completely rendered by your users’ browsers, your page transitions might appear slow and laggy even if you tried all your best to avoid that.</p><h4>2. High Development Costs</h4><p><strong>A SPA website costs from 3x to 5x times more compared to a non SPA one.</strong><br>If your client has no need for a SPA website, offering it means that in the best case you will waste 3x times more time to finish your project.</p><p>Often in the end your client (and his/her users as well) will not notice the difference of the product you’ve hardly made compared to other normal SSR (Server Side Rendered) websites and he/she will be hardly willing to pay your big effort for having made it isomorphic with Javascript.</p><p>Having high development costs can be a big problem for startups and small companies in an industry with such high competition.</p><h4>3. Fragility</h4><p>Making a Javascript website means that (hopefully) you will be using a framework like React, Vue or Angular…</p><blockquote>Frameworks maintainers design their code not with your same goals in mind</blockquote><p>Your website contents will be fragile because available only to the browsers supported by the framework you have picked.</p><p>For example React maintainers correctly inform their users about the possible crossbrowser issues:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*00bP4q6yls7FszQJGjTQ7Q.png" /><figcaption><a href="https://reactjs.org/docs/react-dom.html#browser-support">https://reactjs.org/docs/react-dom.html#browser-support</a></figcaption></figure><p>Trivial issues will also soon or later get in your way because any small Javascript error might compromise the stability of your whole site:</p><blockquote>there is a big difference in having a small scoped portion of your site not rendered because of a javascript error (<strong>SSR</strong>) vs a complete white page because of a trivial exception thrown your footer javascript template (<strong>SPA</strong>)</blockquote><h4>4. Hard Long term Maintainability</h4><p>Two years ago many big companies used to develop huge SPA website using Angular 1, not because it was particularly good, but because it’s developed and sponsored by Google. Today <em>React is the new shit</em> and Angular {2…n} is completely different from its first version and not backward compatible: all these companies above are forced to invest tons of dollars to rewrite everything from 0 (if they can afford it) or to search desperately developers that can maintain their monstrous legacy code just because nobody uses Angular 1 anymore.</p><blockquote>In a nutshell: if you rely on a javascript framework for your entire project your are just writing today your legacy code</blockquote><h4>5. Poor Security</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z_eA-5EjpBo7cepRpHQlQg.png" /><figcaption><a href="https://www.reddit.com/r/badcode/comments/7oao00/good_grief/">Example of frontend code https://www.reddit.com/r/badcode/comments/7oao00/good_grief/</a></figcaption></figure><p><strong>Backend developers pay much more efforts and time in making websites secure and stable</strong>. With the advent of SPA and isomorphic applications many web agencies let their frontend developers programming the frontend and backend (sometimes also mobile native 🤦‍♂ ) code for their projects!</p><blockquote>…no real backend developer would ever code with javascript on the server</blockquote><p>Having frontend developers (the same guys that 10 years ago used transparent spacer gifs for layouting) coding your application server is a high risk in term of security: it’s like letting your mechanic healing your heart disease.<br>In my experience I have seen many cases of backend applications written in javascript by frontend developers in the “most creative possible ways”. I can’t recommend it either to your worst enemy!</p><h4>6. Reinventing the wheel</h4><p>Doing a SPA website you will be forced at some point to <strong>re implement all the features our browsers give us for free.</strong></p><p>For example you will need to find a way to restore the scroll position by any page change, add extra loaders to show that the contents are not yet ready, keep the page &lt;title&gt; in sync with your content and much more…</p><p>You will need to code emulating any trivial browser feature fighting constantly with inconsistent behaviors across the browsers vendors.</p><h4>7. Social media and meta attributes</h4><p>Social network platforms require meta attributes in your pages in order to get info about your contents. AFAIK Facebook and Twitter crawlers can’t run Javascript so they just read the HTML statically generated by your application routes. <br>If your app meta tags are not properly rendered your site (when shared) will always have the same title/description/share-image for all of its pages.</p><p>In this case the only solution possible is to render your page meta tags on the server and if your app is not isomorphic your backend is forced somehow to be aware of your application frontend router. <strong>This will end often in a mess and in unmaintainable code that doesn’t justify why you have made your SPA website in the first place</strong>.</p><h4>8. The glam</h4><p><strong>Unless you are building the next google maps, a web game or gmail there is no need for a SPA website and you are doing it only for the glam.</strong></p><blockquote>The 90% of SPA websites I have worked on could have been made with a simple static site generator like <a href="https://gohugo.io/">hugo</a> or <a href="https://jekyllrb.com/">jekyll</a>, having Javascript components here and there when needed, to make their contents a bit more interactive and fun.</blockquote><p>Having completely different templates for all your application pages and no real plans (or time) to animate the content blocks properly transitioning from page to page is already a sign that probably your application doesn’t need to be a SPA in the first place.</p><p>If you render your whole page template on any page change request and you think that doing it via Javascript will help you with your fancy “fade in” -&gt; “fade out” css transition, I will reveal you a secret: you can do it with <a href="https://jsfiddle.net/gianlucaguarini/y5Lgvo1m/">6 lines of css</a> without javascript.</p><h4>9. Poor Accessibility</h4><p>Regarding this topic I would like to give you an exercise: try to use a screen reader randomly on a SPA site to check all the focus behavior inconsistencies during the page transitions leaving your users in the middle of nowhere. No aria or role attribute will help your users with disabilities if your single page keeps changing completely its DOM structure with css transitions and animations.</p><h4>10. Waste of memory and energy</h4><p>Many “smooth” SPA websites require quite much memory in order to be able to manage all the website contents + markup + transitions + videos + canvas + webgl…</p><p>I have tried for fun printing the memory snapshots for <a href="https://mobile.twitter.com/">https://mobile.twitter.com</a> that is a brand new shiny SPA (after I have clicked on all 4 main pages) and <a href="https://twitter.com/">https://twitter.com/</a> and these are the results:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/264/1*wqEL43RveEaO2qSE9XBdog.png" /><figcaption>twitter.com</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/246/1*Z3G_lnl4kxdBJawgrZrIKQ.png" /><figcaption>mobile.twitter.com</figcaption></figure><p>It’s really fun to see that the old twitter website requires less memory to render than the “lighter” mobile one.</p><p>More memory translates to more energy and less battery life for all the devices browsing your contents. Javascript is a single threaded language with no ways to manage manually the memory allocated for its tasks, you will need to rely on your users devices hoping they will properly free memory for the UI components removed from the screen.</p><h4>Conclusion</h4><p>I am not against SPA websites and I love working on them in the rare cases when they make really sense. I hope for the future of the web that people working in this industry will focus more on reusable web components that can only enhance the user experience leaving the rendering of the important contents of the pages to the server available also for users that have for example javascript disabled.</p><p>I firmly think that letting downloading tons of Javascript files to your users or <a href="https://developers.google.com/web/ilt/pwa/lab-caching-files-with-service-worker">hacking ugly caching strategies with Web Services</a> will only make your contents available to a small elite group of people that can afford the latest devices having the fastest internet connection plans.</p><p>I am probably a bit too naive but I will always stand for a simpler and lighter web available for the most wishing that more and more developers will educate their clients and companies raising up the issues above the next time someone will ask for a “Single Pain Application”.</p><h4>P.S.</h4><p>I have omitted many other issues like bad SEO, bad interoperability with CMSs, inconsistencies in the use of the HTTP status codes.. just for brevity and because they might be too specific to the projects I have worked on and not really related to the more general topic I wanted to describe here.</p><p><strong>This story is published in </strong><a href="http://blog.usejournal.com/"><strong>Noteworthy</strong></a><strong>, where 10,000+ readers come every day to learn about the people &amp; ideas shaping the products we love.</strong></p><p><a href="http://blog.usejournal.com/"><strong>Follow our publication</strong></a><strong> to see more product &amp; design stories featured by the </strong><a href="https://usejournal.com/?/utm_source=usejournal.com&amp;utm_medium=blog&amp;utm_campaign=guest_post&amp;utm_content=gianlucca_guarini"><strong>Journal</strong></a><strong> team.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=711ace3576cf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Things nobody will tell you about React.js]]></title>
            <link>https://gianluca-guarini.medium.com/things-nobody-will-tell-you-about-react-js-3a373c1b03b4?source=rss-92b191c27840------2</link>
            <guid isPermaLink="false">https://medium.com/p/3a373c1b03b4</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Gianluca Guarini]]></dc:creator>
            <pubDate>Sat, 22 Apr 2017 00:07:03 GMT</pubDate>
            <atom:updated>2021-01-12T08:28:41.173Z</atom:updated>
            <content:encoded><![CDATA[<h4>The Pre Preface</h4><p>Please do a mental experiment with me, imagine yourself back to 10 years ago, stop reading for 5 seconds and take a breath. <br>Imagine then to meet a dev from the future telling you that in 10 years <strong>anyone</strong> will be writing their app routers in Javascript in this way</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1bd55824b8e1dd3b8d1dc11481d25712/href">https://medium.com/media/1bd55824b8e1dd3b8d1dc11481d25712/href</a></iframe><p>and that the markup of many websites could be rendered a in this way</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/835feadd2883888f98778abb0443558c/href">https://medium.com/media/835feadd2883888f98778abb0443558c/href</a></iframe><p>what would you think?</p><p>Well if that happened to me I would say: “ok so in the future we will render HTML like we do it today in our file.include.php but with Javascript right? What’s the improvement? This is not even real Javascript right? Doesn’t it throw errors?”</p><h4>The Preface</h4><p>I am always open to new challenges and new technologies especially if they can improve my work flow and let me grow as developer. I care about the code I write for living because:</p><blockquote>good code means also better product quality</blockquote><p>I really write a lot of Javascript daily and I’ve never had the chance to start coding a project with React.js since I use mainly <strong>Riot.js</strong> for my private projects and <strong>Vue.js</strong> at work. But recently I had to work on a big project with React.js and so I wanted to share my thoughts and my experience.</p><h4>The Research and The First Steps</h4><p>Being not an expert about how to setup a whole project with the framework (and being also skeptical about letting doing my job to a cli tool like <a href="https://github.com/facebookincubator/create-react-app">create-react-app</a>) I tried to understand how others scaffold their code from famous <a href="https://github.com/facebook/react/wiki/Complementary-Tools#basic-starter-kits-client-side-only">starter kits linked on the framework wiki</a> but after digging into a couple of them I quickly understood that <strong>it was probably better doing it by myself</strong> because <a href="https://gist.github.com/GianlucaGuarini/1ada071330daf9a3d29d076f13947883">61 npm modules</a> for a basic starter kit and <a href="https://gist.github.com/GianlucaGuarini/a2ceed3887de0367206eaecd9138d684#file-package-json-L24-L128">104 for a more complete</a> one were a bit too much for me.<br>Indeed I started by studying the way I wanted to manage my application data layer and I figured out immediately that the two biggest options were <a href="https://github.com/mobxjs/mobx">mobx</a> and <a href="https://github.com/reactjs/redux">redux</a>.</p><h4>The Mobx Attempt</h4><p>Mobx looked weird at the beginning because in the whole documentation they use ES2017 decorators, wich are still in an <a href="http://tc39.github.io/proposal-decorators/">early draft release</a>, so not yet stable, and this means I had extra babel dependencies to install (…as the whole babel setup to compile jsx templates was not enough yet…) in order to transpile them. Yes, I know I could have used mobx without decorators, but wrapping any component and any method in a mobx function didn’t seem to be a valid and maintainable solution to me.</p><p>Once I wired everything up I realized that also my eslint tests weren’t working anymore because of the decorators. I had to <a href="https://github.com/eslint/eslint/issues/4096">install babel-eslint to solve the issue</a>. I wrote my first components but I soon realized that mobx was not really preventing unexpected updates coming from parts of my code that should not have any right to write into my stores or update them: in mobx you can prefix your <a href="https://mobx.js.org/refguide/action.html">store actions</a> but “<em>it’s just for the glam” </em>and yet this will not prevent overriding any observable property from any component of your application!?!<br>In the end I understood that mobx tries to emulate wrongly what Vuex does in a much better and cleverer way for Vue.js so I uninstalled the useless node dependencies bloat and moved forward</p><h4>The Redux Solution</h4><p>Anytime I work with redux I need to go back to its documentation because its core concepts are so complex that <em>my mind struggles retrieving them puking them out as soon as I stop working with it</em>. I started implementing redux in my project, though, but after a couple of hours of refactoring I understood that my code kept growing and it was already 3 times bigger than before due to the amount of boilerplate code required by redux (ActionTypes, Actions, Reducers, connect…). At this point I decided to add some helpers to simplify at least the components’ store actions/props connections and I decided that I could live with it.</p><p>In the end I’ve found out that my app will require 3 times more Javascript code for the same trivial tasks I normally handle in Vue.js or Riot.js but <strong>it seems that React devs don’t care so I also don’t care</strong>.</p><h4>The Router Nightmare</h4><p>The router decision was not as hard as deciding between mobx or redux because the React.js community seems to agree mainly on <a href="https://github.com/ReactTraining/react-router">react-router</a>. React-router is not officially maintained by facebook and the maintainers had the great idea of bumping <a href="https://github.com/ReactTraining/react-router/blob/master/CHANGES.md"><strong>3 major versions</strong></a><strong> in 5 months</strong> <a href="https://www.reddit.com/r/javascript/comments/530dsn/reactrouter_v4_is_a_ground_up_100_incompatible/">completely not backward compatible</a> so this means that all the tutorials and articles about how to use it didn’t keep up with the updates becoming useless if you are using the latest version of the library.</p><p>My initial steps with react-router were really hard because the documentation seems to be really confusing using terms like BrowserRouter and MemoryRouter that don’t make any sense to me, and code snippets like the ones at beginning of this article that I could barely read and understand.</p><p>Other big “mysterious” problems popped up by combining the redux Provider component together with the Router tag and the routes because of the React.children.only rendering</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2FGianlucaGuarini%2Fembed%2Fpreview%2FXWjBXKE%3Fheight%3D600%26slug-hash%3DXWjBXKE%26default-tabs%3Djs%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io&amp;display_name=CodePen&amp;url=https%3A%2F%2Fcodepen.io%2FGianlucaGuarini%2Ffull%2FXWjBXKE&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/11bdb98735776bc67a1dc7489c533066/href">https://medium.com/media/11bdb98735776bc67a1dc7489c533066/href</a></iframe><p>Once I understood what was the issue I was dragged into the rabbit hole being forced to add empty divs all over the place to let my app work properly:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/915bc80ac9ba9d1f982600cb939868fc/href">https://medium.com/media/915bc80ac9ba9d1f982600cb939868fc/href</a></iframe><h4>The Conclusion</h4><p>I am sure that React was totally blast some years ago introducing new concepts that changed the way we do frontend and for this I am really grateful to the facebook devs. But today the alternatives inspired by React represent to me a much better solution for professional projects: <em>React seems to be an enhanced rendering framework born to replace the use of server side code (probably PHP) mixed to HTML</em>, this might work perfectly if you work for facebook but I don’t see any case where I would need it in any of my web apps.</p><p>Working with React for me raises up more problems than the ones it is supposed to solve forcing me finding out the “React way” of achieving my goals along with nosensical design decisions</p><ul><li>you must use className instead of class to define the DOM css classes</li><li>you will need to importreact-dom and react in your scripts without ever using the last one for some wild reason known only by the React team</li><li>you can render functional components just by using js functions but you will <strong>always</strong> need to wrap all your markup in a <strong>wrapper tag </strong>to properly allow the Virtual DOM creation</li><li>its apparent simplicity is hidden behind a whole toolchain you need to configure before you can write even 1 line of code</li></ul><p>I started my app with React 15.5.0 knowing that my code is deprecated before even starting because facebook has just announced that for the next major release they are planning a <a href="https://news.ycombinator.com/item?id=14142120">complete rewrite of the framework</a> and this means that they will likely nuke the current source because it can no longer be maintained.</p><h4>P.S.</h4><p>Did I mention that my code will run also in a react native application?<br>Well, I don’t want to spoil the results of my tests and I will let you try it out first but I will give you an hint:<br>what do you expect from a framework with <a href="https://github.com/facebook/react-native/issues">more than 1000 issues on github</a> that will let you install alpha dependencies by default (React@16.0.0-alpha.6) to develop your native app?!?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3a373c1b03b4" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>