<?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: Eboreime Rhoda</title>
    <description>The latest articles on DEV Community by Eboreime Rhoda (@doctdev).</description>
    <link>https://dev.to/doctdev</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%2F549568%2Fb7034775-878a-4289-b809-d917dfcfa0f6.jpg</url>
      <title>DEV Community: Eboreime Rhoda</title>
      <link>https://dev.to/doctdev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/doctdev"/>
    <language>en</language>
    <item>
      <title>Rendering Lists in React</title>
      <dc:creator>Eboreime Rhoda</dc:creator>
      <pubDate>Thu, 15 Feb 2024 07:38:07 +0000</pubDate>
      <link>https://dev.to/doctdev/rendering-lists-in-react-59b4</link>
      <guid>https://dev.to/doctdev/rendering-lists-in-react-59b4</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Rendering lists is a common task in modern web applications, especially when dealing with dynamic content such as movie listings, food orders, or book catalogs. As developers, it's crucial to master the art of manipulating and displaying lists effectively. In this tutorial, we'll explore how to render lists in React to enhance user experiences in the apps we build.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Fundamental knowledge of HTML, JavaScript, and React&lt;/li&gt;
&lt;li&gt;A code editor to follow along&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Transforming Lists with the &lt;code&gt;map()&lt;/code&gt; method&lt;/li&gt;
&lt;li&gt;Rendering Lists in components&lt;/li&gt;
&lt;li&gt;Using Keys Within Lists&lt;/li&gt;
&lt;li&gt;Conclusion&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;In the real world, a list is a simple collection of elements, often represented as an array in JavaScript. Lists become essential when fetching data from external sources, such as APIs. For example, when creating a book listing app, you'll need to retrieve a list of books from an API and transform the data before displaying it to users. This is where the map() method becomes invaluable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Transforming Lists with the &lt;code&gt;map()&lt;/code&gt; method
&lt;/h2&gt;

&lt;p&gt;The map() method allows us to selectively display data to users by iterating through an array, applying a callback function to each element, and constructing a new array from the results.&lt;/p&gt;

&lt;p&gt;Let's consider how to transform a list of book items using the map() method in JavaScript. When working with lists in JavaScript, you'll use the array type specific to your data. In this tutorial, we'll transform data obtained from a third party (using an array of JavaScript objects) with the map() method.&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map"&gt;&lt;code&gt;map()&lt;/code&gt;&lt;/a&gt; method is used for iterating through an array, calling a provided callback function for each element, and constructing a new array from the results.&lt;/p&gt;

&lt;p&gt;Here's a snippet of the data:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="err"&gt;export&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;const&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;bookList&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="err"&gt;id:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="err"&gt;title:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Atomic Habits"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="err"&gt;author:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"James Clear"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="err"&gt;frontCover:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://m.media-amazon.com/images/I/513Y5o- DYtL.jpg"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="err"&gt;backCover:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://m.media- amazon.com/images/I/81DCnP7ntKL._AC_UF1000,1000_QL80_.jpg"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="err"&gt;datePublished:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2018"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="err"&gt;purchaseLink:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://www.amazon.com/Atomic-Habits-James-Clear- audiobook/dp/B07RFSSYBH"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="err"&gt;id:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="err"&gt;title:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Outliers"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="err"&gt;author:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Malcolm Gladwell"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="err"&gt;frontCover:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://m.media-amazon.com/images/I/51CFbC0HoeL.jpg"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="err"&gt;backCover:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://www.shopyaar.com/upload/product/a69375492ef2da69b89c3093a32e375e.jpg"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="err"&gt;datePublished:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2008"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="err"&gt;purchaseLink:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://www.amazon.com/Outliers-Malcolm-Gladwell-audiobook/dp/B001LNK9C4/ref=sr_1_1?adgrpid=116047907195&amp;amp;hvadid=585359320515&amp;amp;hvdev=c&amp;amp;hvlocphy=21541&amp;amp;hvnetw=g&amp;amp;hvqmt=e&amp;amp;hvrand=8987847268972473835&amp;amp;hvtargid=kwd-298703248067&amp;amp;hydadcr=10787_13491799&amp;amp;keywords=outliers&amp;amp;qid=1699642346&amp;amp;s=books&amp;amp;sr=1-1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="err"&gt;id:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="err"&gt;title:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"The 10X Rule"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="err"&gt;author:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Grant Cardone"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="err"&gt;frontCover:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://m.media-amazon.com/images/I/51txCrB2JqL.jpg"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="err"&gt;backCover:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://bookbins.in/wp-content/uploads/2021/05/The-10x-Rule-Grant-Cardone-Buy-Online-Bookbins-2.png"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="err"&gt;datePublished:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2011"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="err"&gt;purchaseLink:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://www.amazon.com/dp/B005DGW34C?plink=Ic0UuVbawSdTNyjo&amp;amp;pf_rd_r=H132JYJ316N8X5G3YZY5&amp;amp;ref_=adblp13npsbx_1_3_im"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="err"&gt;...&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt; 
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each book item in the list has properties such as &lt;code&gt;id&lt;/code&gt;, &lt;code&gt;title&lt;/code&gt;, &lt;code&gt;author&lt;/code&gt;, &lt;code&gt;frontCover&lt;/code&gt;, &lt;code&gt;backCover&lt;/code&gt;, &lt;code&gt;datePublished&lt;/code&gt;, and &lt;code&gt;purchaseLink&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Now, let's create a new variable to hold the transformed data using the map() operation.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;bookList&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;book&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;book&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fivk4f5ylkjh6bi74116u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fivk4f5ylkjh6bi74116u.png" alt="transformed data" width="800" height="137"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The data logged to the console is the basic structure of a map transformation. With this new array returned, we can now access the book's properties.&lt;/p&gt;

