<?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: Tejendra Singh Rajawat</title>
    <description>The latest articles on DEV Community by Tejendra Singh Rajawat (@tejendrasrajawat).</description>
    <link>https://dev.to/tejendrasrajawat</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%2F410336%2F254818e2-f09c-4419-800a-f174da94f420.JPEG</url>
      <title>DEV Community: Tejendra Singh Rajawat</title>
      <link>https://dev.to/tejendrasrajawat</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/tejendrasrajawat"/>
    <language>en</language>
    <item>
      <title>Comprehensive Guide to SDE Preparation: Mastering the Key Concepts</title>
      <dc:creator>Tejendra Singh Rajawat</dc:creator>
      <pubDate>Thu, 25 Jan 2024 08:23:08 +0000</pubDate>
      <link>https://dev.to/tejendrasrajawat/comprehensive-guide-to-sde-preparation-mastering-the-key-concepts-4d6m</link>
      <guid>https://dev.to/tejendrasrajawat/comprehensive-guide-to-sde-preparation-mastering-the-key-concepts-4d6m</guid>
      <description>&lt;ol&gt;
&lt;li&gt;DSA for SDE interview&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://github.com/Ishan-sinha/DSA-for-SDE-interview"&gt;https://github.com/Ishan-sinha/DSA-for-SDE-interview&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Imp system design concepts&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://levelup.gitconnected.com/16-system-design-concepts-i-wish-i-knew-before-the-interview-b8586e40a73b"&gt;https://levelup.gitconnected.com/16-system-design-concepts-i-wish-i-knew-before-the-interview-b8586e40a73b&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Top DBMS interview questions&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://www.interviewbit.com/dbms-interview-questions/"&gt;https://www.interviewbit.com/dbms-interview-questions/&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Object Oriented principles&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://medium.com/@cancerian0684/what-are-four-basic-principles-of-object-oriented-programming-645af8b43727"&gt;https://medium.com/@cancerian0684/what-are-four-basic-principles-of-object-oriented-programming-645af8b43727&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Dynamic Programming&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=oFkDldu3C_4"&gt;https://www.youtube.com/watch?v=oFkDldu3C_4&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Java Concurrency and Practice - Book&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://jcip.net/"&gt;https://jcip.net/&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Hashing&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://www.fullstack.cafe/blog/hashing-interview-questions#:%7E:text=Hashing%20is%20the%20practice%20of,indexes%20by%20using%20hash%20functions"&gt;https://www.fullstack.cafe/blog/hashing-interview-questions#:~:text=Hashing%20is%20the%20practice%20of,indexes%20by%20using%20hash%20functions&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Graph theory&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://brilliant.org/wiki/graph-theory/"&gt;https://brilliant.org/wiki/graph-theory/&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Redux core concepts&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://redux.js.org/introduction/core-concepts"&gt;https://redux.js.org/introduction/core-concepts&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;React hooks&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://javascript.plainenglish.io/3-hooks-every-react-developer-should-know-a8e1bd218acc"&gt;https://javascript.plainenglish.io/3-hooks-every-react-developer-should-know-a8e1bd218acc&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Security&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/Security"&gt;https://developer.mozilla.org/en-US/docs/Web/Security&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Understanding Material-UI Table and Skeleton Loading in React 🚀</title>
      <dc:creator>Tejendra Singh Rajawat</dc:creator>
      <pubDate>Tue, 19 Dec 2023 09:44:57 +0000</pubDate>
      <link>https://dev.to/tejendrasrajawat/understanding-material-ui-table-and-skeleton-loading-in-react-18ec</link>
      <guid>https://dev.to/tejendrasrajawat/understanding-material-ui-table-and-skeleton-loading-in-react-18ec</guid>
      <description>&lt;p&gt;In React development, creating responsive and dynamic tables is a common requirement. Material-UI (MUI) provides a robust and customizable table component that simplifies this task. Let's dive into the key features of Material-UI tables, understand the usage of the Skeleton component for loading states, create a reusable table component, and showcase a dynamic table for various use cases.&lt;/p&gt;

&lt;p&gt;Ref: &lt;a href="https://codesandbox.io/s/material-ui-table-yxh6fq"&gt;CODESANDBOX&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Understanding Material-UI Table 📊
&lt;/h2&gt;

