<?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: David Roganov</title>
    <description>The latest articles on DEV Community by David Roganov (@lastenlol).</description>
    <link>https://dev.to/lastenlol</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%2F702273%2F5f8a98bc-51dc-45a7-bd9a-66075287ca1d.jpeg</url>
      <title>DEV Community: David Roganov</title>
      <link>https://dev.to/lastenlol</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/lastenlol"/>
    <language>en</language>
    <item>
      <title>What Is React and How to Master It?</title>
      <dc:creator>David Roganov</dc:creator>
      <pubDate>Fri, 10 Sep 2021 10:10:52 +0000</pubDate>
      <link>https://dev.to/lastenlol/what-is-react-and-how-to-master-it-46bg</link>
      <guid>https://dev.to/lastenlol/what-is-react-and-how-to-master-it-46bg</guid>
      <description>&lt;p&gt;In this article, I'll talk about React, a popular JavaScript library, and I'll share a learning roadmap for how to master it.&lt;/p&gt;

&lt;p&gt;React specialists are in high demand: Yandex uses it; Netflix, Facebook, as well as many other well-known products have been built using React. &lt;/p&gt;

&lt;h2&gt;
  
  
  What is React?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://reactjs.org/" rel="noopener noreferrer"&gt;React&lt;/a&gt; is a JavaScript library for creating user interfaces. First up, note that React is a library and not a framework, though it's often referred to as one. This is because it doesn't create any sort of "scaffold" for the project. That means that this library alone is generally not enough to complete a project. Indeed, React developers often create apps using extra tools like Redux, TypeScript, and Jest. &lt;/p&gt;

&lt;p&gt;Instead, React just performs one task: it displays interface components synchronized with the application's data.&lt;/p&gt;

&lt;p&gt;Soon after the advent of React, similar options like Vue.js and Svelte essentially took over the front-end world. The common denominator here is that they all help solve problems based on a declarative approach rather than an imperative approach. Here's how those two approaches break down:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Declarative approach&lt;/strong&gt;: describes the end result. Basically, the result we want to have.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Imperative approach:&lt;/strong&gt; describes the specific steps to achieve an end result. That is, the steps we must take to get a result.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As it turns out, the declarative approach is great for creating interfaces, and this has taken root in the tech community. Furthermore, this approach doesn't solely apply to web technologies. For instance, Apple has recently introduced the &lt;a href="https://developer.apple.com/xcode/swiftui/" rel="noopener noreferrer"&gt;SwiftUI&lt;/a&gt; framework based on the same principles.&lt;/p&gt;

&lt;p&gt;To better understand the difference between the two approaches, let's take a look at them in more detail. We'll create two versions of a simple application. One with HTML and JS (using an imperative approach) and the other with React (applying the declarative approach). &lt;/p&gt;

&lt;p&gt;Our application will display a number and a button which will increase the value of the number by one each time it is clicked.&lt;/p&gt;

&lt;h2&gt;
  
  
  A pure HTML and JS application
&lt;/h2&gt;

&lt;p&gt;Using the imperative approach, the step-by-step instructions in &lt;a href="https://codesandbox.io/s/quizzical-morse-lfo2v?file=/index.html" rel="noopener noreferrer"&gt;our program&lt;/a&gt; look like this:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Declare the initial program values, assigning DOM elements references to constants.&lt;/li&gt;
&lt;li&gt;Write an &lt;code&gt;increment&lt;/code&gt; handler that will increment the current value and assign it to the corresponding element.&lt;/li&gt;
&lt;li&gt;Set the initial value of the counter, in this case, &lt;code&gt;0&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Apply the handler for our button.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Note that the HTML markup and JS logic are kept separate.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="err"&gt;!&lt;/span&gt;&lt;span class="na"&gt;DOCTYPE&lt;/span&gt; &lt;span class="na"&gt;html&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;html&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
 &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;head&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
   &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;title&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Parcel Sandbox&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;title&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
   &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;meta&lt;/span&gt; &lt;span class="na"&gt;charset&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"UTF-8"&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
 &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;head&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;

 &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;body&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
   &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt; &lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"root"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
     &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"counter-value"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
     &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"increment-btn"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;+1&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
   &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;

   &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;script&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
     const counterValueElement = document.getElementById("counter-value");
     const incrementBtn = document.getElementById("increment-btn");
     let counterValue = 0;

     function increment() &lt;span class="si"&gt;{&lt;/span&gt;
       &lt;span class="nx"&gt;counterValue&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
       &lt;span class="nx"&gt;counterValueElement&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;innerText&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;counterValue&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
     &lt;span class="si"&gt;}&lt;/span&gt;

     counterValueElement.innerText = counterValue;
     incrementBtn.addEventListener("click", increment);
   &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;script&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
 &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;body&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;html&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The same application with React