&lt;h2&gt;
  
  
  Rendering Lists in components
&lt;/h2&gt;

&lt;p&gt;What we've done so far is transform the data received from the third party into the right form that can be rendered.&lt;/p&gt;

&lt;p&gt;With React, we can further transform this list of books into a collection of React components. Utilizing the map() method in conjunction with the JSX syntax, we can create a BookList component.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;//bookList component&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;BookList&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;bookList&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;book&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;book&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;book&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;img&lt;/span&gt; &lt;span class="nx"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;book&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;frontCover&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h1&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;book&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h1&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h2&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;book&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;author&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h2&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h4&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;book&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;datePublished&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h4&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;            &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;
                &lt;span class="nx"&gt;href&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;book&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;purchaseLink&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
                &lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;_blank&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
            &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
                &lt;span class="nx"&gt;Buy&lt;/span&gt; &lt;span class="nx"&gt;here&lt;/span&gt;
            &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/a&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="p"&gt;))}&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt; &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;BookList&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will now be displayed on the webpage. Additional CSS has been added to ensure proper display of book items. You can find the complete code here.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2cy9jbsrw92hgknh8m76.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2cy9jbsrw92hgknh8m76.png" alt="Rendered list" width="747" height="394"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Using Keys Within Lists
&lt;/h2&gt;

&lt;p&gt;Keys are unique identifiers that help React identify which element has been modified, added, or removed from the DOM.&lt;br&gt;
In React, using keys is crucial for dynamic list updates. These unique identifiers help React's Diffing algorithm efficiently manage changes within the component tree. &lt;/p&gt;

&lt;p&gt;React's diffing algorithm compares the current virtual DOM with the previous one, identifying added, removed, or modified elements. While generally effective, occasional inconsistencies may arise, emphasizing the importance of unique keys.&lt;/p&gt;

&lt;p&gt;There are several ways to use keys in a component, including external libraries and the Math.random() function. Another approach is to use the item's index. This works well to an extent in preventing duplicates and preserving the internal state of the list item. However, if the order of items in your list may change, you should not use this approach because it can negatively impact the performance of your app and cause glitches. The best practice is to use predefined keys in your data. &lt;/p&gt;

&lt;p&gt;Let's modify the component to use keys. Our data already has an id property, so we can use it as our key.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;//bookList component&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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;book&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;book&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="cm"&gt;/*rest of JSX code*/&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="p"&gt;))}&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt; &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;BookList&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Adding the key at the top-level element helps prevent optimization issues, especially in larger applications.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In conclusion, rendering lists in React is a fundamental skill for building dynamic and user-friendly applications. The map() method, combined with proper key usage, helps you to efficiently display and manage lists. By mastering these techniques, you can enhance the user experience of your React applications.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Getting Started with Angular: A Step-by-Step Guide</title>
      <dc:creator>Eboreime Rhoda</dc:creator>
      <pubDate>Wed, 30 Aug 2023 12:00:46 +0000</pubDate>
      <link>https://dev.to/doctdev/getting-started-with-angular-a-step-by-step-guide-3bce</link>
      <guid>https://dev.to/doctdev/getting-started-with-angular-a-step-by-step-guide-3bce</guid>
      <description>&lt;p&gt;Hello there, aspiring Angular developers! Whether you're just stepping into the world of web development or looking to expand your skill set, you've come to the right place. Welcome to the &lt;strong&gt;Angular Mastery Series: From Fundamentals to Real-World Projects&lt;/strong&gt;, where we're embarking on an exciting journey through the ins and outs of one of the most potent front-end frameworks – Angular. This is the first article in this series.&lt;/p&gt;