&lt;p&gt;Material-UI's Table component offers a comprehensive solution for rendering tables in React applications. Let's break down the provided Table component in the example code:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Columns and Data: The table is configured with columns and data, allowing developers to customize the display of information.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;table&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;thead&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;tr&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;tableColumns&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;item&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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;renderHeader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;item&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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/tr&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;/thead&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;!&lt;/span&gt;&lt;span class="nx"&gt;isLoading&lt;/span&gt; &lt;span class="p"&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;tbody&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;tableBodyClassname&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="nx"&gt;tableData&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
                &lt;span class="nx"&gt;tableData&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;item&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="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;tr&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;index&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="nx"&gt;tableColumns&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;values&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;i&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;td&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="s2"&gt;`&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="s2"&gt; &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&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="k"&gt;typeof&lt;/span&gt; &lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;values&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;key&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="s2"&gt;string&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;
                        &lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;values&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt;
                          &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;values&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;slice&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="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;&lt;span class="s2"&gt;...`&lt;/span&gt;
                          &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;values&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;key&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;/td&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;/tr&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="p"&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;tr&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;td&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;no-records&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;colSpan&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;tableColumns&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
                    &lt;span class="nx"&gt;No&lt;/span&gt; &lt;span class="nx"&gt;Records&lt;/span&gt; &lt;span class="nx"&gt;Found&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;/td&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;/tr&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;/tbody&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="p"&gt;(&lt;/span&gt;
            &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;tbody&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
              &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;length&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;rowCount&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;_&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="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;tr&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;index&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="nx"&gt;tableColumns&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;_&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;i&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;td&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="s2"&gt;`&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="s2"&gt; &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Skeleton&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="sr"&gt;/td&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;/tr&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;/tbody&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;/table&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Sorting: Users can click on column headers to sort the data. The sorting status is managed through the sortingStatus state.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt; &lt;span class="nx"&gt;onClick&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="nf"&gt;setSortingStatus&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
          &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt; &lt;span class="nx"&gt;sortingStatus&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
            &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nf"&gt;parseInt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;sortingStatus&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;])&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="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;`sorting-column &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;
        &lt;span class="nx"&gt;sortingStatus&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;down&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
          &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;sortingStatus&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;]&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;up&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
          &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;""&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Pagination: For handling large datasets, pagination controls are integrated, enhancing the user experience.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Responsive Design: The table adjusts its height dynamically based on the window size, ensuring a responsive layout.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;  &lt;span class="nf"&gt;useEffect&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;handleResize&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="nf"&gt;setHeight&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;innerHeight&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;225&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;

    &lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;resize&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;handleResize&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;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;removeEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;resize&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;handleResize&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="p"&gt;[]);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. Unveiling the Skeleton Loading Effect 💀
&lt;/h2&gt;

&lt;p&gt;Loading states are crucial for a seamless user experience, especially when dealing with asynchronous data fetching. Material-UI's Skeleton component provides a visually appealing loading effect. In the Table component, the loading state is indicated by rendering skeletons instead of actual data. This is achieved through conditional rendering based on the isLoading prop.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Crafting a Reusable Table Component 🔄
&lt;/h2&gt;

&lt;p&gt;Efficient code organization involves creating reusable components. The Table component showcased in the example is designed to be flexible and reusable. Developers can easily integrate it into their projects by passing appropriate props for columns, data, pagination, and other configurations.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Dynamic Table for All Use Cases 🌐
&lt;/h2&gt;

&lt;p&gt;The example includes a DemoComponent that demonstrates the dynamic nature of the table. It simulates data fetching with a fake timer, updating the table with new data upon pagination changes. This mechanism allows developers to handle various use cases efficiently.&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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Table&lt;/span&gt;
      &lt;span class="nx"&gt;tableColumns&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;columns&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="nx"&gt;tableData&lt;/span&gt;&lt;span class="o"&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="nx"&gt;paginationCount&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;paginationCount&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="nx"&gt;handlePaginationValue&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;handlePaginationValue&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="nx"&gt;sortingStatus&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;sortingStatus&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="nx"&gt;setSortingStatus&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;setSortingStatus&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="nx"&gt;isLoading&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;loading&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="nx"&gt;rowCount&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;15&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="nx"&gt;tableBodyClassname&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;""&lt;/span&gt;
      &lt;span class="nx"&gt;currentPage&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;currentPage&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;p&gt;In conclusion, Material-UI's Table component, coupled with the Skeleton loading effect, empowers React developers to create responsive and dynamic tables. By crafting a reusable table component, developers can enhance code maintainability and promote scalability. The provided code snippets and dynamic use case exemplify the versatility of this approach, making it a valuable addition to your React development toolkit.&lt;/p&gt;

&lt;p&gt;Happy coding! 🚀&lt;/p&gt;

</description>
      <category>react</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>materialui</category>
    </item>
    <item>
      <title>🚀 Best Practices you should know before starting new React.js project 🚀</title>
      <dc:creator>Tejendra Singh Rajawat</dc:creator>
      <pubDate>Wed, 04 Oct 2023 10:42:11 +0000</pubDate>
      <link>https://dev.to/tejendrasrajawat/best-practices-you-should-know-before-starting-new-reactjs-project-107g</link>
      <guid>https://dev.to/tejendrasrajawat/best-practices-you-should-know-before-starting-new-reactjs-project-107g</guid>
      <description>&lt;p&gt;React.js is a popular JavaScript library for building user interfaces, known for its flexibility and reusability. To help you write clean, maintainable, and efficient React code, we've compiled 30 best practices for React.js development. Let's dive in! 🏊‍♂️&lt;/p&gt;

&lt;h2&gt;
  
  
  Fundamentals of React.js
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Component Reusability: Break down your UI into small, reusable components to make your codebase more maintainable. ♻️&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use Functional Components: Embrace functional components with React Hooks whenever possible, as they provide a concise and readable syntax. ⚙️&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;State Management: Choose an appropriate state management solution like Redux or the Context API for complex state handling. 🧠&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Immutable Data: Avoid directly mutating state or props; create copies or use immutability helpers like spread or libraries like Immutable.js. 🚫🔄&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Props Validation: Use PropTypes or TypeScript to validate the props passed to your components, catching errors early. 📜🔍&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Performance Optimization
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Avoid Over-Rendering: Optimize rendering by using shouldComponentUpdate or React.memo to prevent unnecessary re-renders. 🏎️&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Component Lifecycle Methods: Understand when to use lifecycle methods like componentDidMount and componentWillUnmount and how they map to useEffect in functional components. 🔄🌟&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Keys in Lists: Always provide a unique key prop when rendering lists to help React identify items efficiently. 🔑✨&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Code Splitting: Use code splitting techniques to load only the necessary JavaScript for the current route or component, improving performance. 🧩🚀&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Memoization: Memoize expensive calculations or functions using tools like useMemo to prevent unnecessary recalculations. 📝🤖&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Code Quality and Structure
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Organize Project Structure: Maintain a well-structured project directory with clear separation of components, styles, and logic. 📂🏢&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;ESLint and Prettier: Use ESLint and Prettier to enforce code style consistency and catch potential issues early in development. 📝🧹&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Stateless Functional Components: Prefer using stateless functional components for presentational components that don't need internal state. 🚀🎨&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;React Fragments: Use React Fragments (&amp;lt;&amp;gt;&amp;lt;/&amp;gt;) to group multiple elements without adding extra nodes to the DOM. 🏗️🔧&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Destructuring: Destructure props and state to improve code readability and reduce repetition. 🧩🔀&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Best Practices for Production
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Avoid Direct DOM Manipulation: Minimize direct manipulation of the DOM; let React handle updates through its virtual DOM. 🕹️🖥️&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Server-Side Rendering (SSR): Consider server-side rendering for SEO and performance benefits, especially for larger applications. 🌐🔥&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Testing: Write unit tests and integration tests using tools like Jest and React Testing Library to ensure code reliability. 🧪👷‍♀️&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Component Naming: Use meaningful and consistent naming conventions for components, making it easier for developers to understand their purpose. 📛🔍&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Accessibility (a11y): Prioritize accessibility by using semantic HTML elements, providing alt text for images, and testing your app with screen readers. 🌐♿&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Advanced React Development&lt;br&gt;
Code Splitting with React.lazy: Use React.lazy and Suspense to dynamically load and render components only when they are needed, improving initial page load times. 🧩🏁&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use PropTypes or TypeScript: Leverage TypeScript's type system for prop validation or continue using PropTypes to ensure type safety. 📜🔍🏗️&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Performance Profiling: Utilize React's built-in profiling tools and third-party tools like React DevTools to identify and optimize performance bottlenecks in your app. 📈🔍&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;CSS Modules or Styled Components: Consider using CSS Modules or Styled Components to scope styles to individual components, preventing global CSS conflicts. 🎨🧹&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Avoid Using Index as Key: When mapping over arrays to render lists, avoid using the index as the key. Use a unique identifier whenever possible for stable and efficient rendering. 🚫🔑&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Essential Practices
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Avoid Uncontrolled Components: Prefer controlled components with explicit state management over uncontrolled components when working with forms and input elements. 📝🧮&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Optimize Bundle Size: Keep an eye on your app's bundle size and use tools like Webpack Bundle Analyzer to identify and reduce unnecessary dependencies. 📦📉&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Client-Side Routing: Choose a client-side routing library like React Router for handling navigation in single-page applications (SPAs). 🚗🛣️&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Error Boundaries: Place error boundaries strategically in your component hierarchy to catch and handle errors gracefully at appropriate levels. ⚠️🤲&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;These 30 best practices are invaluable for any React.js developer. By following them, you'll build more efficient, maintainable, and accessible applications. Happy coding! 🚀👩‍💻&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Building a Chrome Extension for Space Exploration</title>
      <dc:creator>Tejendra Singh Rajawat</dc:creator>
      <pubDate>Thu, 24 Aug 2023 06:31:47 +0000</pubDate>
      <link>https://dev.to/tejendrasrajawat/building-a-chrome-extension-for-space-exploration-hmd</link>
      <guid>https://dev.to/tejendrasrajawat/building-a-chrome-extension-for-space-exploration-hmd</guid>
      <description>&lt;p&gt;In this tutorial, we will walk through the process of creating a Chrome extension that fetches data from the NASA API. The extension will display the NASA Image of the Day and provide information about Mars rover photos. We'll structure our project as follows:&lt;/p&gt;

&lt;h2&gt;
  
  
  Project Structure
&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%2Fdxgd21meben01pkqmqcm.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%2Fdxgd21meben01pkqmqcm.png" alt="Project Structure"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The most crucial file in this structure is &lt;em&gt;&lt;strong&gt;manifest.json&lt;/strong&gt;&lt;/em&gt;, which holds essential details about our extension:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "name": "space exploration",
  "version": "0.0.1",
  "description": "this is nasa api to get data of space",
  "permissions": ["activeTab", "tabs", "browsingData", "storage"],
  "background": {
    "service_worker": "background.js"
  },
  "author": "IM",
  "action": {
    "default_popup": "index.html",
    "default_title": "clear storage"
  },
  "content_scripts": [
    {
      "matches": ["&amp;lt;all_urls&amp;gt;"],
      "js": ["contentScript.js"]
    }
  ],
  "manifest_version": 3
}

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

&lt;/div&gt;



&lt;p&gt;In this &lt;em&gt;&lt;strong&gt;manifest.json&lt;/strong&gt;&lt;/em&gt;, we define permissions like activeTab and storage to access necessary browser functionalities. The &lt;em&gt;&lt;strong&gt;background.js&lt;/strong&gt;&lt;/em&gt; script runs continuously in the background to trigger the extension when needed. The default_popup points to the initial screen of the extension, and the content_scripts array specifies scripts to manipulate active tab's DOM.&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating the Popup Interface
&lt;/h2&gt;

&lt;p&gt;The popup interface is defined in &lt;em&gt;&lt;strong&gt;index.html&lt;/strong&gt;&lt;/em&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;meta charset="UTF-8" /&amp;gt;
    &amp;lt;link
      href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css"
      rel="stylesheet"
    /&amp;gt;
    &amp;lt;link href="./style.css" rel="stylesheet" /&amp;gt;
    &amp;lt;title&amp;gt;Space Exploration&amp;lt;/title&amp;gt;
    &amp;lt;style&amp;gt;
      body {
        font-family: Arial, sans-serif;
        margin: 0;
        padding: 0;
        display: flex;
        justify-content: center;
        align-items: center;
        background-color: #f4f4f4;
      }
      .container {
        background-color: white;
        border-radius: 10px;
        box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
        padding: 20px;
        max-width: 600px;
        width: 100%;
      }
      .flex {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin: 10px 0;
        padding: 10px;
        border: 1px solid black;
      }
      .flex &amp;gt; p {
        margin: 0;
        padding: 0;
      }
      button {
        border: 1px solid white;
        border-radius: 10px;
        padding: 0 10px;
        height: 40px;
        transition: all 0.2s ease-in;
      }

      button:hover {
        background-color: rgb(18, 117, 18);
        color: white;
      }
      h1 {
        margin-top: 0;
      }
    &amp;lt;/style&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;div class="container"&amp;gt;
      &amp;lt;h1 id="title"&amp;gt;&amp;lt;/h1&amp;gt;
      &amp;lt;p id="date"&amp;gt;&amp;lt;/p&amp;gt;
      &amp;lt;img id="image" src="" alt="APOD Image" /&amp;gt;
      &amp;lt;div class="flex"&amp;gt;
        &amp;lt;p&amp;gt;Show mars rover photos&amp;lt;/p&amp;gt;
        &amp;lt;button id="marsRover"&amp;gt;Go&amp;lt;/button&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;script src="./index.js"&amp;gt;&amp;lt;/script&amp;gt;
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;

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

&lt;/div&gt;



&lt;p&gt;The &lt;em&gt;&lt;strong&gt;index.js&lt;/strong&gt;&lt;/em&gt; script fetches and displays the NASA Image of the Day:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;document.addEventListener("DOMContentLoaded", () =&amp;gt; {

  const apiUrl = `https://api.nasa.gov/planetary/apod?api_key=${apiKey}`;

  fetch(apiUrl)
    .then((response) =&amp;gt; response.json())
    .then((data) =&amp;gt; {
      const titleElement = document.getElementById("title");
      const dateElement = document.getElementById("date");

      const imageElement = document.getElementById("image");

      titleElement.textContent = data.title;
      dateElement.textContent = `Date: ${data.date}`;

      imageElement.src = data.url;
      imageElement.style.width = "300px";
      imageElement.style.height = "200px";
      imageElement.style.borderRadius = "5px";
    })
    .catch((error) =&amp;gt; {
      console.error("Error fetching data:", error);
    });
});