&lt;/h2&gt;

&lt;p&gt;Due to the specific features of the React library, its code may look unusual for someone who is accustomed to JavaScript. For example, there's practically no layout markup contained inside the &lt;code&gt;&amp;lt;body&amp;gt;&lt;/code&gt; tag. &lt;/p&gt;

&lt;p&gt;That being said, let's focus on the counter application. You can find the main logic &lt;a href="https://codesandbox.io/s/billowing-smoke-fofr3?file=/index.html" rel="noopener noreferrer"&gt;on lines 25-40&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Here's what's happening:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;We tell React we'll use some mutable value by calling the &lt;code&gt;React.useState()&lt;/code&gt; function. React gives us the &lt;code&gt;value&lt;/code&gt; and a function, &lt;code&gt;setValue()&lt;/code&gt;, which we can use to set this value.&lt;/li&gt;
&lt;li&gt;Next, we declare an &lt;code&gt;increment&lt;/code&gt; handler that sets a new counter &lt;code&gt;value&lt;/code&gt; using the &lt;code&gt;setValue()&lt;/code&gt; function from the previous step.&lt;/li&gt;
&lt;li&gt;We also create some application markup by using a syntax called &lt;a href="https://reactjs.org/docs/introducing-jsx.html" rel="noopener noreferrer"&gt;JSX&lt;/a&gt;, which is similar to HTML. This markup duplicates the layout from the previous example built with pure JS. But this time, the &lt;code&gt;value&lt;/code&gt; of the counter and the &lt;code&gt;onClick&lt;/code&gt; listener as well as the &lt;code&gt;increment&lt;/code&gt; handler are all right inside the markup itself. As per the declarative approach, this is where we're describing the final result.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All the code is inside the &lt;code&gt;App()&lt;/code&gt; function. In React, this and other similar functions are called components. A component is a piece of interface that contains markup and, sometimes, its associated logic. All React apps are built using components. The component approach appeared long before React, but it's now been combined with the declarative approach here.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="err"&gt;!&lt;/span&gt;&lt;span class="na"&gt;DOCTYPE&lt;/span&gt; &lt;span class="na"&gt;html&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;html&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
 &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;head&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
   &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;title&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Parcel Sandbox&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;title&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
   &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;meta&lt;/span&gt; &lt;span class="na"&gt;charset&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"UTF-8"&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
 &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;head&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;

 &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;body&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
   &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"root"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;

   &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;script&lt;/span&gt;
     &lt;span class="na"&gt;src&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"https://unpkg.com/react@17/umd/react.development.js"&lt;/span&gt;
     &lt;span class="na"&gt;crossorigin&lt;/span&gt;
   &lt;span class="p"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;script&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
   &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;script&lt;/span&gt;
     &lt;span class="na"&gt;src&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"https://unpkg.com/react-dom@17/umd/react-dom.development.js"&lt;/span&gt;
     &lt;span class="na"&gt;crossorigin&lt;/span&gt;
   &lt;span class="p"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;script&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
   &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;script&lt;/span&gt;
     &lt;span class="na"&gt;src&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"https://unpkg.com/@babel/standalone@7.13.6/babel.min.js"&lt;/span&gt;
     &lt;span class="na"&gt;crossorigin&lt;/span&gt;
   &lt;span class="p"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;script&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;

   &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;script&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"text/babel"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
     function App() &lt;span class="si"&gt;{&lt;/span&gt;
       &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setValue&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

       &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;increment&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
         &lt;span class="nf"&gt;setValue&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
       &lt;span class="p"&gt;}&lt;/span&gt;

       &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
         &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"app"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
           &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
           &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="na"&gt;onClick&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;increment&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;+1&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
         &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
       &lt;span class="p"&gt;);&lt;/span&gt;
     &lt;span class="si"&gt;}&lt;/span&gt;

     ReactDOM.render(
       &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
         &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;App&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
       &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;,
       document.getElementById("root")
     );
   &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;script&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
 &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;body&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;html&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Comparing the two approaches