&lt;p&gt;Angular is more than just a framework; it's a way to create dynamic and sophisticated web applications. In this series, I'll take you from the very basics of Angular to building real-world projects that showcase your newfound skills. My goal is to help you become a confident and skilled Angular developer capable of creating modern, interactive, and efficient applications.&lt;/p&gt;

&lt;p&gt;Let's get started!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcy8x2bx4zu4h16c5dufp.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcy8x2bx4zu4h16c5dufp.gif" alt="Let's get started!" width="480" height="270"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h1&gt;
  
  
  Tutorial Outline
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Introduction&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Prerequsites&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Setting up our development environment&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Creating a new angular project&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Building the UI: Creating Components&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Data Binding: Connecting UI and Data&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Styling the Application: Adding Basic CSS&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Running the Application&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Conclusion&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  Introduction &lt;a&gt;&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;As I have explained at the beginning of this post, angular is a popular framework used for building web applications. It is primarily written in Typescript, open source and provides single page transitions for web apps.&lt;/p&gt;

&lt;h4&gt;
  
  
  Why you should consider using Angular For your next project
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Angular allows you to build scalable web apps. So if you're thinking of a framework that has the capacity to handle heavier workloads as time goes on, Angular is a goto.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Angular basically provides most of the libraries that you'll need to build your app. This reduces the use of third party libraries. These libraries have features that covers routing, client-server communication, styling, animations and so on.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Lastly for this article, angular comes with development tools you'll need as you progress on your web app development stages. From the development phase to the testing phase.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Prerequsites &lt;a&gt;&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;To successfully follow along, I recommend you have a foundational knowledge of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;HTML&lt;/li&gt;
&lt;li&gt;JavaScript&lt;/li&gt;
&lt;li&gt;TypeScript&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Recommended softwares are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An IDE (VS code, Sublime text etc).&lt;/li&gt;
&lt;li&gt;Node.js&lt;/li&gt;
&lt;li&gt;NPM&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Setting Up the Development Environment &lt;a&gt;&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;You can code your project in an online environnment like StackBlitz or CodeSandBox. For this tutorial and subsequent ones, I will be using my local environment setup. You can follow along either way you prefer.&lt;/p&gt;

&lt;h4&gt;
  
  
  Configuring your local development environment
&lt;/h4&gt;

&lt;p&gt;After installing Node.js and NPM (Node Package Manager), the next thing is to set up your Angular workspace.&lt;/p&gt;

&lt;p&gt;Install the CLI (Command Line Interface)&lt;br&gt;
&lt;code&gt;npm install -g @angular/cli&lt;/code&gt;&lt;br&gt;
This would install the Angular CLI globally.&lt;/p&gt;
&lt;h1&gt;
  
  
  Creating a new angular project &lt;a&gt;&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;For this tutorial, we're going to be building a todo app. Sounds like a good place to start! We'll tackle advanced projects as we progress in this series.&lt;/p&gt;

&lt;p&gt;Open your code editor and then open the terminal. Create a new folder for angular projects in your preferred location with the &lt;code&gt;mkdir&lt;/code&gt; command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir &lt;/span&gt;Angular-projects
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This would create a new folder. Still in your terminal, &lt;code&gt;cd&lt;/code&gt; into the new folder you created and type the command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ng new TodoApp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This would start creating our angular application.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;ng&lt;/code&gt; is the command keyword for performing Angular operations. It is used with other keywords. We would use it a lot in our project. To see the list of all available commands, in your terminal, run &lt;code&gt;ng --help&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You will be prompted with some questions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Would you like to add Angular routing?&lt;/strong&gt; No&lt;br&gt;
For our basic todo app, we would not be using angular routing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Which stylesheet format would you like to use?&lt;/strong&gt; CSS&lt;/p&gt;

