<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Rakshit Soral</title>
    <description>The latest articles on DEV Community by Rakshit Soral (@rakshitsoral).</description>
    <link>https://dev.to/rakshitsoral</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F62695%2F4d22d8a1-10f6-4647-b430-764ed428eb16.jpg</url>
      <title>DEV Community: Rakshit Soral</title>
      <link>https://dev.to/rakshitsoral</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rakshitsoral"/>
    <language>en</language>
    <item>
      <title>What Makes React SLOW, What makes React FAST</title>
      <dc:creator>Rakshit Soral</dc:creator>
      <pubDate>Tue, 11 Sep 2018 14:22:50 +0000</pubDate>
      <link>https://dev.to/rakshitsoral/what-makes-react-slow-what-makes-react-fast-33n7</link>
      <guid>https://dev.to/rakshitsoral/what-makes-react-slow-what-makes-react-fast-33n7</guid>
      <description>&lt;p&gt;How many times have you heard your developer colleagues screaming …. &lt;strong&gt;“React is fast but it often makes development slower”?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;5, 10, 100 or maybe 1000 times! Right?&lt;/p&gt;

&lt;p&gt;Well, I am not joking or ranting about the framework. I am here to tell you the &lt;strong&gt;TRUTH&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The truth that most developers found hard to &lt;strong&gt;AGREE&lt;/strong&gt; upon. &lt;/p&gt;

&lt;h2&gt;
  
  
  The truth about DOM you need to know about
&lt;/h2&gt;

&lt;p&gt;DOM manipulation is the heart of the so-called modern and interactive web development. Unfortunately, it’s very slow in carrying out the operations. Even &lt;strong&gt;MORE&lt;/strong&gt; slower than typical Javascript operations. &lt;/p&gt;

&lt;p&gt;The slowness which I am talking about is even made WORSE by the fact that most Javascript frameworks are known to update the DOM un-necessarily and more often than needed. &lt;/p&gt;

&lt;p&gt;For an instance, let’s say you have an E-commerce application that showcases a list of ten items. You checked-off the first item and find out that the list has been &lt;strong&gt;REBUILT&lt;/strong&gt;. Now, that’s &lt;strong&gt;10 TIMES&lt;/strong&gt; more work than necessary!&lt;/p&gt;

&lt;p&gt;The Engineers at React found out a way to address this problem. They came up with something which is called as “Virtual DOM”. &lt;/p&gt;

&lt;h2&gt;
  
  
  Enters the Virtual DOM - React
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;In React, for every DOM, you have a corresponding object of VIRTUAL DOM which resembles like a lightweight copy of the original DOM object.&lt;/strong&gt; Both DOM object and Virtual DOM object have similar properties with a smaller difference of capitalizing what to update. &lt;/p&gt;

&lt;p&gt;Once the Virtual DOM gets updated by rendering the UI components, React compares the virtual DOM with a virtual DOM snapshot that was taken right before the update.&lt;/p&gt;

&lt;p&gt;In this way, React evaluates which VIRTUAL DOM objects have changed. This process is called as “diffing”. &lt;/p&gt;

&lt;p&gt;In the above example, React would be smart enough to analyze the changes and rebuild the first item thereby leaving aside the rest of the list alone. &lt;/p&gt;

&lt;p&gt;This gives React a big &lt;strong&gt;SPEED Boost&lt;/strong&gt; as React only updates the necessary parts of the DOM.&lt;/p&gt;

&lt;h2&gt;
  
  
  The DIRTY Parts about React’s Virtual DOM
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Manipulating the DOM in Javascript is slow, Manipulating the virtual DOM in React is even more faster.&lt;/strong&gt; This is something which even React community will agree. Now, let's discuss the fact which makes Optimizing React difficult.&lt;/p&gt;