&lt;/h2&gt;

&lt;p&gt;In the first example, we wrote an algorithm for working with our elements, defined a value, and specified how it should be modified — the steps required to achieve our desired result.&lt;/p&gt;

&lt;p&gt;In the second case, by using JSX markup and some of React's built-in functions, we described the result we wanted to see upfront. In a nutshell, this is the difference between the declarative and imperative approaches.&lt;/p&gt;

&lt;p&gt;If we compare these two applications, it's possible to single out the following &lt;strong&gt;features of the React app:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The markup and related logic are written together and related to each other. This will make it easier to work with the code in the future.&lt;/li&gt;
&lt;li&gt;The counter with the button is specified in the component itself. This means that we can reuse it very easily; for example, we could just write another &lt;code&gt;&amp;lt;App /&amp;gt;&lt;/code&gt; tag on line 44, and two independent counters would appear on the page.&lt;/li&gt;
&lt;li&gt;Using identifiers to refer to DOM elements is no longer necessary. This also makes the code easier to maintain.&lt;/li&gt;
&lt;li&gt;The state of the component is isolated. There is no way to modify the value from the outside unless we clearly intend to do so. This makes the data flow in your application more predictable, which in turn, makes it easier to develop and debug.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In React, It's also worth noting that applications don't work directly with the DOM tree itself. Instead, we simply describe markup using JSX, and React will decide how to transform it into real DOM elements. This is made possible by an abstraction called the &lt;a href="https://reactjs.org/docs/faq-internals.html#gatsby-focus-wrapper" rel="noopener noreferrer"&gt;virtual DOM&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Previously, there was a lot of misleading information online about React's speed. The idea was that React was fast thanks to the virtual DOM. It should be mentioned that a &lt;strong&gt;React application can't be faster than an app written in pure JavaScript.&lt;/strong&gt; This is because React itself is written and executed in JavaScript.&lt;/p&gt;

&lt;h2&gt;
  
  
  React features
&lt;/h2&gt;

&lt;p&gt;It's worth noting that React is not a universal tool that fits any project. To understand if React will solve your problems, we should learn more about its pros and cons. &lt;/p&gt;