&lt;p&gt;Click enter to select an option. Down arrow and up arrow keys for movement. For this project, I'll be using CSS but you can select your preferred option.&lt;/p&gt;

&lt;p&gt;After these prompts, Angular would start creating our todo app project. If this was successful, you should see a message that says "packages successfully installed".&lt;/p&gt;

&lt;p&gt;Open the folder you just created in a new window. You should see the basic folder structure of an angular project.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0lv1g3aw8l4u1jnkqrsx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0lv1g3aw8l4u1jnkqrsx.png" alt="Angular folder structure" width="239" height="313"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, we're going to start our application so that it runs in the browser.&lt;/p&gt;

&lt;p&gt;Open a new terminal and run &lt;code&gt;ng serve&lt;/code&gt; or &lt;code&gt;npm start&lt;/code&gt;. Either of them would run your appication. Go to &lt;a href="http://localhost:4200/"&gt;http://localhost:4200/&lt;/a&gt; to see it.&lt;/p&gt;

&lt;p&gt;We have successfully created our Angular project!&lt;/p&gt;
&lt;h1&gt;
  
  
  Building the UI: Creating Components &lt;a&gt;&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;Its time to create the components for our app. Components are like building blocks for an application. Instead of having a central component, the app implementation is split into units. This is one advantage of using Angular. If you've used React, then you should be familiar with the concept of components.&lt;/p&gt;

&lt;p&gt;Our Todo application will have three components, and the default app component making it four. The first component would be the header. The second is the todo list component where the app logic would be and the last is a footer component. Below is a wireframe showing the way the components are divided.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6jka7niaa9mg76xuhkf8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6jka7niaa9mg76xuhkf8.png" alt="Todo App Components" width="381" height="511"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;cd&lt;/code&gt; into your src directory and then, into your app directory. Create a components folder &lt;code&gt;mkdir components&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Next, &lt;code&gt;cd&lt;/code&gt; into the components folder you just created.&lt;/p&gt;

&lt;p&gt;To create the first component run the command&lt;/p&gt;

&lt;p&gt;&lt;code&gt;ng generate component header&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This would generate the Header component.&lt;/p&gt;

&lt;p&gt;Similarly, run&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ng generate component todolist

ng generate component footer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;ng generate component&lt;/code&gt; can be shortened to &lt;code&gt;ng g c&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If you check your components folder, you should see the new components.&lt;/p&gt;

&lt;p&gt;You may have noticed that each of the components have four files.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;file.component.css&lt;/code&gt; - This is where your CSS code will be.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;file.component.html&lt;/code&gt; -  This is where the content that would be displayed on the webpage would be.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;file.component.spec.ts&lt;/code&gt; - This is the test file for this component. You don't need to edit it.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;file.component.ts&lt;/code&gt; - This is the typescript file where the logic of the component would be.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Your CSS file should be blank. Your HTML file should show a &lt;code&gt;p&lt;/code&gt; tag and your &lt;code&gt;.ts&lt;/code&gt; file should show be like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Component&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@angular/core&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;Component&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;selector&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;app-header&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;templateUrl&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./header.component.html&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;styleUrls&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./header.component.css&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;HeaderComponent&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first line just  imports the Component decorator from the &lt;code&gt;@angular/core&lt;/code&gt; module. It is used to define Angular components. You'll see it in every component.&lt;/p&gt;

&lt;p&gt;Next, we see the component definition. Three important terms are inside the component declaration.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;selector&lt;/code&gt; - This is the HTML selector for the component.&lt;br&gt;
&lt;code&gt;templateUrl&lt;/code&gt; - This holds the path to the HTML file for the component.&lt;br&gt;
&lt;code&gt;styleUrls&lt;/code&gt; - This holds the paths to the CSS files that would be used in the component.&lt;/p&gt;

&lt;p&gt;Below this is the class declaration for this component. Each component has a class declaration that defines properties and methods for the application logic.&lt;/p&gt;

&lt;p&gt;We're going to start by clearing out the default files.&lt;/p&gt;

&lt;p&gt;Go to your &lt;code&gt;app.component.html&lt;/code&gt; file. Highlight everything and clear it out. Then add the following HTML selectors for the components we created.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!--Header component--&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;app-header&amp;gt;&amp;lt;/app-header&amp;gt;&lt;/span&gt;