document.addEventListener("DOMContentLoaded", function () {
  const marsBtn = document.getElementById("marsRover");
  marsBtn.addEventListener("click", function () {
    window.location.href = "marsRover.html";
  });
});

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  Exploring Mars Rover Photos
&lt;/h2&gt;

&lt;p&gt;Clicking a button leads to a new screen, &lt;em&gt;&lt;strong&gt;marsRover.html&lt;/strong&gt;&lt;/em&gt;:&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%2Frteqojg2g6wbh4ll7jz5.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%2Frteqojg2g6wbh4ll7jz5.png" alt="index.html"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;and when we click on button it will go to anther screen marsRover.html&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;meta charset="UTF-8" /&amp;gt;
    &amp;lt;title&amp;gt;Mars Rover Photo&amp;lt;/title&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;h1&amp;gt;Mars Rover Photos&amp;lt;/h1&amp;gt;
    &amp;lt;div id="photo-container"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;script src="./marsRover.js"&amp;gt;&amp;lt;/script&amp;gt;
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;

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

&lt;/div&gt;



&lt;p&gt;The &lt;em&gt;&lt;strong&gt;marsRover.js&lt;/strong&gt;&lt;/em&gt; script fetches and displays Mars rover photos:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;document.addEventListener("DOMContentLoaded", () =&amp;gt; {
  const apiUrl = `https://api.nasa.gov/mars-photos/api/v1/rovers/curiosity/photos?sol=1000&amp;amp;api_key=${apiKey}`;

  fetch(apiUrl)
    .then((response) =&amp;gt; response.json())
    .then((data) =&amp;gt; {
      console.log(data);
      const photos = data.photos;
      console.log(data.photos);

      // Displaying on the DOM
      const photoContainer = document.getElementById("photo-container");

      photos.forEach((photo) =&amp;gt; {
        const photoDiv = document.createElement("div");
        photoDiv.className = "photo";

        const imgElement = document.createElement("img");
        imgElement.src = photo.img_src;
        imgElement.style.width = "300px";
        imgElement.style.height = "200px";
        imgElement.style.borderRadius = "5px";

        const roverNameElement = document.createElement("p");
        roverNameElement.textContent = `Rover Name: ${photo.rover.name}`;

        const earth_date_element = document.createElement("p");
        earth_date_element.textContent = `Date: ${photo.earth_date}`;

        photoDiv.appendChild(roverNameElement);
        photoDiv.appendChild(earth_date_element);
        photoDiv.appendChild(imgElement);

        photoContainer.appendChild(photoDiv);
      });
    })
    .catch((error) =&amp;gt; {
      console.error("Error fetching data:", error);
    });
});

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