&lt;p&gt;The React library can definitely make life easier for developers as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It can help you build an interface comprised of a number of easy-to-maintain components.&lt;/li&gt;
&lt;li&gt;It adds a convenient layer of abstraction, eliminating the need to work directly with the DOM.&lt;/li&gt;
&lt;li&gt;React is no longer a new library. It has Facebook and a huge community of developers behind it. This means it's well-tested, well-supported, and constantly updated, so transitioning to new versions of React is smooth.&lt;/li&gt;
&lt;li&gt;Thanks to the community, React has well-developed documentation, and a lot of developer experience has been gathered in articles, courses, and via conferences. This is particularly useful for beginners but is helpful for more experienced developers, too.&lt;/li&gt;
&lt;li&gt;On GitHub, you can find ready-made React components for almost any application. And, if not, you'll still find the necessary independent libraries. From there you can look for integration or make it yourself.&lt;/li&gt;
&lt;li&gt;Over time, the React community has established certain approaches and come to some agreements on code, project organization, and solving common problems. For developers, this means that you'll need to spend less time discussing or thinking about these issues — you can just use the methods and approaches that are already in widespread use.&lt;/li&gt;
&lt;li&gt;While a project will likely have some setup implemented with Webpack, Parcel, Rollup, or some other bundler, do keep in mind that these are not actually required to use with React. You write in pure JS so you don't need to learn any additional dialects of HTML, CSS, or JS. Of course, JSX is quite convenient and is almost always used with React, but this is also &lt;a href="https://reactjs.org/docs/react-without-jsx.html" rel="noopener noreferrer"&gt;optional&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;React is an open-source project. This means it's safe to use even with commercial applications.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;However, there are a few potential issues to consider when using React:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;React increases the size of the app that users will download (~40 kB for the React and React-DOM packages).&lt;/li&gt;
&lt;li&gt;The downloaded code must be executed in the browser so this means the app will first load up slowly. You can read more about this in the article &lt;a href="https://v8.dev/blog/cost-of-javascript-2019" rel="noopener noreferrer"&gt;"The cost of JavaScript in 2019&lt;/a&gt;" by the V8 team.&lt;/li&gt;
&lt;li&gt;When dealing with the virtual DOM, we can run into a few difficulties. The first is in terms of execution time (comparing the virtual trees). Second, in terms of memory, virtual trees need to be stored somewhere and not just as a single copy. As the number of elements per page increases, resources also increase, which can be a real problem on mobile devices. When learning React, it's important to pay attention to optimization options during the rendering process of an application. The necessary tools to do this can be found in the library itself.&lt;/li&gt;
&lt;li&gt;You'll also need to consider the basic learning curve that comes with React. A programmer must learn not only the library itself, but also the paradigm. On the official website, there is a good article called "&lt;a href="https://reactjs.org/docs/thinking-in-react.html" rel="noopener noreferrer"&gt;Thinking in React&lt;/a&gt;" which will help with this.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These disadvantages, of course, are no reason to completely reject React or other similar libraries. But still, these points need to be taken into consideration when using this tool.&lt;/p&gt;

&lt;p&gt;Additionally, despite the fact that the virtual tree consumes additional time and memory, for most applications this won't be critical. React remains fast and it also allows you to optimize problem areas where necessary.&lt;/p&gt;

&lt;p&gt;As for the time required to learn React (or another similar library), think of it as an investment in yourself as a developer. React is an up-to-date, interesting, and widely-used technology.&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdtwzqrul79od31wysjye.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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdtwzqrul79od31wysjye.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What type of projects suit React?
&lt;/h2&gt;

&lt;p&gt;To summarize, there are several types of projects that would benefit from React.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Projects which are expected to expand, and where the development team will continue their work. In this case, the use of a well-known technology will make developer communication and code maintenance easier. &lt;/li&gt;
&lt;li&gt;Medium and large-sized projects will benefit from the component approach, which is the heart of React. This will make your code easier to organize and reuse which will be beneficial in the long run.&lt;/li&gt;
&lt;li&gt;Legacy projects that need to go through refactoring. React can be useful in these cases since it can be added to an existing project by updating the codebase gradually.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;React may not be the best option for simple applications, such as single-page websites, because in these cases, it will take a lot of time and effort to understand the project setup and environment.&lt;/p&gt;

&lt;p&gt;In addition, React isn't the best choice for implementing parts of a project that are very sensitive to resource consumption. In this case, hybrid use is possible. When an application is mostly written in React but the performance-demanding parts of code don't interact with it, the library doesn't interfere with such integrations in any way. However, let's be reasonable — React is fast enough in most cases, and you can always optimize bottlenecks after the fact. &lt;/p&gt;

&lt;h2&gt;
  
  
  How to learn React?
&lt;/h2&gt;

&lt;p&gt;One of the most useful and complete resources for learning React is the library's &lt;a href="https://reactjs.org/" rel="noopener noreferrer"&gt;official website&lt;/a&gt;. It's been translated into many languages and the creators continually update it with new material. &lt;/p&gt;

&lt;p&gt;We'll share a possible React learning roadmap. Each of these topics or tasks is worth mastering, or at least further investigation, as you delve deeper into this new world:&lt;/p&gt;