&lt;span class="c"&gt;&amp;lt;!--Todolist component--&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;app-todolist&amp;gt;&amp;lt;/app-todolist&amp;gt;&lt;/span&gt;

&lt;span class="c"&gt;&amp;lt;!--Footer component--&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;app-footer&amp;gt;&amp;lt;/app-footer&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Quickly, we'll add a simple header and footer so that we can focus on building the todo app.&lt;/p&gt;

&lt;p&gt;In your &lt;code&gt;header.component.html&lt;/code&gt; add the following (you can also customize it):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;h1&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"header"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;My TodoApp&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In your footer add a "Built by [name]" (you can also customize it).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Built by Rhoda&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, it's time to start the main app.&lt;/p&gt;

&lt;h1&gt;
  
  
  Data Binding: Connecting UI and Data &lt;a&gt;&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;Data binding has to do with connecting your data with your User Interface (UI). It's like the thread that weaves together the fabric of your web application, making it both interactive and dynamic. Angular has two major categories of data binding.&lt;/p&gt;

&lt;p&gt;There is the one-way data binding where just as the name implies, the data flows in one direction. That is, the data can be connected to the UI and the UI would be updated with the components data. However, the UI cannot update the component's data. You should use this if you only need to display data from the component in the UI but do not need to capture user input or changes in the UI back into the component.&lt;/p&gt;

&lt;p&gt;The other is the two-way data binding which is an opposite and extension of the one-way data binding. It allows data to flow in both directions. That is, from the data component to the UI and from the UI to the data component.&lt;/p&gt;

&lt;p&gt;There are many examples of these data bindings and we would encounter them as we begin our app.&lt;/p&gt;

&lt;p&gt;Here's the HTML skeleton of the todo list&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!--todo component--&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"todo-container"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"todo-input"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;placeholder=&lt;/span&gt;&lt;span class="s"&gt;"Add a new task"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;button&amp;gt;&lt;/span&gt;Add&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;ul&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"task-list"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&lt;/span&gt;todo&lt;span class="nt"&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;button&amp;gt;&lt;/span&gt;Delete&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For our data component, first, we'll need an array where we can push the new todo items into. We'll also need a variable to store the new items to be added to the todo list. Then, we'll need an add and delete function that will handle the addition of items to our list and deletion of items.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;//todo array&lt;/span&gt;
 &lt;span class="nx"&gt;todos&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[];&lt;/span&gt;
&lt;span class="c1"&gt;//new todo item&lt;/span&gt;
  &lt;span class="nl"&gt;newTodo&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;//function to add items to to do array&lt;/span&gt;
&lt;span class="nf"&gt;addTodo&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;newTodo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;trim&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;todos&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;newTodo&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;newTodo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

 &lt;span class="c1"&gt;//function to delete items from to do array&lt;/span&gt;
  &lt;span class="nf"&gt;deleteTodo&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;todo&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;index&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;todos&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;indexOf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;todo&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;index&lt;/span&gt; &lt;span class="o"&gt;!==&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;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;todos&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;splice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;index&lt;/span&gt;&lt;span class="p"&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="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once we've set up our data component, its time to connect the variable, array and methods to our UI.&lt;/p&gt;

&lt;h4&gt;
  
  
  Updating the UI with angular two-way binding
&lt;/h4&gt;

&lt;p&gt;A common two-way binding used is the &lt;code&gt;ngModel&lt;/code&gt;. It is used in a form element to get data from an input and then send the data to the property that would store the input.&lt;/p&gt;

&lt;p&gt;Thus, in our app:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;[(ngModel)]=&lt;/span&gt;&lt;span class="s"&gt;"newTodo"&lt;/span&gt; &lt;span class="na"&gt;placeholder=&lt;/span&gt;&lt;span class="s"&gt;"Add a new task"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here's a breakdown of what is happening:&lt;br&gt;
The square brackets &lt;code&gt;[ ]&lt;/code&gt; denote property binding (binding from component to the template), and the parentheses &lt;code&gt;( )&lt;/code&gt; denote event binding (binding from the template to the component).&lt;/p&gt;

&lt;p&gt;This combination allows the input field and the component property (&lt;code&gt;newTodo&lt;/code&gt;) which the input is bound to, to stay synchronized in both directions.&lt;/p&gt;