&lt;p&gt;Whenever you call setState on a React component, React will mark it as dirty.  At the time of ending event loop, React will look at these dirty components and re-render them. This happens exactly ONE time when the DOM is being updated. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fo3qwv6w8yjfyag866gni.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fo3qwv6w8yjfyag866gni.png" title="React Diff Algo" alt="React Diff Algo"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Upon calling of SetState, React rebuilds the virtual DOM for all the child components. But the problem would be if you re-render root element, you will end up rendering the whole app which is hard to optimize. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fz6d5pw0cwrwp319sv949.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fz6d5pw0cwrwp319sv949.png" title="React Re-rendering of Tree" alt="React Re-rendering of Tree"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thankfully, there are TONS of optimization techniques that can make your React app faster. There is this &lt;a href="https://www.simform.com/react-performance/" rel="noopener noreferrer"&gt;definitive guide on making a React app FASTER&lt;/a&gt; which goes into details on optimizing the React components. &lt;/p&gt;

</description>
      <category>react</category>
      <category>discuss</category>
    </item>
    <item>
      <title>As a Chief tech fella (say CTO), what tech-stack would you like to choose for your project and what are the exact reasons?</title>
      <dc:creator>Rakshit Soral</dc:creator>
      <pubDate>Wed, 20 Jun 2018 12:02:39 +0000</pubDate>
      <link>https://dev.to/rakshitsoral/as-a-chief-tech-fella-say-cto-what-tech-stack-would-you-like-to-choose-for-your-project-and-what-are-the-exact-reasons-4k0j</link>
      <guid>https://dev.to/rakshitsoral/as-a-chief-tech-fella-say-cto-what-tech-stack-would-you-like-to-choose-for-your-project-and-what-are-the-exact-reasons-4k0j</guid>
      <description>&lt;p&gt;Imagine a situation where you're in charge of a high-end project as a chief tech fella. Among usual technologies which ones would you choose And in what circumstances? Where would you pick Java (JVM family), Python/Ruby or Node.js and PHP? And other scenarios where you'd take other paths.&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>mobile</category>
      <category>web</category>
    </item>
    <item>
      <title>What will happen to React and React Native #deleteFacebook?</title>
      <dc:creator>Rakshit Soral</dc:creator>
      <pubDate>Tue, 27 Mar 2018 13:46:07 +0000</pubDate>
      <link>https://dev.to/rakshitsoral/what-will-happen-to-react-and-react-native-deletefacebook-4gm2</link>
      <guid>https://dev.to/rakshitsoral/what-will-happen-to-react-and-react-native-deletefacebook-4gm2</guid>
      <description>

&lt;p&gt;As &lt;a href="https://www.vox.com/policy-and-politics/2018/3/23/17151916/facebook-cambridge-analytica-trump-diagram"&gt;Cambridge Analytica news broke through&lt;/a&gt;, outraging millions of people and churning #deleteFacebook campaign. Personally, there’s a lot to dislike about what happened there. But, I am not here to talk about that. &lt;/p&gt;

&lt;p&gt;I don’t know why in our dev community people are talking about the doom of React and React Native if Facebook dies. Some are even leveraging this opportunity to say “Hey! Don’t use React native. It will die now with Facebook”. &lt;/p&gt;

&lt;p&gt;Let’s consider that even if 1% of people even deleted their Facebook accounts, #deleteFacebook would be a huge campaign. Set that aside, check out this &lt;a href="https://vimeo.com/260417482"&gt;talk from Orta&lt;/a&gt;. Orta says that they will continue to support React native even if Facebook drops it. Given everything, it is highly unlikely that Facebook would go down, and behemoths of Silicon Valley like Airbnb and Dropbox would still fund/contribute towards evolution and development of React native in one way or another. &lt;/p&gt;

&lt;p&gt;Just some thoughts on the status quo and the BS that spreads around :) &lt;/p&gt;


</description>
      <category>reactnative</category>
      <category>facebook</category>
      <category>discuss</category>
    </item>
  </channel>
</rss>