&lt;h3&gt;
  
  
  The basics:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://reactjs.org/docs/add-react-to-a-website.html" rel="noopener noreferrer"&gt;Adding React&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Basic familiarity with &lt;a href="https://reactjs.org/docs/introducing-jsx.html" rel="noopener noreferrer"&gt;JSX&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Component basics: &lt;a href="https://practicum.yandex.com/" rel="noopener noreferrer"&gt;state&lt;/a&gt;, &lt;a href="https://reactjs.org/docs/components-and-props.html" rel="noopener noreferrer"&gt;props&lt;/a&gt;, and &lt;a href="https://reactjs.org/docs/state-and-lifecycle.html" rel="noopener noreferrer"&gt;the component lifecycle&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Component types: &lt;a href="https://reactjs.org/docs/components-and-props.html#function-and-class-components" rel="noopener noreferrer"&gt;class-based and functional components&lt;/a&gt;, and their differences&lt;/li&gt;
&lt;li&gt;&lt;a href="https://reactjs.org/docs/handling-events.html" rel="noopener noreferrer"&gt;Event handling&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://reactjs.org/docs/forms.html" rel="noopener noreferrer"&gt;Working with forms&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://reactjs.org/docs/create-a-new-react-app.html" rel="noopener noreferrer"&gt;Developing a simple application with React&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://reactjs.org/docs/hooks-intro.html" rel="noopener noreferrer"&gt;React hooks&lt;/a&gt;, &lt;a href="https://reactjs.org/docs/hooks-custom.html" rel="noopener noreferrer"&gt;custom hooks&lt;/a&gt;, and &lt;a href="https://reactjs.org/docs/refs-and-the-dom.html" rel="noopener noreferrer"&gt;refs&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Learning to utilize popular templates: &lt;a href="https://reactjs.org/docs/higher-order-components.html" rel="noopener noreferrer"&gt;higher-order components&lt;/a&gt;, &lt;a href="https://reactjs.org/docs/render-props.html" rel="noopener noreferrer"&gt;render props&lt;/a&gt;, using presentational and container components, as well as mastering &lt;a href="https://reactjs.org/docs/forms.html#controlled-components" rel="noopener noreferrer"&gt;controlled&lt;/a&gt; and &lt;a href="https://reactjs.org/docs/uncontrolled-components.html" rel="noopener noreferrer"&gt;uncontrolled components&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Controlling the state of the app:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://reactjs.org/docs/context.html" rel="noopener noreferrer"&gt;React Context&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://facebook.github.io/flux/" rel="noopener noreferrer"&gt;Flux architecture&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://reactjs.org/docs/hooks-reference.html#usereducer" rel="noopener noreferrer"&gt;The &lt;code&gt;useReducer&lt;/code&gt; hook&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Third-party libraries, like &lt;a href="https://redux.js.org/" rel="noopener noreferrer"&gt;Redux&lt;/a&gt;, &lt;a href="https://mobx.js.org/" rel="noopener noreferrer"&gt;MobX&lt;/a&gt; and others&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  React performance:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://reactjs.org/blog/2014/01/02/react-chrome-developer-tools.html" rel="noopener noreferrer"&gt;Debugging performance problems&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Using &lt;a href="https://reactjs.org/docs/profiler.html" rel="noopener noreferrer"&gt;React profiler&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://reactjs.org/docs/optimizing-performance.html" rel="noopener noreferrer"&gt;Optimizing React apps&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  More advanced concepts:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://reactjs.org/docs/forwarding-refs.html" rel="noopener noreferrer"&gt;Forwarding refs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://reactjs.org/docs/error-boundaries.html" rel="noopener noreferrer"&gt;Error boundaries&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://reactjs.org/docs/portals.html" rel="noopener noreferrer"&gt;React Portals&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://reactjs.org/docs/integrating-with-other-libraries.html" rel="noopener noreferrer"&gt;Integration of other JS libraries&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://reactjs.org/docs/code-splitting.html#reactlazy" rel="noopener noreferrer"&gt;Lazy loading components&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://reactjs.org/docs/react-dom-server.html" rel="noopener noreferrer"&gt;Server-side rendering&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://reactjs.org/docs/strict-mode.html" rel="noopener noreferrer"&gt;Strict mode&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://reactjs.org/docs/react-api.html#suspense" rel="noopener noreferrer"&gt;React Suspense&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://reactjs.org/blog/2019/11/06/building-great-user-experiences-with-concurrent-mode-and-suspense.html" rel="noopener noreferrer"&gt;Concurrent mode&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  React under the hood:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://reactjs.org/docs/faq-internals.html" rel="noopener noreferrer"&gt;The virtual DOM&lt;/a&gt; and &lt;a href="https://reactjs.org/docs/reconciliation.html" rel="noopener noreferrer"&gt;the reconciliation algorithm&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Understanding the concepts and mechanics of &lt;a href="https://reactjs.org/docs/codebase-overview.html#renderers" rel="noopener noreferrer"&gt;reconcilers and rendering&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  - Writing your own renderer
&lt;/h2&gt;