&lt;p&gt;When you type a task in the input field, the &lt;code&gt;newTodo&lt;/code&gt; property of the component is updated with the input's value, and if there is any change in the &lt;code&gt;newTodo&lt;/code&gt; property, the input would also be updated.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Important note:&lt;/strong&gt; the &lt;code&gt;ngModel&lt;/code&gt; binding is exported from the &lt;code&gt;FormsModule&lt;/code&gt; library. We will need to import it in our &lt;code&gt;app.module.ts&lt;/code&gt; file and add it in the imports array:&lt;br&gt;
&lt;/p&gt;


&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;//other imports&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;FormsModule&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@angular/forms&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;NgModule&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
&lt;span class="na"&gt;imports&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;FormsModule&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Updating the UI with event binding
&lt;/h4&gt;

&lt;p&gt;Similar to javaScript event handlers, event binding listen for and responds to a user actions such as keystrokes, mouse movements, clicks, and touches.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;(click)&lt;/code&gt; is a popular event binding that listens for a click event on the element it is binded to. We have created two methods for our todo app. We want an item to be added when the &lt;code&gt;add&lt;/code&gt; button is clicked. We also want an item to be deleted when the &lt;code&gt;delete&lt;/code&gt; button is clicked. To achieve this, we would bind the methods to their respective HTML buttons so that they would listen for a user's click and be triggered.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;(click)=&lt;/span&gt;&lt;span class="s"&gt;"addTodo()"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Add&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;(click)=&lt;/span&gt;&lt;span class="s"&gt;"deleteTodo(todo)"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Delete&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Observe that the delete button has the &lt;code&gt;todo&lt;/code&gt; argument passed to it. It takes in the specific todo item to be deleted.&lt;/p&gt;

&lt;h4&gt;
  
  
  Updating the UI with angular directives
&lt;/h4&gt;

&lt;p&gt;Directives in Angular are like special instructions you give to your HTML elements. They tell Angular what to do with those elements or how they should behave. They are one of the ways to update a UI and make a web application more interactive and dynamic. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;a href="https://angular.io/guide/built-in-directives"&gt;Learn more about directives&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In our todo app, we will need to use an angular directive to pass our array of todo items to the UI. Angular has different types of directives, one of which is the &lt;a href="https://angular.io/guide/built-in-directives"&gt;built in angular directive&lt;/a&gt;. We would come across all of them as we progress in this article series. &lt;/p&gt;

&lt;p&gt;Built-in directives controls the HTMl elements and manupulates the UI. A popular one is &lt;code&gt;*ngFor&lt;/code&gt; which works like a normal loop statement. That is, it loops through a list of items and returns each item in the list.&lt;/p&gt;

&lt;p&gt;We have a list that holds the todo items a user adds and we want to loop through it and then display each item. To do this, we would use the &lt;code&gt;*ngFor&lt;/code&gt; directive.&lt;/p&gt;

&lt;p&gt;Update the HTMl to use this directive:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;li&lt;/span&gt; &lt;span class="na"&gt;*ngFor=&lt;/span&gt;&lt;span class="s"&gt;"let todo of todos"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="c"&gt;&amp;lt;!--code--&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here's a breakdown of what is happening:&lt;br&gt;
&lt;code&gt;let todo of todos&lt;/code&gt; - This sets up the loop. It says: "For each item in the &lt;code&gt;todos&lt;/code&gt; array, temporarily assign each item to the variable &lt;code&gt;todo&lt;/code&gt;." In other words, it iterates through the &lt;code&gt;todos&lt;/code&gt; array and assigns each element to the variable &lt;code&gt;todo&lt;/code&gt; for each iteration.&lt;/p&gt;
&lt;h4&gt;
  
  
  Updating the UI with interpolation
&lt;/h4&gt;

&lt;p&gt;Interpolation is a way to update a UI with string data.&lt;/p&gt;

&lt;p&gt;The todo items would be string values therefore, we would use it to pass the looped todo items to the web page for the users to see.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;   &lt;span class="nt"&gt;&amp;lt;li&lt;/span&gt; &lt;span class="na"&gt;*ngFor=&lt;/span&gt;&lt;span class="s"&gt;"let todo of todos"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="c"&gt;&amp;lt;!--code--&amp;gt;&lt;/span&gt;
      {{ todo }}
&lt;span class="nt"&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, a user can see the todo items they have on the web page.&lt;/p&gt;