&lt;/div&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%2F7rp7qszqtbgq2bounb06.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%2F7rp7qszqtbgq2bounb06.png" alt="marsRover.html"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;With this Chrome extension, you've learned how to fetch and display NASA space data. Utilizing &lt;em&gt;&lt;strong&gt;manifest.json&lt;/strong&gt;&lt;/em&gt;, content scripts, and background scripts enhances the extension's capabilities. Remember, content scripts manipulate active tab DOM, while background scripts run continuously in the background.&lt;/p&gt;

&lt;p&gt;Happy coding and exploring the cosmos with your Chrome extension!&lt;/p&gt;

</description>
      <category>chrome</category>
      <category>extensions</category>
      <category>chromeextension</category>
      <category>webdev</category>
    </item>
    <item>
      <title>🎨 Mastering Drag-and-Drop in React-Select: A Visual Guide 🚀</title>
      <dc:creator>Tejendra Singh Rajawat</dc:creator>
      <pubDate>Sun, 27 Nov 2022 08:46:20 +0000</pubDate>
      <link>https://dev.to/tejendrasrajawat/react-select-drag-and-drop-advanced-5g05</link>
      <guid>https://dev.to/tejendrasrajawat/react-select-drag-and-drop-advanced-5g05</guid>
      <description>&lt;p&gt;Absolutely! Let's add some emojis and improve the visual appeal with a simple diagram.&lt;/p&gt;




&lt;h2&gt;
  
  
  🚀 &lt;strong&gt;Enhancing Drag-and-Drop in React-Select&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Today, we'll embark on a journey to amplify the drag-and-drop experience in the &lt;code&gt;react-select&lt;/code&gt; library. 🎉 To begin, let's gear up with the essential Higher Order Components (HOC) from both &lt;code&gt;react-select&lt;/code&gt; and &lt;code&gt;react-sortable-hoc&lt;/code&gt;.&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="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;Select&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;components&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="s2"&gt;react-select&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&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;SortableContainer&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;SortableElement&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="s2"&gt;react-sortable-hoc&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To facilitate the drag-and-drop events, we'll wield a moveable array and a customized &lt;code&gt;MultiValue&lt;/code&gt; function. 🛠️&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;// Function for drag and drop&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;arrayMove&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;array&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;to&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;array&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;slice&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="nx"&gt;array&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;to&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="nx"&gt;array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;to&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;to&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="nx"&gt;array&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="k"&gt;from&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="mi"&gt;0&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;array&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Crafting a draggable MultiValue component&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;SortableMultiValue&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;SortableElement&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;props&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;onMouseDown&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&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="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;preventDefault&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stopPropagation&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;innerProps&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;onMouseDown&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;components&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;MultiValue&lt;/span&gt; &lt;span class="p"&gt;{...&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="nx"&gt;innerProps&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;innerProps&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="sr"&gt;/&amp;gt;&lt;/span&gt;&lt;span class="err"&gt;;
&lt;/span&gt;&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="c1"&gt;// Assembling a sortable Select component&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;SortableSelect&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;SortableContainer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;Select&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, let's infuse life into our drag-and-drop adventure by using the &lt;code&gt;onChange&lt;/code&gt; and &lt;code&gt;onSortEnd&lt;/code&gt; functions to dance with selection and reordering.&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;// Example with mandatory skills 🌟&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;selectedMand&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setSelectedMand&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="nx"&gt;getMandatorySkillOption&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;onChangeMand&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;selectedOptions&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;setSelectedMand&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;selectedOptions&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;onSortEndMan&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;oldIndex&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;newIndex&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;newValue&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;arrayMove&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;selectedMand&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;oldIndex&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;newIndex&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nf"&gt;setSelectedMand&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;newValue&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Values sorted:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;newValue&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;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;i&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="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Lastly, let's bring all the props together in our stage, the &lt;code&gt;SortableSelect&lt;/code&gt; component. It eagerly accepts all the props from &lt;code&gt;react-select&lt;/code&gt; and adds a touch of magic with draggable MultiValues. ✨&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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;SortableSelect&lt;/span&gt;
  &lt;span class="nx"&gt;axis&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;xy&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
  &lt;span class="nx"&gt;styles&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;customStyles&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nx"&gt;classNamePrefix&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;create_position&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nx"&gt;onSortEnd&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;onSortEndMan&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nx"&gt;distance&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nx"&gt;getHelperDimensions&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{({&lt;/span&gt; &lt;span class="nx"&gt;node&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;node&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getBoundingClientRect&lt;/span&gt;&lt;span class="p"&gt;()}&lt;/span&gt;
  &lt;span class="nx"&gt;isMulti&lt;/span&gt;
  &lt;span class="nx"&gt;options&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;getMandatorySkillOption&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="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;selectedMand&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nx"&gt;onChange&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;onChangeMand&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nx"&gt;components&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{{&lt;/span&gt;
    &lt;span class="na"&gt;MultiValue&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;SortableMultiValue&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}}&lt;/span&gt;
  &lt;span class="nx"&gt;defaultValue&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;formData&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;mandatorySkill&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;i&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="na"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;i&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="na"&gt;label&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;mandatorySkillName&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}))}&lt;/span&gt;
  &lt;span class="nx"&gt;closeMenuOnSelect&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="kc"&gt;false&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With this, we aim to not only enhance functionality but also add a dash of fun and excitement to the reading experience! 🚀📚&lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Video call app using webrtc</title>
      <dc:creator>Tejendra Singh Rajawat</dc:creator>
      <pubDate>Tue, 06 Sep 2022 12:21:59 +0000</pubDate>
      <link>https://dev.to/tejendrasrajawat/video-call-app-using-webrtc-1p40</link>
      <guid>https://dev.to/tejendrasrajawat/video-call-app-using-webrtc-1p40</guid>
      <description>&lt;p&gt;Hi there, today we are creating video call app using webRtc, firebase and react.js.&lt;br&gt;