&lt;p&gt;Almost all of these topics are covered on the &lt;a href="https://reactjs.org/" rel="noopener noreferrer"&gt;official React website&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you're already familiar with React, consider checking out this great article called "&lt;a href="https://pomb.us/build-your-own-react/" rel="noopener noreferrer"&gt;Build your own React&lt;/a&gt;"; it will help you gain a more complete understanding of how React works. You can also watch the &lt;a href="https://www.youtube.com/channel/UCz5vTaEhvh7dOHEyd1efcaQ" rel="noopener noreferrer"&gt;React Conf&lt;/a&gt; speeches.&lt;/p&gt;

&lt;p&gt;In addition to these resources, there are many online courses on the market of varying intensity and depth. There are &lt;a href="http://practicum.yandex.com/web" rel="noopener noreferrer"&gt;comprehensive courses that will immerse a newbie student into the React ecosystem&lt;/a&gt;. There are also courses that focus on very specific things like using different templates or state managers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why React now?
&lt;/h2&gt;

&lt;p&gt;React is a popular library that will stay relevant for a long time to come. This means that you can always find a project written in React to work on. And there is a high demand for skilled React developers.&lt;/p&gt;

&lt;p&gt;React shows you interface development through the lens of declarative programming. This is useful for improving your general knowledge and broadening your horizons, and the skills gained will make it easier to learn other similar libraries and technologies like Vue.js, Svelte, or even SwiftUI. In addition to this, by adopting the well-established community conventions, patterns, and approaches, the better you'll learn to write good, maintainable code.&lt;/p&gt;

&lt;p&gt;But it's also important to understand that, first and foremost, React is a JavaScript library. So, before learning React, you need to have a pretty good handle on JavaScript, along with HTML and CSS. This will greatly speed up the React learning process and will also increase your value as a developer on the job market. This fundamental knowledge will help you find the best technology for the task at hand, whether it's React or something else.&lt;/p&gt;

&lt;p&gt;This roadmap offers a great starting point, but if you're ready to change your career and looking for a more well-rounded education in web development, come join us at Practicum by Yandex and &lt;a href="https://practicum.yandex.com/web/?utm_source=pr&amp;amp;utm_medium=content&amp;amp;utm_content=what_is_react_web&amp;amp;utm_campaign=pr_content_main_devto" rel="noopener noreferrer"&gt;check out our web developer course&lt;/a&gt;. Here, you'll learn about modern web development (including React), acquire soft skills, build portfolio projects, and more, as well as get the mentorship and guidance needed to help you properly develop your tech career. Additionally, we offer other learning opportunities in Data Science and Data Analytics — &lt;a href="https://practicum.yandex.com/?utm_source=pr&amp;amp;utm_medium=content&amp;amp;utm_content=what_is_react_&amp;amp;utm_campaign=pr_content_main_devto" rel="noopener noreferrer"&gt;you can explore everything here.&lt;/a&gt; &lt;/p&gt;

</description>
      <category>react</category>
    </item>
  </channel>
</rss>