&lt;p&gt;Having explained these bindings, here is the full html template code with the bindings I explained:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!--todo list component--&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"todo-container"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"todo-input"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;[(ngModel)]=&lt;/span&gt;&lt;span class="s"&gt;"newTodo"&lt;/span&gt; &lt;span class="na"&gt;placeholder=&lt;/span&gt;&lt;span class="s"&gt;"Add a new task"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;(click)=&lt;/span&gt;&lt;span class="s"&gt;"addTodo()"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Add&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;ul&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"task-list"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;li&lt;/span&gt; &lt;span class="na"&gt;*ngFor=&lt;/span&gt;&lt;span class="s"&gt;"let todo of todos"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="c"&gt;&amp;lt;!--code--&amp;gt;&lt;/span&gt;
      {{ todo }}
      &lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;(click)=&lt;/span&gt;&lt;span class="s"&gt;"deleteTodo(todo)"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Delete&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Remember, I have provided the full component's code already.&lt;/p&gt;

&lt;h1&gt;
  
  
  Styling the Application: Adding Basic CSS &lt;a&gt;&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;I have provided a basic css styling below for the app:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.todo-container&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nc"&gt;.todo-container&lt;/span&gt; &lt;span class="nt"&gt;input&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nc"&gt;.todo-container&lt;/span&gt; &lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;border&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;border-radius&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Running the Application &lt;a&gt;&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;Start your server with &lt;code&gt;npm start&lt;/code&gt; or &lt;code&gt;ng serve&lt;/code&gt;.&lt;/p&gt;




&lt;h1&gt;
  
  
  Conclusion &lt;a&gt;&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;In conclusion, the todo app we've developed represents a fundamental example of a dynamic and interactive web application built using Angular. Throughout the process of creating this app, we've covered several key concepts and techniques that are foundational to web development with Angular. I have linked some resources below for a flexible learning experience.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://angular.io/docs"&gt;Angular docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/watch?v=3qBXWUpoPHo"&gt;Freecodecamp's full angular course&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In upcoming articles in this series, &lt;strong&gt;Angular Mastery Series: From Fundamentals to Real-World Projects&lt;/strong&gt;, we would delve deeper into:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Mastering Angular Components and Directives&lt;/li&gt;
&lt;li&gt;Exploring Angular Routing and Navigation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And more!&lt;/p&gt;

</description>
      <category>angular</category>
      <category>beginners</category>
      <category>webdev</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Designer vs. Developer: what do they do?</title>
      <dc:creator>Eboreime Rhoda</dc:creator>
      <pubDate>Thu, 25 Mar 2021 22:39:57 +0000</pubDate>
      <link>https://dev.to/doctdev/designer-vs-developer-what-do-they-do-5dj2</link>
      <guid>https://dev.to/doctdev/designer-vs-developer-what-do-they-do-5dj2</guid>
      <description>&lt;p&gt;Most people know this already, but for most beginners, these terms are often confusing. For someone new to web development, there is a need to understand what the roles of a developer and designer are so that it will be easy to decide whether to learn how to be a developer, or how to be a designer. In this article, I'm going to explain as much as I can who a developer and a designer is, their differences and where they overlap.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Who is a designer and who is a developer?&lt;/b&gt;&lt;br&gt;
A &lt;a href="https://www.interaction-design.org/literature/topics/web-design" rel="noopener noreferrer"&gt;designer&lt;/a&gt; or &lt;b&gt;web designer&lt;/b&gt;, is an IT professional that works on the appearance, layout, and in some cases content of a website. On the other hand, a &lt;a href="https://www.computerhope.com/jargon/d/develope.htm" rel="noopener noreferrer"&gt;developer&lt;/a&gt; or &lt;b&gt;web developer&lt;/b&gt;, is an individual who is responsible for bringing the designer's work to life by using various programming languages to develop the product. Let's dive a little deeper into their differences. But first, I'll explain the phases of building a project so that you can clearly see the differences between these two sets of people.&lt;br&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Planning phase
&lt;/h2&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%2Fz4p2jntg3feknvrwi46v.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%2Fz4p2jntg3feknvrwi46v.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
The first phase of building any project is the planning phase. It is the first and most important. This is when you decide and map the entire project. Also, at this stage, you interact with your clients to decide what their goal is and what they want. You should also ask yourself some important questions like, how should the product look?; how should the product feel?; or what should it do?.&lt;/p&gt;

