<?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 José Pablo Granados on Medium]]></title>
        <description><![CDATA[Stories by José Pablo Granados on Medium]]></description>
        <link>https://medium.com/@jpgcode?source=rss-ff7d78af523d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*036tfFfNpFkZkSQ8qiLHsw@2x.jpeg</url>
            <title>Stories by José Pablo Granados on Medium</title>
            <link>https://medium.com/@jpgcode?source=rss-ff7d78af523d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 08:46:10 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jpgcode/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[3 powerful modern technologies that will improve your website performance greatly]]></title>
            <link>https://medium.com/@jpgcode/the-3-powerful-modern-technologies-that-will-improve-your-website-performance-greatly-483ff3070731?source=rss-ff7d78af523d------2</link>
            <guid isPermaLink="false">https://medium.com/p/483ff3070731</guid>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[web]]></category>
            <category><![CDATA[webpack]]></category>
            <category><![CDATA[js]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[José Pablo Granados]]></dc:creator>
            <pubDate>Tue, 21 Jul 2020 17:52:16 GMT</pubDate>
            <atom:updated>2020-07-21T21:56:19.504Z</atom:updated>
            <content:encoded><![CDATA[<h4>HTTP 2, JS modules and Resource Hints</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0v0zrag-nqp3P-x2" /><figcaption>Photo by <a href="https://unsplash.com/@marcojodoin?utm_source=medium&amp;utm_medium=referral">Marc-Olivier Jodoin</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Web performance is a critical topic. Users won’t wait for a slow application to load. A slow response (even when it means a few extra seconds or milliseconds) will impact your business.</p><blockquote>Web technologies evolve quickly and the development practices need to evolve with it</blockquote><h3>HTTP 2</h3><p>The latest major version of the <a href="https://en.wikipedia.org/wiki/HTTP/2">web protocol</a> first appeared in 2015. The main goal of the release was to improve latency by enabling full request and response <a href="https://http2.github.io/faq/#why-is-http2-multiplexed">multiplexing</a>. Having this feature enabled in the server changed the best practice about concatenating assets and instead, split them into pieces that makes sense.</p><p>The same applies to images, where a very common practice is to use a <a href="https://www.w3schools.com/css/css_image_sprites.asp">CSS sprite</a>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/384/1*M4s3vTbmwfvHdUh0DHQnvQ.png" /><figcaption>CSS sprite created for performance optimization in HTTP 1</figcaption></figure><p>The main idea is to reduce the amount of requests the browser has to make during page load. <strong>With HTTP 2 and its multiplexing feature this practice is meaningless (except in a few exceptions).</strong></p><p>HTTP 2 needs to be enabled at the server level, but the requirements are not hard to meet. An updated server with a valid SSL/HTTPS certificate will run it without much extra overhead.</p><h3>JS Modules</h3><p>First released in EcmaScript 6, <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules">modules</a> improved natively well known issues: <a href="https://scotch.io/tutorials/understanding-scope-in-javascript">global scope</a> and dependency management.</p><p>One of the main advantages of this combined with HTTP2 is to export the JS in smaller pieces and have a controlled way to load them in the pages.</p><h4>Static imports</h4><p>Using modules developers can manage Javascript dependencies in a very efficient way using the following syntax:</p><pre>import &#39;My Module&#39; from &#39;myModule&#39;;</pre><h4>Dynamic imports</h4><p>Static imports are a great way to manage dependencies, however when used dependencies are always added to the final bundle. What if you need to import a module just when needed?</p><blockquote>Dynamic imports allows to lazy load JavaScript modules</blockquote><pre>if (myCondition) {<br>    import(modulePath)<br>       .then(obj =&gt; &lt;module object&gt;)<br>       .catch(err =&gt; &lt;loading error, e.g. if no such module&gt;)<br>}</pre><p>In the example above, modules are requested conditionally and treated as a <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise">JS promise</a> <strong>making the initial page load lighter and much faster</strong>. This is particularly useful when the application is big and there are modules that user may not need in all cases.</p><p>Currently as July 2020, the native browser support is +90% global:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*deEmrXPpiV3X41F4YigpWw.png" /><figcaption>JS modules dynamic import support (July 2020)</figcaption></figure><h4>Using JS Modules in old browsers</h4><p>Webpack module bundler doesn’t only provide the coverage needed for older browsers but it also helps with the dependency management and code splitting of chunks.</p><p>Dynamic imports can be used in Webpack following the JS native spec, the only difference is that it can contain <a href="https://webpack.js.org/api/module-methods/#magic-comments">magic comments</a> to control a few settings for the chunks:</p><pre>import(<strong>/*webpackChunkName: &quot;module&quot;*/</strong> &#39;./module&#39;).then(res =&gt; {<br>    res.module.init();<br>});</pre><h3>Resource hints</h3><p>The third powerful technology: <strong>resource hints</strong> makes possible to take advantage of browser idle time to download or makes requests in advance. This is incredibly useful if applied correctly.</p><h4>Preload</h4><p>When an asset (fonts, images, CSS or JS) is likely needed in the current page but will be used in a later point of time the <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Preloading_content"><strong>preload</strong></a> feature is handy:</p><pre>&lt;link <strong>rel=&quot;preload&quot;</strong>href=&quot;module.js&quot;&gt;</pre><p>With Webpack this can be done with magic comments as well:</p><pre>import(<strong>/* webpackPreload: true */</strong> &#39;./module&#39;);</pre><h4>DNS Prefetch</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/774/1*6M4vqX_yGf6HVWeXvDRFoQ.png" /></figure><p>Depending on the circumstances the initial connection with the server could take a good percentage of time. Using DNS prefetch attempt to resolve domain names before the resource get requested:</p><pre>&lt;link rel=&quot;<strong>dns-prefetch</strong>&quot; href=&quot;https://mysite.com&quot; &gt;</pre><h4>Prefetch</h4><p>If the application contains a very well defined user journey from page A to page B you can <a href="https://developer.mozilla.org/en-US/docs/Glossary/Prefetch"><strong>prefetch</strong></a> assets in a controlled way during the browser idle time in the page A to improve performance in page B:</p><pre>&lt;link <strong>rel=&quot;prefetch&quot;</strong> href=&quot;/images/big.jpeg&quot;&gt;</pre><p>This also can be used in Webpack with magic comments:</p><pre>import(<strong>/* webpackPrefetch: true */</strong> &#39;LoginModal&#39;);</pre><h3>Debugging performance</h3><p>Finally, debugging performance is key to identify areas of improvement in performance. Google Chrome team have worked deeply refining developer tools making this process easier.</p><h4><strong>Network tab — Timeline bar</strong></h4><p>Located at the top of the network tab, this feature allow to inspect the timing of each of the requests, and filter them in a specific point of time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/896/1*bEg2i4D9vs6KmGKMFTDtwQ.png" /></figure><h4><strong>Network tab — File download data</strong></h4><p>Reviewing file sizing, download time and the request waterfall is key to analyze page speed.</p><p>The waterfall tool shows detailed information of the requests including DNS handshake and download timing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Tt4TNdtxjLeY-zFeZhR29g.png" /></figure><h4>Performance tab</h4><p>The performance tab allows to record user interactions, making debugging of animations, user clicks or other related activities possible.</p><p>It also contain helpful information related with the load timing of each asset.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rkOlQOxnr3Heej2e5AWDcA.png" /></figure><p>For more information about debugging performance with Chrome Developer tools check this very handy <a href="https://developers.google.com/web/tools/chrome-devtools/evaluate-performance">article</a>.</p><h3>Conclusion</h3><p>The combination of HTTP 2, JS modules and Resource Hints is powerful. Using them correctly allows to load dependencies in a controlled and efficient way.</p><p>Debugging is also a critical part of the application development, allowing to identify slow requests or code and take action based on those.</p><p>A good code architecture and correct analysis of your application performance will improve the page load time greatly and help increase your users engagement in your application.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=483ff3070731" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Reach the flow: the key to improve your productivity]]></title>
            <link>https://medium.com/@jpgcode/reach-the-flow-the-key-to-improve-your-productivity-c2c58114827d?source=rss-ff7d78af523d------2</link>
            <guid isPermaLink="false">https://medium.com/p/c2c58114827d</guid>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[time-management]]></category>
            <dc:creator><![CDATA[José Pablo Granados]]></dc:creator>
            <pubDate>Fri, 13 Jan 2017 17:37:37 GMT</pubDate>
            <atom:updated>2017-01-13T18:06:04.395Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mWrQs6aEDR36YEsGU94-lg.jpeg" /></figure><p>It’s Monday. You get to the office after a very good relaxing weekend. You check the email and notice the list of items to complete this week finally arrived.</p><p>After an extensive review, you know you have a lot of things to complete and that makes you feel stressed because you don’t know how to manage your time in an efficient way to complete everything on time before the important demo on Friday.</p><p>We all have had this feeling at some point, and it is something hard to think about. Here is where reaching the<strong> flow </strong>is important.</p><h3>The flow</h3><blockquote>In <a href="https://en.wikipedia.org/wiki/Positive_psychology">positive psychology</a>, <strong>flow</strong>, also known as <strong>the zone</strong>, is the mental state of operation in which a person performing an activity is fully immersed in a feeling of energized focus, full involvement, and enjoyment in the process of the activity. In essence, flow is characterized by complete absorption in what one does.</blockquote><p>Reaching this state is hard, but the first step to reach it is to know that it exists.</p><p>This will help you to focus and use your time in more efficient way, in special for people who work with computers and programmers.</p><p>It takes a long time to dig over the code and reach a <strong>flow</strong> state, any kind of small interruption will require several minutes to focus and get to the previous state to continue. During the day you get emails, chat messages, phone calls, have meetings, and you get notifications from <a href="http://supercell.com/en/games/clashofclans/">Clash of Clans</a> game stating that your troops are ready for battle. <strong>This is probably why most developers feel more productive working at night.</strong></p><blockquote>In order to reach the flow you need to focus in your task completely without interruptions for a fair amount of time.</blockquote><p>The believe that having the meetings “first thing morning” is good, it is not completely true. Your body and mind is full of energy the first 4 hours after you get up. This is the time when you are able to fix complex problems in more efficient and faster way. If you think about it, this time is burned mostly in not that productive things like: stuck in traffic during your commute, having meetings, checking Facebook and reading the email.</p><p>Thankfully, there are some points that helps to improve productivity:</p><ul><li><strong>Use the last hours of your day to plan next day tasks. </strong><br>This will help you to be productive since the beginning.</li><li><strong>Make a list of items small enough to be completed. </strong><br>If you do this you can start removing things from the list and that will makes you feel productive.</li><li><strong>Try using the first hours of your day resolving the more complex tasks you have assigned.</strong><br>You can use the rest of your day to do simpler tasks and planning.</li><li><strong>Avoid having unnecessary meetings. </strong><br>Most problems can be resolved easily with a good question in an email or chat.</li><li><strong>Disable notifications in your phone, chat clients and similar if they are not critical.<br></strong>These notifications are distractions that prevents you to get to the flow state.</li></ul><h3>Two simple tools that helps to be Focused</h3><p>There is a combo of tools that you can use to take advantage of your time in a good way that I highly recommend:</p><h4>Wunderlist</h4><p><a href="https://www.wunderlist.com/">Wunderlist</a> is a simple tool to add items that you need to complete. You should add small tasks to complete and mark them as complete when you are done.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QBALVBuC9pmdmywMx4tynA.jpeg" /><figcaption>Wunderlist provides online lists of tasks which can be accessed in the computer and mobile</figcaption></figure><p>It is very helpful to keep track of the items remaining and know what you have already completed. Your mind will feel good to see how much have you done after a while and that will improve your productivity.</p><h4>Pomodoro technique</h4><p>When you have your list ready, you can use the <strong>Pomodoro</strong> technique to make sure you focus in your work and get things done.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/695/1*Xm4jyNa-Db_ODqf2Xf5nsQ.png" /></figure><p>The idea is to start a <strong>Pomodoro</strong> time, which consist of 20 minutes without any distraction. During this time, you can’t do anything that is not related with your task. You need to forget about the phone, chats, emails and other distractions to make it work.</p><p>Then you can have 5 minutes to do anything you want, attack in the Clash of Clans war, watch 5 minutes of your favorite movie or play with your cat.</p><p>Then you go back and start the process again. It’s fun!</p><p>The key thing is to follow the rule and avoid distractions until the <strong>Pomodoro</strong> time is over. You can even put a note in your back to let your co-workers know that you are in a middle of something important.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*iKgd9NFVKeO2ABBhlUzLfQ.jpeg" /><figcaption>Do not disturb during pomodoro</figcaption></figure><p>Some tasks are bigger than the others, so they will need more pomodoro cycles to complete, but that’s ok if you are following the rules.</p><p>There are several apps to use this technique, but <a href="https://itunes.apple.com/us/app/be-focused-focus-timer-goal/id973130201?mt=8"><strong>Be focused</strong></a><strong> </strong>(Previously named Pomodoro Time)<strong> </strong>is the one I use:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*gDMnH5vR0Zak4L9T5Y3u3Q.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*OuGKA79EyZp4RgCD2hSL5w.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*9a8xb5FLzcmq8qWQ1XicOQ.jpeg" /><figcaption>Be Focused app</figcaption></figure><p>It contains a timer to keep track of your time and that notifies you when you have completed the <strong>pomodoro</strong>, a small to do list and some stats.</p><h3>Conclusion</h3><p>After knowing these tools my productivity improved a lot and I was able to reach the <strong>flow </strong>in a better way. I hope they help you in your daily basis.</p><p>Feel free to leave comments or answers, I’ll answer as soon as possible.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c2c58114827d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Webpack: Learn the tool that changed the game— Part 1]]></title>
            <link>https://medium.com/@jpgcode/webpack-learn-the-tool-that-changed-the-game-part-1-38603b0f1ee8?source=rss-ff7d78af523d------2</link>
            <guid isPermaLink="false">https://medium.com/p/38603b0f1ee8</guid>
            <category><![CDATA[webpack]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[José Pablo Granados]]></dc:creator>
            <pubDate>Sat, 07 Jan 2017 15:33:51 GMT</pubDate>
            <atom:updated>2017-01-07T17:45:40.992Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G2o2E6fmipCHYvXANG9QgQ.jpeg" /></figure><p>Some years ago the web development world was much simpler. We had static websites with a few forms that had none or a very limited dynamic functionality. Everything was white/black and boring.</p><p>Now the things have changed. We have colorful websites, full of animations, sliders and forms that send the data behind the scenes without reloading the page. And they all should work great on different devices, resolutions and browsers.</p><p>Because all these changes, the art of front end became a real challenge for anyone trying to master it. HTML5, CSS3 are just a small portion of the web while JavaScript is eating the world.</p><p>Having the need of websites full of JavaScript functionality made us realize that we needed a better way to handle the amount of code we were using:</p><ul><li>Split the JavaScript into different files to make them more maintainable and readable.</li><li>Avoid having everything in the global browser scope.</li><li>Javascript lint during development through tools like <a href="https://www.npmjs.com/package/jslint">JSLint</a> and <a href="http://eslint.org/">ESLint</a>.</li><li>The use of newer versions of Javascript in which the browser didn’t understand causing the need to compile down to older versions using <a href="https://babeljs.io/">Babel</a>.</li><li>Empower the current version of the language enabling experimental new features, with languages like <a href="http://coffeescript.org/">CoffeeScript</a> or <a href="https://www.typescriptlang.org/">Typescript</a>.</li></ul><p><a href="http://gulpjs.com/">Gulp</a> and <a href="http://gruntjs.com/">Grunt</a> appeared as a front end task managers some years ago. They have been helping us with repetitive tasks for some years now. They work very well and makes the development process easy.</p><p>But then, a new tool appeared.</p><h3>A new generation task manager</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/642/1*qBcsvgCXoQISB1myC3r4HA.jpeg" /></figure><p><a href="https://webpack.js.org/">Webpack</a> is a tool very different of what you are used to. You need to open your mind to something different like you probably have never seen before.</p><blockquote>A module bundler for modern Javascript applications.</blockquote><p>It comes with functionalities out of the box that require very small configuration. Because of that it is normal to feel confused at the beginning.</p><p>To understand <a href="https://webpack.js.org/">Webpack</a> in a better way you need to first think on your common needs:</p><ul><li>A development server that helps you to run the sites in your local.</li><li>Some watchers in your files to fire a task when you make a change.</li><li>A live reload feature so that you do not need to reload your browser every time you make a change.</li><li>A way to prepare your final HTML/CSS/JS to be production ready.</li></ul><p>You can use the tool during your development and to prepare your assets for production. Depending on your project phase you will need different tasks running.</p><h4>Installation</h4><p>The installation is very easy, you can use npm or yarn to install:</p><pre>npm install webpack@beta --save-dev</pre><p>That will install <a href="https://webpack.js.org/">Webpack</a> 2 and make the main webpack command available in your project. (Make sure you have your package.json created before this step).</p><p>Webpack 2 Release Candidate was released recently, the core and documentation are stable. As a normal process in a software there are still some bugs to fix but you can feel secure there will not be breaking changes.</p><h4>Configuration</h4><p><a href="https://webpack.js.org/">Webpack</a> configuration is a simple JSON file named <strong>webpack.config.js </strong>which contains a few nodes to let the tool know what to do with your files.</p><pre>const webpack = require(&#39;webpack&#39;);</pre><pre>const webpackConfig = {  <br>     entry: &#39;./app/app.js&#39;,  <br>     output: {       <br>        path: `${__dirname}/dist`,      <br>        filename: &#39;bundle.js&#39;   <br>}};<br>  <br>module.exports = webpackConfig;</pre><h4><strong>The entry node</strong></h4><p>The <strong>entry</strong> node is where your application starts. In most applications all your source code is in a folder called app<strong> </strong>or<strong> </strong>src<strong>.</strong></p><p>You can add just one entry or multiple entry points, for now we will use just one to keep it simple.</p><blockquote>Webpack provides Common JS modules support as default without any configuration</blockquote><p>You can import in your entry file other JS files that are requirements of your app. This is basically hypothetical speaking the front door for webpack to run through your files.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U9RjUJ4QNjUTrylxftW2KA.png" /></figure><blockquote>In Webpack all your assets are consider modules, not only the JavaScript.<strong> </strong>You can import, css, sass, images, fonts on the entry file. You only need to let the tool know what to do with each file.</blockquote><h4>The output node</h4><p>In the <strong>output</strong> node you define where your production ready final assets will go. All your JavaScript will be bundled all into a single file automatically and you can configure other common things during this step like minify. Usually you define a <strong>dist </strong>or<strong> build </strong>folder on the root of your project for it.</p><h4>The first build</h4><p>With the above clear, you can use the small config above to run a simple build. Go to the root folder of your project and run this command:</p><pre>$ ./node_modules/.bin/webpack</pre><p>Congratulations! You have run your first build successfully! Webpack took your <strong>entry</strong> file code and created a bundle with all your code on it. It was easy, right?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/571/1*HtKrK7-efKVOBDW9WDIt-Q.jpeg" /></figure><p>Take a look the file you have now on <strong>dist</strong> folder. This is the file we will use in production. Webpack compiled it with all your code making sure the scope of each module is still private using JS techniques like closures.</p><p>Of course we need to do a lot more things to consider it ready, but now you understand how a very basic build can be done to prepare your final assets for production.</p><h4>Conclusion</h4><p>With the small config we added, we have available some key features:</p><ul><li>CommonJS modules import/export support.</li><li>Each JS module has a private scope.</li><li>All your Javascript is concatenated into a single file during the build.</li></ul><p>The code example of this tutorial is available here: <a href="https://github.com/jpgcode/webpack-tutorial-part1">https://github.com/jpgcode/webpack-tutorial-part1</a></p><p>In <strong>part 2</strong> you will learn how to use Webpack during development and we’ll cover the remaining concepts to configure the tool as your convenience.</p><p>For now take a look at the official <strong>Webpack 2</strong> documentation: <a href="https://webpack.js.org/">https://webpack.js.org</a>.</p><p>Feel free to leave comments or questions, I’ll answer as soon as possible.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=38603b0f1ee8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React vs Angular: Choose wisely]]></title>
            <link>https://medium.com/@jpgcode/react-vs-angular-choose-wisely-574b36b7551d?source=rss-ff7d78af523d------2</link>
            <guid isPermaLink="false">https://medium.com/p/574b36b7551d</guid>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[José Pablo Granados]]></dc:creator>
            <pubDate>Wed, 28 Dec 2016 20:25:17 GMT</pubDate>
            <atom:updated>2020-07-24T14:14:56.186Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/560/1*PzWfd-j71Gw8oYMipVwpwA.jpeg" /></figure><p>It’s time to start your new project. The feeling is amazing. Now you can start from scratch, try new technologies and forget about all those old things you had to support before.</p><p>The choice is not easy, there are a lot of new tools to try. And you know you need a few things for sure:</p><ul><li>A tool to do repetitive things for you, like compilation, transformations, linting, minification on your assets.</li><li>A local development server with Live Reload or similar.</li><li>A framework/library that allows you to write maintainable and clean Javascript.</li></ul><p>The first thing you will do is research. You will find hundreds of articles telling you why one is better than the other.</p><p>You notice the last commit on the <a href="https://github.com/gruntjs/grunt">Grunt</a><strong> </strong>project<strong> </strong>was 5 months ago. Then you find <a href="https://www.npmjs.com/package/gulp"><strong>Gulp</strong></a><strong> </strong>and <a href="https://www.npmjs.com/package/webpack"><strong>Webpack</strong></a><strong>. </strong>Both of them have thousands of downloads and are actively maintained. You are sure you want to use the shiny <strong>ESNext </strong>features<strong> </strong>and <strong>JS</strong> <strong>modules.</strong> Webpack provides both with minimal configuration and also a server with hot reload, so we have a winner.</p><p>Then the most difficult choice: Should you use the old good jQuery? Or give Angular or React a try? You know you will have smart components that are reusable and complex, so jQuery could become a big headache because the manual DOM manipulation and imperative programming style when the project grows. Here is where we end up with our 2 friends: <a href="https://angular.io/"><strong>Angular</strong></a><strong> and </strong><a href="https://facebook.github.io/react/"><strong>React</strong></a>.</p><p>Researching about this topic it’s not easy. Both of them look good, they have features that will help you to accomplish the project requirements in an efficient way, they are created by some of the best developers in the world and both are supported by HUGE companies. How would you make a good choice based on your requirements?</p><p>That was the problem I had a few weeks ago when started a project and had to decide between the two. At that moment, I would love to find an article talking about the differences in a more clear way.</p><h3><strong>Angular</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/256/1*dtl6FBperYpHyJieeYgIvQ.png" /></figure><p>Angular is a complete Javascript Framework created by Google. Its core was created using Typescript from Microsoft. It recently released the final version after being in beta for some months. It comes with a lot of awesome features:</p><ul><li>You can create reusable components very easily having data binding between your HTML template and your JS logic.</li><li><a href="https://www.typescriptlang.org/">Typescript</a> as JS superset allows to use the most recent features and compile down to ES5. It also provides static typing and real time syntax checker in you favorite text editor or IDE.</li><li>Provides an HTTP module to handle web services integration and ajax requests in a clear and smart way.</li><li>You can use promises or streams with <a href="http://reactivex.io/">Reactive Extensions(rx.js)</a> to manage your async data in a more powerful way than before.</li><li>It comes with an awesome router so that you can create your entire single page application with it.</li><li>It has some old concepts from Angular.js that will result familiar to you.</li><li>You can use state containers like <a href="http://redux.js.org/docs/introduction/">Redux</a> in Angular with some configuration.</li><li>Server side rendering is supported using <a href="https://universal.angular.io/">Angular Universal</a>.</li></ul><p>Based on the above the framework sounds great, but it has some downsides:</p><ul><li>Even if you are very good with JS the learning curve is big, you need to learn a lot of new things about framework to work with it.</li><li>The configuration with a module bundler like Webpack or <a href="http://rollupjs.org/">Rollup</a> is very hard.</li><li>The size of the framework is almost 1MB, you can integrate tree shaking to remove the unused pieces of the framework, but the configuration process is time consuming and hard.</li><li>For production is recommendable to enable <a href="https://angular.io/docs/ts/latest/cookbook/aot-compiler.html"><strong>Ahead of time</strong></a> compilation which is a way to compile Angular in a smarter way and make it faster. This is hard to configure as well.</li></ul><h3>React</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/578/1*GqKCwu0iDD0h3XRn8OB9Kw.png" /></figure><p>React is a UI library created by Facebook. It has been around for a while and it have had a very good acceptance by developers around the world because its simplicity and power. It provides:</p><ul><li>An easy way to create reusable components in your page.</li><li>The configuration is small and easy to follow.</li><li>You can integrate it easily with Webpack and <a href="https://babeljs.io/">Babel</a> to get all the ESNext features you need.</li><li>It has <a href="https://jsx.github.io/">JSX</a> built-in which is a very nice way to create your HTML in Javascript.</li><li>The great React router can be added so you can manage routes and create entire single page applications with it.</li><li><a href="http://redux.js.org/docs/introduction/">Redux</a> can be added for more complex projects, so that you can have better state management.</li><li>You can use Typescript, and Rx.js with React if you wish.</li><li><strong>The learning curve is very small.</strong> The more you know about JS, the more you know about React. The library specific things are just a few.</li><li>Server side rendering is supported using <a href="https://facebook.github.io/react/docs/react-dom-server.html">ReactDom Server</a>.</li></ul><p>The downside of it could be a good point too, depending on the context. You start with the basics and add features as you need. For some projects this save time, removes extra configuration and size in the final bundle.</p><h3>The differences to help you making the choice</h3><p>As you can see there is no clear winner. Everything depends on your needs. But there are a few differences that will help you to choose the best tool for your project.</p><h4>The built-in features you need</h4><p>Angular is a complete framework that comes with a lot of features out of the box. This will save you time if you need them all.</p><p>React is just an UI library that can be extended to do the same Angular does, but you will need to add features as needed.</p><p>This is a huge deal breaker depending on the project requirements. It will save you time and boost your productivity.</p><h4>The flexibility of the tool</h4><p>Angular is a complete framework that work best for Single Page applications. It uses a parent root component and it creates your application inside of it. This is something very important to understand, in special if you are dealing with a website that needs to mix static content with dynamic components that needs to be reused. I do not recommend to use it if your website is not a SPA or you don’t need most of the features that it provides built-in.</p><p>React is much smaller UI library and can be used without restrictions in standard websites for a few components or create entire Single Page applications with it.</p><h3><strong>Conclusion</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*qq3K1sHmd1Yb8X_LPjcCLw.jpeg" /></figure><p>Angular and React are awesome tools that can help a lot during your development process and will make you a happier developer. Avoid doing extra work and many headaches by just taking a pause analyzing which tool will fit your time and needs.</p><blockquote>For standard websites with some dynamic components use <strong>React</strong>.<br>For Single Page apps with Typescript and Observables built-in use <strong>Angular</strong>.<br>For Single Page apps with JSX and ESNext features use <strong>React</strong>.</blockquote><p>I recommend this read from <a href="https://medium.com/u/c359511de780">Eric Elliott</a> which provides more deeply details about this topic <a href="https://medium.com/javascript-scene/angular-2-vs-react-the-ultimate-dance-off-60e7dfbc379c#.ia3t1x23j">https://medium.com/javascript-scene/angular-2-vs-react-the-ultimate-dance-off-60e7dfbc379c#.ia3t1x23j</a></p><p>Feel free to leave some comments.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=574b36b7551d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>