You can also test code available here -&amp;gt; &lt;a href="https://github.com/Tejendrasrajawat/webRtc" rel="noopener noreferrer"&gt;Github&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  1. Create Room -&amp;gt;
&lt;/h2&gt;

&lt;p&gt;First, create realtime database in firebase and create a roomId using urlparams, which is a random created key in firebase database.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// reference of RD
let RD = firebase.database().ref();
// url params
const URLPARAMS = new URLSearchParams(window.location.search);
// get id from url
const roomId = URLPARAMS.get("id");

if (roomId) {
  // set room id as child
  RD = RD.child(roomId);
} else {
  // create id and set to roomid
  RD = RD.push();
  window.history.replaceState(null, "meet", "?id=" + RD.key);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. create participant object -
&lt;/h2&gt;

&lt;p&gt;now we will create an object participant in our roomId which contains audio,video and screen share information. It will look like this - &lt;br&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%2Ftu6qwfequblc57mt6z4g.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%2Ftu6qwfequblc57mt6z4g.png" alt="participant data"&gt;&lt;/a&gt;&lt;br&gt;
To get this output ,we will do as follow , you can get userName as string or get it dynamically too.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const participantDb = RD.child("participant");
  useEffect(() =&amp;gt; {
    //check for value if true
    connectedRef.on("value", (snap) =&amp;gt; {
      if (snap.val()) {
        // create values to push
        const defaultPref = {
          audio: true,
          video: false,
          screen: false,
        };
        // push data to participant
        const pushedDataOfParticipant = participantDb.push({
          userName: 'tejendra',
          preference: defaultPref,
        });
        // remove user when he quit or close browser
        pushedDataOfParticipant.onDisconnect().remove();
      }
    });
  }, []);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. Peer Connection -
&lt;/h2&gt;

&lt;p&gt;Now most important part of webrtc is create peer to peer connection so we can communication in realtime, for that we need to follow below image.&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%2Fllkri6nfo5hweh8eeph1.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%2Fllkri6nfo5hweh8eeph1.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For signaling we are using firebase.&lt;br&gt;
First user will create a offer for others to join and when someone joins then one answer will be created and they will communicate using signaling.&lt;/p&gt;

&lt;p&gt;i. create offer -&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export const createOffer = async (peerConnection, receiverId, createdID) =&amp;gt; {
  const currentParticipantRef = participantRef.child(receiverId);
  peerConnection.onicecandidate = (event) =&amp;gt; {
    event.candidate &amp;amp;&amp;amp;
      currentParticipantRef
        .child("offerCandidates")
        .push({ ...event.candidate.toJSON(), userId: createdID });
  };

  const offerDescription = await peerConnection.createOffer();
  await peerConnection.setLocalDescription(offerDescription);

  const offer = {
    sdp: offerDescription.sdp,
    type: offerDescription.type,
    userId: createdID,
  };

  await currentParticipantRef.child("offers").push().set({ offer });
};

export const initializeListensers = async (userId) =&amp;gt; {
  const currentUserRef = participantRef.child(userId);

  currentUserRef.child("offers").on("child_added", async (snapshot) =&amp;gt; {
    const data = snapshot.val();
    if (data?.offer) {
      const pc =
        store.getState().participants[data.offer.userId].peerConnection;
      await pc.setRemoteDescription(new RTCSessionDescription(data.offer));
      await createAnswer(data.offer.userId, userId);
    }
  });

  currentUserRef.child("offerCandidates").on("child_added", (snapshot) =&amp;gt; {
    const data = snapshot.val();
    if (data.userId) {
      const pc = store.getState().participants[data.userId].peerConnection;
      pc.addIceCandidate(new RTCIceCandidate(data));
    }
  });

  currentUserRef.child("answers").on("child_added", (snapshot) =&amp;gt; {
    const data = snapshot.val();
    if (data?.answer) {
      const pc =
        store.getState().participants[data.answer.userId].peerConnection;
      const answerDescription = new RTCSessionDescription(data.answer);
      pc.setRemoteDescription(answerDescription);
    }
  });

  currentUserRef.child("answerCandidates").on("child_added", (snapshot) =&amp;gt; {
    const data = snapshot.val();
    if (data.userId) {
      const pc = store.getState().participants[data.userId].peerConnection;
      pc.addIceCandidate(new RTCIceCandidate(data));
    }
  });
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;ii. create answer -&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const createAnswer = async (otherUserId, userId) =&amp;gt; {
  const pc = store.getState().participants[otherUserId].peerConnection;
  const participantRef1 = participantRef.child(otherUserId);
  pc.onicecandidate = (event) =&amp;gt; {
    event.candidate &amp;amp;&amp;amp;
      participantRef1
        .child("answerCandidates")
        .push({ ...event.candidate.toJSON(), userId: userId });
  };

  const answerDescription = await pc.createAnswer();
  await pc.setLocalDescription(answerDescription);

  const answer = {
    type: answerDescription.type,
    sdp: answerDescription.sdp,
    userId: userId,
  };

  await participantRef1.child("answers").push().set({ answer });
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it, now you can create a simple UI component and start realtime chat with audio, video and screen share.&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%2Fuser-images.githubusercontent.com%2F38542608%2F182521898-c72f5d7e-4460-4e01-a050-2db0eca6fa32.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%2Fuser-images.githubusercontent.com%2F38542608%2F182521898-c72f5d7e-4460-4e01-a050-2db0eca6fa32.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>webrtc</category>
      <category>videocall</category>
    </item>
    <item>
      <title>Scroll to specific element in react using useRef</title>
      <dc:creator>Tejendra Singh Rajawat</dc:creator>
      <pubDate>Wed, 17 Aug 2022 04:26:24 +0000</pubDate>
      <link>https://dev.to/tejendrasrajawat/scroll-to-specific-element-in-react-using-useref-1fb8</link>
      <guid>https://dev.to/tejendrasrajawat/scroll-to-specific-element-in-react-using-useref-1fb8</guid>
      <description>&lt;p&gt;I have a firebase group chat ui and it have a search functionality in it. but when i click on search result then i want to go to that specific element (list element in my case). for that example i am using react hooks called useRef which take current element and we can get get it anywhere in our code .&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { useRef } from 'react'
const scrollToRef = (ref) =&amp;gt; window.scrollTo(0, ref.current.offsetTop) 
// General scroll to element function 
const ScrollDemo = () =&amp;gt; { const myRef = useRef(null) 
const executeScroll = () =&amp;gt; scrollToRef(myRef)
return ( &amp;lt;&amp;gt; 
&amp;lt;div ref={myRef}&amp;gt;I wanna be seen&amp;lt;/div&amp;gt; 
&amp;lt;button onClick={executeScroll}&amp;gt; Click to scroll &amp;lt;/button&amp;gt;
 &amp;lt;/&amp;gt; )}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;here, now when i click on button then it will look for div with myRef and our view scroll to that div.&lt;br&gt;
for reference in my code i have given github link - &lt;br&gt;
&lt;a href="https://github.com/Tejendrasrajawat/firebase-chat-app/blob/main/src/components/Group/G_chat.js"&gt;github&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
    </item>
    <item>
      <title>Beginner guide to websocket</title>
      <dc:creator>Tejendra Singh Rajawat</dc:creator>
      <pubDate>Wed, 17 Aug 2022 04:17:20 +0000</pubDate>
      <link>https://dev.to/tejendrasrajawat/beginner-guide-to-websocket-43pg</link>
      <guid>https://dev.to/tejendrasrajawat/beginner-guide-to-websocket-43pg</guid>
      <description>&lt;p&gt;Q. What is websocket ?&lt;br&gt;
A. websocket provides a way to exchange data between browser and server via a persistent connection. The data can be passed in both directions as “packets”, without breaking the connection and the need of additional HTTP-requests.&lt;/p&gt;

&lt;p&gt;Q. where can we use websocket ?&lt;br&gt;
A. we use websocket where we need realtime data sharing i.e. online trading platform, games and social media platforms.&lt;/p&gt;

&lt;p&gt;Frontend Example -&lt;br&gt;
To open a websocket connection we need to create new protocol.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let socket = new WebSocket("ws://localhost:3000");
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once the socket is created, we should listen to events on it. There are totally 4 events:&lt;/p&gt;

&lt;p&gt;open – connection established,&lt;br&gt;
message – data received,&lt;br&gt;
error – websocket error,&lt;br&gt;
close – connection closed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let socket = new WebSocket("ws://localhost.com");

socket.onopen = function(e) {
  alert("[open] Connection established");
  alert("Sending to server");
  socket.send("My name is tejendra");
};

socket.onmessage = function(event) {
  alert(`[message] Data received from server: ${event.data}`);
};

socket.onclose = function(event) {
  if (event.wasClean) {
    alert(`[close] Connection closed cleanly, code=${event.code} reason=${event.reason}`);
  } else {
    alert('[close] Connection died');
  }
};

socket.onerror = function(error) {
  alert(`[error] ${error.message}`);
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We need to have server database for above demo too, so we can connect to server.&lt;br&gt;
So you’ll see events open → message → close. and if there is error then onerror in end.&lt;/p&gt;

&lt;p&gt;When new WebSocket(url) is created, it starts connecting immediately.&lt;/p&gt;

&lt;p&gt;During the connection, the browser (using headers) asks the server: “Do you support Websocket?” And if the server replies “yes”, then the talk continues in WebSocket protocol.&lt;/p&gt;

&lt;p&gt;If you want to use it in frontend so the best way to use is socket.io which works on both client and server side .&lt;/p&gt;

&lt;p&gt;There are some methods to use in socket.io&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//connect to server
const socket = io("http://localhost.com");

//on() - listen to custom event or default event. (receive)
socket.on('connect', console.log('connect to server'))

//emit() - sent custom or default event to server. (send)
socket.emit('costum-event', 10, 'Hi', 'send')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;important - both server and client have same event name to work.&lt;/p&gt;

&lt;p&gt;But how to send data from server ?&lt;br&gt;
For that we need to use same methods in server side too.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//broadcast.emit() - send custom or default event to everyone except the sender.
socket.broadcast.emit('costum-event', 10, 'Hi', 'send')

//to(room) - send message to a specific room or group
socket.to("some room").emit("some event");
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>CRUD operation in Firebase V9</title>
      <dc:creator>Tejendra Singh Rajawat</dc:creator>
      <pubDate>Wed, 06 Apr 2022 04:22:14 +0000</pubDate>
      <link>https://dev.to/tejendrasrajawat/crud-operation-in-firebase-v9-2g83</link>
      <guid>https://dev.to/tejendrasrajawat/crud-operation-in-firebase-v9-2g83</guid>
      <description>&lt;p&gt;Today, we will talk about firebase v9 and how to integrate it in a React.js project. So first of all let's see what are we doing today-&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;What is firebase ?&lt;/li&gt;
&lt;li&gt;Create react.js project with firebase.&lt;/li&gt;
&lt;li&gt;Config firebase v9.&lt;/li&gt;
&lt;li&gt;Write Operation.&lt;/li&gt;
&lt;li&gt;Read Operation.&lt;/li&gt;
&lt;li&gt;Update Operation.&lt;/li&gt;
&lt;li&gt;Delete Operation.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;1. What is firebase&lt;/strong&gt; - &lt;br&gt;
Firebase is a platform by Google which provide cloud, database and many other services for mobile and web applications. It provides Realtime Database and API that synchronizes application data. For starting you can use it for free but after some time if you want to use it for high scale then you can pay on demand. you can also use third party hosting and domain in firebase.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Create react.js project with firebase&lt;/strong&gt; - &lt;br&gt;
We are creating a &lt;em&gt;todo&lt;/em&gt; react project and we will use firebase for our backend data, so we can create, read, update and delete our todos in realtime.&lt;br&gt;
So, first of all let's create a react project.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx create-react-app todos
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When you run this command in cmd, when it complete building then you will see a folder called todos. open this folder in any code editor you want.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RxldmXlA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4bpq0cm0g10kjnk23e12.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RxldmXlA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4bpq0cm0g10kjnk23e12.png" alt="react project" width="800" height="326"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now we want to install firebase using below command and when it completed , you can find firebase version in package.json file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm i firebase
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3igqLuzC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qoa3256ua6o62rys6kzm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3igqLuzC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qoa3256ua6o62rys6kzm.png" alt="firebase version" width="800" height="348"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Now let's go to firebase website and quickly create a account, click on console, click on web and give the details like project name.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--t_4SrEZ4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ek6gnmer51gaeja42b50.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--t_4SrEZ4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ek6gnmer51gaeja42b50.png" alt="firebase console" width="800" height="346"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Now when you click on web icon &amp;lt;&amp;gt; , you will get screen like below, just copy this config details we want these details in our react app.&lt;/em&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--q10PlSvP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uteeclo0moyv9lprldht.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--q10PlSvP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uteeclo0moyv9lprldht.png" alt="" width="672" height="566"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Config firebase v9&lt;/strong&gt; -&lt;br&gt;
Now our next task is integrate our firebase code in our react app. for that create a files named firebaseInit.js (optional name) under src folder and copy above code there.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CP-gS3Wj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/grg9fiagqqo3v0rtkf8v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CP-gS3Wj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/grg9fiagqqo3v0rtkf8v.png" alt="config file" width="800" height="358"&gt;&lt;/a&gt;&lt;br&gt;
_and we are done, now we can use firebase in our react app as we need. _&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Write Operation&lt;/strong&gt; -&lt;br&gt;
Let's dive into CRUD operation now. To use database in react first we need to import firestore in our app.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3iL2BZjE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mcdquipdpga0hl4ho35w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3iL2BZjE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mcdquipdpga0hl4ho35w.png" alt="import firestore" width="440" height="345"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;now we can use db in any component and perform CRUD operation. let's try to Write data in firestore.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Au9kW6fi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/75zb7z2bw4jyqd590z7z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Au9kW6fi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/75zb7z2bw4jyqd590z7z.png" alt="write method" width="493" height="617"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Now if you click on button , then it will addDoc in a collection name "todo" (if it doesn't exist then firebase will make it) with fields describe in line 14,15&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0IGgZ43K--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a4cjbiehbvvcdh0n0efj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0IGgZ43K--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a4cjbiehbvvcdh0n0efj.png" alt="addDoc" width="800" height="205"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Read Operation&lt;/strong&gt; -&lt;br&gt;
Now we can send data to firebase , but what about to read it. Meaning there are no sense of a todo if we can't see all todos on screen. then let's create a read component too.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--uie_gvNP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7zr2ko0gg83g74tuouyf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--uie_gvNP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7zr2ko0gg83g74tuouyf.png" alt="read component" width="496" height="459"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Here, we use useEffect so whenever this component runs it fetches all the data from firestore database. and this is our results&lt;/em&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--13A7h1XG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oqlzvbkllr9sj5z6aevq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--13A7h1XG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oqlzvbkllr9sj5z6aevq.png" alt="data" width="314" height="411"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. Update Operation&lt;/strong&gt; -&lt;br&gt;
Now i realized that there are no unicorns in park and i want to change it to theme park, so what are the options? i can use update operation so that i can do it. For simplicity ,we will create update method with read component.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;First we will give a update Button which will open a modal with a form&lt;/em&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--44sEhuUN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hjfzj0yg693isb7zpy98.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--44sEhuUN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hjfzj0yg693isb7zpy98.png" alt="update modal" width="692" height="590"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Now,as you can see we have a handleUpdate function to update form data.&lt;/em&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8PLF6OlQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t2fqvhpuaiaw0fcvknxj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8PLF6OlQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t2fqvhpuaiaw0fcvknxj.png" alt="handleUpdate" width="329" height="227"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;That's it now let's see our results&lt;/em&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--z0Mj_ETS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l8zzz1i8pansl87ijsk8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--z0Mj_ETS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l8zzz1i8pansl87ijsk8.png" alt="updated data" width="314" height="560"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7. Delete Operation&lt;/strong&gt; -&lt;br&gt;
Now we need a delete functionality, so that we can delete a todo when it's done . &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pE0Y97Ha--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h5an7mo0f3axfj4vsf7r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pE0Y97Ha--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h5an7mo0f3axfj4vsf7r.png" alt="" width="454" height="144"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Here, we have a handleDelete with id to delete todo.&lt;/em&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HPYu6ln5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x9p7hv84xduuzhiej541.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HPYu6ln5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x9p7hv84xduuzhiej541.png" alt="" width="255" height="135"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;This is the CRUD operation in firebase, if you stuck anywhere then i have provider project link too. you can use and change code as you want . &lt;a href="https://github.com/Tejendrasrajawat/todo-firebase-project/"&gt;github repo&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>beginners</category>
      <category>react</category>
      <category>firebase</category>
    </item>
    <item>
      <title>Create navigation screens in expo project 🧑‍💻</title>
      <dc:creator>Tejendra Singh Rajawat</dc:creator>
      <pubDate>Mon, 04 Apr 2022 06:26:51 +0000</pubDate>
      <link>https://dev.to/tejendrasrajawat/create-navigation-screens-in-expo-project-33d1</link>
      <guid>https://dev.to/tejendrasrajawat/create-navigation-screens-in-expo-project-33d1</guid>
      <description>&lt;p&gt;Today ,we are creating navigation screens in expo project from scratch. For that let's first of all create a react-native project.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;expo init online-store
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;after running above command click enter , it will choose default options.&lt;/p&gt;

&lt;p&gt;Now ,we have our react-native project. now we need to install some more dependencies, which are as follow -&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install @react-navigation/native @react-navigation/native-stack
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;expo install react-native-screens react-native-safe-area-context
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now go to app.js and delete existing code, we don't need it. we need below code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { StyleSheet, Text, View } from "react-native";
import { NavigationContainer } from "@react-navigation/native";
import { createNativeStackNavigator } from "@react-navigation/native-stack";
import Homepage from "./Screens/Homepage";
import MenSection from "./Screens/MenSection";
import WomenSection from "./Screens/WomenSection";
import Contactus from "./Screens/Contactus";
const stack = createNativeStackNavigator();
export default function App() {
  return (
    &amp;lt;NavigationContainer&amp;gt;
      &amp;lt;stack.Navigator&amp;gt;
        &amp;lt;stack.Screen
          name="Home"
          component={Homepage}
          options={{ title: "Welcome to online store" }}
        /&amp;gt;
        &amp;lt;stack.Screen name="Men" component={MenSection} /&amp;gt;
        &amp;lt;stack.Screen name="Women" component={WomenSection} /&amp;gt;
        &amp;lt;stack.Screen name="Contact" component={Contactus} /&amp;gt;
      &amp;lt;/stack.Navigator&amp;gt;
    &amp;lt;/NavigationContainer&amp;gt;
  );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you run your project now, you can see homepage on first time. If we want to go to another page then we can use button or any other onClick method here and for that we have prop &lt;strong&gt;{navigation}&lt;/strong&gt; which can help us to redirect to another page.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const Homepage= ({ navigation }) =&amp;gt; {
  return (
    &amp;lt;Button
      title="Go to men's section"
      onPress={() =&amp;gt;
        navigation.navigate('Men', { state: 'Id of clothing' })
      }
    /&amp;gt;
  );
};
const Men= ({ navigation, route }) =&amp;gt; {
  return &amp;lt;Text&amp;gt;This is {route.params.state}'s profile&amp;lt;/Text&amp;gt;;
};

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

&lt;/div&gt;



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

&lt;p&gt;That's it for react-native navigation, now you can play it with more as use case and make it more advance as you want.&lt;/p&gt;

</description>
      <category>reactnative</category>
      <category>expo</category>
      <category>javascript</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Create your own portfolio website (My website Demo) 🌿🌿</title>
      <dc:creator>Tejendra Singh Rajawat</dc:creator>
      <pubDate>Tue, 29 Mar 2022 05:19:03 +0000</pubDate>
      <link>https://dev.to/tejendrasrajawat/create-your-own-portfolio-website-my-website-demo-l12</link>
      <guid>https://dev.to/tejendrasrajawat/create-your-own-portfolio-website-my-website-demo-l12</guid>
      <description>&lt;p&gt;Hi everyone, today I want to share my portfolio website and some ideas to create your own. &lt;a href="https://tejendrasrajawat.github.io/"&gt;Official Website&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Explaination
&lt;/h2&gt;

&lt;p&gt;As you can see in above website, I used dark and light mode, some buttons to social media accounts, one page for my GitHub projects and one for all blogs I wrote yet. also there is a page to contact me. all the backend functionality are handled by firebase and there is nothing static.&lt;/p&gt;

&lt;p&gt;So let's see what are we covering today - &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Basics of Html and CSS&lt;/li&gt;
&lt;li&gt;JavaScript and React.js&lt;/li&gt;
&lt;li&gt;Styles Component&lt;/li&gt;
&lt;li&gt;use Context and Redux&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;1. Basics of html and CSS&lt;/strong&gt; - &lt;br&gt;
If you want to create any website so first of all you need to have knowledge of html and CSS. Html is used as a skeleton of website and CSS is the design part. They are not difficult to learn but can be complicated to understand.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Best way to learn basics of html and css are from &lt;a href="https://www.w3schools.com/css/css_intro.asp"&gt;w3schools&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. React.js&lt;/strong&gt; -&lt;br&gt;
Next part is React.js which is a framework of JavaScript, but why use React.js. well the answer is easy if your website have complex logics which can only be handled by JavaScript then react.js will make your task easy. &lt;br&gt;
To learn react.js , you want to learn JavaScript first. There are some references to learn it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Firebase (optional)&lt;/strong&gt;-&lt;br&gt;
&lt;em&gt;In my portfolio, I used react to connect firebase firstore and get database from firebase.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;JavaScript -&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://www.w3schools.com/js/"&gt;w3school&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://youtu.be/W6NZfCO5SIk"&gt;code with mosh&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;React.js -&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://reactjs.org/tutorial/tutorial.html"&gt;react docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/watch?v=Ke90Tje7VS0"&gt;code with mosh&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;3. Styled Component&lt;/strong&gt; - &lt;br&gt;
If you familiar to CSS then you know that there are some limitation there like you can't use conditions directly there but in Styled component which is a module , you can use inline css and can use conditions in css. It's optional but still i want you to have a look. &lt;a href="https://styled-components.com/"&gt;styled docs&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. use Context and Redux&lt;/strong&gt; - &lt;br&gt;
At last but my favorite part is Redux , without going in details if you want to use same value in different component(files) then you can use Redux or use Context in Reactjs. Both will do the job but if your project is large then go for Redux or go for use Context.&lt;br&gt;
&lt;em&gt;I used it to give dark and light mode functionality in my website&lt;/em&gt;&lt;br&gt;
Ref - &lt;a href="https://redux.js.org/"&gt;Redux&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;Well, That's all I used in my website yet and yet trying to improve it furthermore. So I need your valuable feedback.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>react</category>
      <category>portfolio</category>
      <category>programming</category>
    </item>
    <item>
      <title>Array Cheatsheet in JavaScript🚀</title>
      <dc:creator>Tejendra Singh Rajawat</dc:creator>
      <pubDate>Mon, 28 Mar 2022 18:56:56 +0000</pubDate>
      <link>https://dev.to/tejendrasrajawat/array-cheatsheet-in-javascript-7md</link>
      <guid>https://dev.to/tejendrasrajawat/array-cheatsheet-in-javascript-7md</guid>
      <description>&lt;p&gt;In any programming language if we have a collection of elements or items, then we will define them as array. they can store data such as string, numbers, object as an collection of element and we can retrieve them whenever and however we want.&lt;br&gt;
I will discuss about what can we do using array in JavaScript. so first of all let's create a array in JavaScript.&lt;br&gt;
There are many ways to create array in JavaScript i.e. -&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Basic Way&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;`const animals = ['🙈','🙉','🙊','🐵']`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. Array Constructor&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;`const food = new Array('🍇','🍈','🍉','🍊','🍌')`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;3. Empty Array&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;`const emptyArray = []`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, we know how to create an array in JavaScript and now let's dive into some methods of Array.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. indexOf()&lt;/strong&gt; - we can find an item's index&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;`const animals = ['🐶','🐱','🦁','🐷']
animals.indexOf('🦁')     //2 `
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. join()&lt;/strong&gt; - create a string from array items and also can add words between them like 'and','or'.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;`const animals = ['🐶','🐱','🦁','🐷']
animals.join('loves')   // '🐶 loves 🐱 loves 🦁 loves 🐷' `
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;3. slice()&lt;/strong&gt; - split an array at given index(es)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;`const animals = ['🐶','🐱','🦁','🐷']
animals.slice(1);    //['🐱','🦁','🐷']
animals.slice(1,2);   //[ '🐱' ]
console.log(animals)  //[ '🐶', '🐱', '🦁', '🐷' ] `
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;4. splice()&lt;/strong&gt; - same as slice and you can also insert new items&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;`const animals = ['🐶','🐱','🦁','🐷']
animals.splice(1,2, '🍊') )   //[ '🐱', '🦁' ]
console.log(animals)  //[ '🐶', '🍊', '🐷' ]`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;_as you can see that slice and splice looks similar but slice don't overwrite or change original array but splice does. _&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. forEach()&lt;/strong&gt; - loop over an array and access each item&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;`const animals = ['🐶','🐱','🦁','🐷']
animals.forEach(pet =&amp;gt; console.log(pet))`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;6. Map()&lt;/strong&gt; - loop over an array and access each item and return value without mutating original array&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;`const animals = ['🐶','🐱','🦁','🐷']
animals.map(pet =&amp;gt; console.log(`${pet} is cute`))`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;As you can see in first glance both forEach and map method are same, but as you can see in map method we are mutating array instead we are creating a new array and using map we can return something.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7. flat()&lt;/strong&gt;- It flatten an array to a single dimension.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;`const animals = ['🐶','🐱','🦁', ['🙊','🙉'],'🐷']`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;as you can see we have array under an array , so how do we get a single dimension array.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;`console.log(animals.flat()) //['🐶','🐱','🦁','🙊','🙉','🐷']`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;8. filter()&lt;/strong&gt; - create a new array based on a filter.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;`const animals = ['🐶','🐱','🦁','🐶']
const dog = animals.filter(dog =&amp;gt; dog === '🐶') 
console.log(dog)`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;9. reduce()&lt;/strong&gt; - run a callback on each item and reduce the array to a single value.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;`const numbers = [1,6,7,1,3,4]
const total = numbers.reduce((total,currentval) =&amp;gt; total + currentval);   //22 `
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Ok, so what's happening here is we are taking every number one by one which is our currentval and adding it into our total.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;10. findIndex()&lt;/strong&gt; - finds the index of an item based on a condition&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;`const animals = ['🐶','🐱','🦁','🙉']
const lionIndex = animals.findIndex(lion =&amp;gt; lion === '🦁')
console.log(lionIndex)   //2`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;p&gt;So they are the most used array methods which I use in my code and I hope you will find them useful and we are all learning, I missed a lot of methods here but doing research is a part of the process 🧑‍💻🧑‍💻&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