&lt;h2&gt;
  
  
  Design phase
&lt;/h2&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%2Fmgydrsnf2xwu9nfvm2bp.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%2Fmgydrsnf2xwu9nfvm2bp.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
From the planning phase, we go into the design phase. At this point, you've gathered information about what your client wants and the expectation of the user. You should already have a visual representation of how the product will look and what the users will see. You then take the information from the planning phase and make it a reality by creating or designing the site structure, mobile structure, appearance and layout of the product.&lt;/p&gt;

&lt;h2&gt;
  
  
  Development phase
&lt;/h2&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%2Fvc6nfy8sh26kiodbrukw.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%2Fvc6nfy8sh26kiodbrukw.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
The development phase is where the designer's work is implemented with various programming languages. In this phase, you use all the assets and information that have been gathered from the design phase and try to implement it into a live website or mobile app.&lt;/p&gt;

&lt;h2&gt;
  
  
  Launch phase
&lt;/h2&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%2F617hbci8hmticsxr5slf.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%2F617hbci8hmticsxr5slf.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
Once the product has been developed, we can now talk about launching it. That is putting it on a server or &lt;a href="https://www.namecheap.com/hosting/what-is-web-hosting-definition/" rel="noopener noreferrer"&gt;hosting&lt;/a&gt; it. In this phase, you deliver your product to the users. After the product has been launched, there may be some design tweaks and testing of the product to make sure it works properly. Once you've launched your product, it doesn't end there, there is another phase which is the post-launch phase.&lt;/p&gt;

&lt;h2&gt;
  
  
  Post-launch phase
&lt;/h2&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%2F9rkrbd99x4htgp9w250y.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%2F9rkrbd99x4htgp9w250y.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
In this phase, you will have to monitor how the users use the product to see if there are any issues or bug fixes that need to be addressed. More testing is done based on how the users interact with the product, like, how they navigate through the site, why they are not clicking on a button, and so on.&lt;br&gt;
&lt;/p&gt;

&lt;br&gt;
The phases of building a project outlined above will eventually turn into a loop because from the ideas and insights you will get after the launch, you can start improving or updating your product. Improving your product means planning again, designing again and developing again. As time goes on, you may get better ideas and improve the product over and over again. This whole process continues.

&lt;blockquote&gt;
&lt;p&gt;You can never really finish developing a product because a product can always be improved.&lt;/p&gt;


&lt;/blockquote&gt;

&lt;p&gt;Now, coming back to the topic of the discussion, a designer is involved in the planning phase, design phase and post-launch phase. They are heavily involved in the planning phase and design phase. They are the ones that will interact with the clients and design what their clients want. They have the responsibility of designing the product to meet the user's expectation. They are also involved in the post-launch phase because they learn from the user and improve their design.&lt;br&gt;&lt;br&gt;
The developer is mainly concerned with the development, launch and post-launch phases. They receive the designs and use tools and technologies like HTML, CSS and JavaScript to implement the designs into an actual working website or mobile app. They are involved in the launch phase in the sense that, they put the code they have written on a server so that their clients can have access to it. While testing is going on, they may likely encounter bugs in their program or see a need to improve or add a feature.&lt;br&gt;
&lt;/p&gt;

&lt;br&gt;
In conclusion, a designer is involved more at the beginning and later stages of product development. Whereas, the attention of a developer is needed at the intermediate and later stages of product development. There is no restriction on either field, a designer can also be a developer and a developer can also be a designer.&lt;br&gt;
Below are some resources for further studying. Thanks for reading!. Feel free to connect with me on &lt;a href="https://twitter.com/DOctDevv" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;.

&lt;p&gt;Illustrations credit - &lt;a href="https://undraw.co/" rel="noopener noreferrer"&gt;undraw.co&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Resources
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://blog.eccouncil.org/5-phases-of-the-secure-software-development-life-cycle-sdlc/" rel="noopener noreferrer"&gt;Software development life cycle&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.interaction-design.org/literature/topics/web-design" rel="noopener noreferrer"&gt;Web design&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://careerfoundry.com/en/blog/web-development/what-does-it-take-to-become-a-web-developer-everything-you-need-to-know-before-getting-started/" rel="noopener noreferrer"&gt;Web development&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>html</category>
      <category>firstpost</category>
      <category>javascript</category>
      <category>css</category>
    </item>
  </channel>
</rss>
