<?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>Forem: Mohammed Nadeem Shareef</title>
    <description>The latest articles on Forem by Mohammed Nadeem Shareef (@shareef).</description>
    <link>https://forem.com/shareef</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%2F475635%2F0eabefe2-9186-4f9e-b3df-388e17112056.jpg</url>
      <title>Forem: Mohammed Nadeem Shareef</title>
      <link>https://forem.com/shareef</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/shareef"/>
    <language>en</language>
    <item>
      <title>Maximizing Score with Tokens - 948 - Bag of Tokens in Go</title>
      <dc:creator>Mohammed Nadeem Shareef</dc:creator>
      <pubDate>Mon, 04 Mar 2024 06:38:52 +0000</pubDate>
      <link>https://forem.com/shareef/maximizing-score-with-tokens-948-bag-of-tokens-in-go-2l8m</link>
      <guid>https://forem.com/shareef/maximizing-score-with-tokens-948-bag-of-tokens-in-go-2l8m</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Welcome to the second post of my "Journey into GoLang" series! In this series, I'll document my GoLang programming exploration by solving LeetCode problems. Today, we are solving the &lt;strong&gt;948 - Bag of Tokens&lt;/strong&gt; problem.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem Description:
&lt;/h2&gt;

&lt;p&gt;You start with an initial power of power, an initial score of 0, and a bag of tokens given as an integer array tokens, where each tokens[i] donates the value of tokeni.&lt;/p&gt;

&lt;p&gt;Your goal is to maximize the total score by strategically playing these tokens. In one move, you can play an unplayed token in one of the two ways (but not both for the same token):&lt;/p&gt;

&lt;p&gt;Face-up: If your current power is at least tokens[i], you may play token, losing tokens[i] power and gaining 1 score.&lt;br&gt;
Face-down: If your current score is at least 1, you may play token, gaining tokens[i] power and losing 1 score.&lt;/p&gt;

&lt;p&gt;Return the maximum possible score you can achieve after playing any number of tokens.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
Let's consider an example to understand the problem better:&lt;br&gt;
Input:&lt;br&gt;
tokens = [200, 100]&lt;br&gt;
power = 150&lt;br&gt;
Output:&lt;br&gt;
1&lt;/p&gt;

&lt;p&gt;&lt;a href="https://leetcode.com/problems/bag-of-tokens/description"&gt;LeetCode Link&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Approach:
&lt;/h2&gt;

&lt;p&gt;To solve this problem efficiently. We'll sort the tokens array to prioritize playing tokens with lower values first. Then, we'll iterate through the tokens array, playing tokens face-up if possible, and face-down if necessary. We'll keep track of the maximum score achieved throughout the process.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s"&gt;"fmt"&lt;/span&gt;
    &lt;span class="s"&gt;"sort"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;bagOfTokensScore&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tokens&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;power&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;sort&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Ints&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tokens&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;left&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;right&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;score&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tokens&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;
    &lt;span class="n"&gt;maxScore&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;left&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="n"&gt;right&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;power&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="n"&gt;tokens&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;left&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;power&lt;/span&gt; &lt;span class="o"&gt;-=&lt;/span&gt; &lt;span class="n"&gt;tokens&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;left&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
            &lt;span class="n"&gt;left&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;
            &lt;span class="n"&gt;score&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;score&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;maxScore&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="n"&gt;maxScore&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;score&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;score&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;power&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;tokens&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;right&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
            &lt;span class="n"&gt;right&lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt;
            &lt;span class="n"&gt;score&lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;break&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;maxScore&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;bagOfTokensScore&lt;/span&gt;&lt;span class="p"&gt;([]&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="m"&gt;200&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;100&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="m"&gt;150&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="c"&gt;// Output: 1&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://github.com/shareef99/go-leetcode-problems/blob/main/problems/948-bag-of-tokens/main.go"&gt;Github Code&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thank you for joining me on this journey, and I look forward to sharing more discoveries with you in the upcoming posts!&lt;/p&gt;

&lt;p&gt;Social Links&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Twitter: &lt;a href="https://twitter.com/shareef99_"&gt;@shareef99_&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;LinkedIn: &lt;a href="https://www.linkedin.com/in/nadeem-shareef/"&gt;Nadeem Shareef&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Github: &lt;a href="https://github.com/shareef99"&gt;shareef99&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>go</category>
      <category>leetcode</category>
      <category>learning</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Journey into GoLang: Understanding Go by solving LeetCode problems</title>
      <dc:creator>Mohammed Nadeem Shareef</dc:creator>
      <pubDate>Sun, 03 Mar 2024 13:09:49 +0000</pubDate>
      <link>https://forem.com/shareef/journey-into-golang-understanding-go-by-solving-leetcode-problems-3ib2</link>
      <guid>https://forem.com/shareef/journey-into-golang-understanding-go-by-solving-leetcode-problems-3ib2</guid>
      <description>&lt;h2&gt;
  
  
  Introduction:
&lt;/h2&gt;

&lt;p&gt;Welcome to the first post of my "Journey into GoLang" series! In this series, I'll be documenting my exploration of GoLang programming through solving LeetCode problems. Today, we kick off our journey by solving the classic Two Sum problem.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem Description:
&lt;/h2&gt;

&lt;p&gt;Given an array of integers and a target integer, find the indices of two numbers that add up to the target.&lt;/p&gt;

&lt;h2&gt;
  
  
  Initial Solution
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;twoSum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;nums&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;target&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="m"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="m"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;{}&lt;/span&gt;
  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;nums&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;j&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;j&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;nums&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="n"&gt;j&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;j&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;continue&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;

      &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;nums&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;nums&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;j&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;target&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;j&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;i&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="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;result&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;In our initial approach, we took a straightforward route. We add nested loops to iterate through the array and find the desired indices. While this solution worked, it had a time complexity of O(n^2), making it suboptimal for larger datasets.&lt;/p&gt;

&lt;h3&gt;
  
  
  Optimized Solution
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;optimizeTwoSum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;nums&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;target&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="m"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="m"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;{}&lt;/span&gt;
  &lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="nb"&gt;make&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;map&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;nums&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;nums&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;nums&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ok&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;target&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;nums&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]];&lt;/span&gt; &lt;span class="n"&gt;ok&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;target&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;nums&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]]&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;
      &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;target&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;nums&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]]&lt;/span&gt;
      &lt;span class="k"&gt;break&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;We create a &lt;code&gt;hash map&lt;/code&gt;, hash map keys are the values of nums and the hash map value is an index of the value of nums. &lt;/li&gt;
&lt;li&gt;We use the &lt;code&gt;hash map&lt;/code&gt; to find the complement of the target.&lt;/li&gt;
&lt;li&gt;Complement means the difference between the target and the value of nums (x + y = t =&amp;gt; x = t - y).&lt;/li&gt;
&lt;li&gt;If the complement exists in the hash map, we return the index of the complement and the index of the value of nums.&lt;/li&gt;
&lt;li&gt;Map returns two values, the first value is a value stored under the key, and the second value is a boolean indicating whether the key exists or not.&lt;/li&gt;
&lt;li&gt;If the requested key doesn’t exist, we get the value type’s zero value. In this case, the value type is int, so the zero value is 0. The second value will be false.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://github.com/shareef99/go-leetcode-problems/blob/main/problems/001-two-sum/main.go"&gt;Github Code Link&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Join the Journey:&lt;/strong&gt;&lt;br&gt;
This post marks just the beginning of our journey into GoLang and algorithmic problem-solving. Stay tuned for more insights, challenges, and optimizations as we delve deeper into the world of programming.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion:&lt;/strong&gt;&lt;br&gt;
As we conclude our first installment of the &lt;strong&gt;"Journey into GoLang"&lt;/strong&gt; series, I invite you to learn with me. Together, let's understand GoLang, one LeetCode problem at a time.&lt;/p&gt;

&lt;p&gt;Thank you for joining me on this journey, and I look forward to sharing more discoveries with you in the upcoming posts!&lt;/p&gt;

&lt;p&gt;Social Links&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Twitter: &lt;a href="https://twitter.com/shareef99_"&gt;@shareef99_&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;LinkedIn: &lt;a href="https://www.linkedin.com/in/nadeem-shareef/"&gt;Nadeem Shareef&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Github: &lt;a href="https://github.com/shareef99"&gt;shareef99&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>go</category>
      <category>leetcode</category>
      <category>beginners</category>
      <category>learning</category>
    </item>
    <item>
      <title>Why React is not dying!</title>
      <dc:creator>Mohammed Nadeem Shareef</dc:creator>
      <pubDate>Mon, 01 May 2023 14:39:48 +0000</pubDate>
      <link>https://forem.com/shareef/why-react-is-not-dying-3p25</link>
      <guid>https://forem.com/shareef/why-react-is-not-dying-3p25</guid>
      <description>&lt;p&gt;It's no secret that the world of front-end development is constantly evolving. New frameworks and libraries are released at a rapid pace, leaving developers wondering if their current tool of choice is becoming outdated. React, one of the most popular front-end frameworks, is no exception to this trend. Despite rumors of its decline, React is still widely used and remains a top choice for many developers. So, why is React not dying? Let's take a closer look.&lt;/p&gt;

&lt;h2&gt;
  
  
  React is not dying
&lt;/h2&gt;

&lt;p&gt;React has been around for more than a &lt;strong&gt;decade&lt;/strong&gt;, and during this time, it has become one of the most popular front-end frameworks in the world. Despite the constant influx of new frameworks and libraries in the JavaScript world, React's dominance remains unchallenged. In fact, according to the latest &lt;a href="https://2022.stateofjs.com/en-US/libraries/front-end-frameworks/" rel="noopener noreferrer"&gt;state of JS survey&lt;/a&gt;, React is still has &lt;strong&gt;83%&lt;/strong&gt; of &lt;strong&gt;retention&lt;/strong&gt;. This means that &lt;strong&gt;83%&lt;/strong&gt; of developers who have used React in the past are still using it today. This is a clear indication that React is not dying anytime soon.&lt;/p&gt;

&lt;h2&gt;
  
  
  Community
&lt;/h2&gt;

&lt;p&gt;One of the reasons why React is not dying is its thriving community. With millions of developers using the framework, there is a wealth of knowledge and resources available to anyone who wants to learn or improve their React skills.&lt;/p&gt;

&lt;p&gt;Furthermore, There are also many open-source projects built with React, which can solve virtually any problem you might encounter while developing your application. You can search &lt;code&gt;react&lt;/code&gt; + &lt;code&gt;your problem&lt;/code&gt; and you will find a solution. For example you want to add QR Code to your React App, you can search &lt;code&gt;react qr code&lt;/code&gt; and you will find a package to add QR Code.&lt;/p&gt;

&lt;p&gt;I can give you a lot of examples but I think you got the point.&lt;/p&gt;

&lt;h2&gt;
  
  
  Job Market
&lt;/h2&gt;

&lt;p&gt;React's popularity and widespread adoption by companies have led to a significant demand for React developers in the job market. Many companies have already developed web apps and websites using React, and there are new projects being started every day. This means that there is a high demand for skilled React developers who can work on these projects.&lt;/p&gt;

&lt;p&gt;Moreover, React's popularity and large community make it an attractive option for new developers looking to learn front-end development. As more and more developers learn React, the demand for React developers will only increase, further strengthening React's position in the job market.&lt;/p&gt;

&lt;p&gt;In conclusion, &lt;strong&gt;you need a job? Learn React&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  React's cautious approach towards adopting new features from other frameworks
&lt;/h2&gt;

&lt;p&gt;A few weeks ago, there was a lot of fuzz about &lt;strong&gt;SolidJS&lt;/strong&gt; fine-grained reactivity, how it best and tone of it was like why every framework doesn't have it. But in fact &lt;strong&gt;VueJS&lt;/strong&gt; has fine-grained reactivity with &lt;strong&gt;Composition API&lt;/strong&gt; from years now. And I think Qwik has it too. The icing on the cake is that &lt;strong&gt;Angular&lt;/strong&gt; team decided to add fine-grained reactivity in &lt;strong&gt;Angular&lt;/strong&gt; next version too. If everyone is doing it then why not &lt;strong&gt;React&lt;/strong&gt;?. I think &lt;strong&gt;Andrew Clark&lt;/strong&gt; has already answered this question in his &lt;a href="https://twitter.com/acdlite/status/1626590880126889984" rel="noopener noreferrer"&gt;&lt;strong&gt;twitter&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  NPM downloads
&lt;/h2&gt;

&lt;p&gt;The popularity of a framework can be difficult to measure accurately, but NPM downloads provide a good indication of a framework's adoption and usage. According to &lt;a href="https://www.npmtrends.com/react-vs-vue-vs-angular" rel="noopener noreferrer"&gt;npm trends&lt;/a&gt;, React continues to dominate the front-end framework space with the highest number of downloads. In fact, the gap between React and the second most downloaded framework, VueJS, is quite significant at approximately 16 million downloads. Angular, which is another popular front-end framework, ranks third with a gap of around 20 million downloads. These numbers suggest that React is still in high demand and is being used extensively by developers for building web applications.&lt;/p&gt;

&lt;h2&gt;
  
  
  Competition is good
&lt;/h2&gt;

&lt;p&gt;Competition is a driving force behind innovation and progress. The competition between front-end frameworks like React, Angular, and Vue has led to improvements in each framework over time. React's success has also inspired the development of new and innovative front-end frameworks that build on its foundation. Examples include Solid, Qwik and etc.&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%2F3r1z8vwlc5ub49az96h3.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%2F3r1z8vwlc5ub49az96h3.png" alt="lee robinson twitter photo"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Framework agnostic libraries/tools
&lt;/h2&gt;

&lt;p&gt;As a front-end developer, it can be challenging to keep up with all the latest frameworks and libraries that are constantly being released. Often, we have a preferred tool that we are most comfortable with and have invested time and resources into learning. However, this can limit our ability to explore and try out new frameworks.&lt;/p&gt;

&lt;p&gt;This is where framework agnostic libraries come in. These libraries are designed to work with any framework, making it easier for developers to switch between frameworks. This can be especially helpful for developers who want to try out a new framework but are hesitant to do so because of the tools lacking in the new framework.&lt;/p&gt;

&lt;p&gt;One example of a framework agnostic library is &lt;a href="https://tanstack.com/" rel="noopener noreferrer"&gt;&lt;strong&gt;Tanstack&lt;/strong&gt;&lt;/a&gt;, which offers a suite of libraries for building web applications, including table, query, form, and more. Another example is &lt;a href="https://tanstack.com/" rel="noopener noreferrer"&gt;&lt;strong&gt;AuthJS&lt;/strong&gt;&lt;/a&gt; (formally NextAuth), which is a user authentication library that can be used with any framework. and some new small libraries like &lt;strong&gt;&lt;a href="https://env.t3.gg/" rel="noopener noreferrer"&gt;t3-env&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;By creating these framework agnostic libraries, developers are not only making it easier for other developers to try out new frameworks, but they are also contributing to the growth and development of the web development community as a whole.&lt;/p&gt;

&lt;h2&gt;
  
  
  Meta Frameworks
&lt;/h2&gt;

&lt;p&gt;Meta frameworks are tools built on top of React that provide additional functionality and solutions to specific problems. While there are many meta frameworks available for React, each one offers a unique set of features and benefits.&lt;/p&gt;

&lt;p&gt;Some popular meta frameworks for React include &lt;a href="https://nextjs.org/" rel="noopener noreferrer"&gt;&lt;strong&gt;NextJS&lt;/strong&gt;&lt;/a&gt; and &lt;a href="https://remix.run/" rel="noopener noreferrer"&gt;&lt;strong&gt;Remix&lt;/strong&gt;&lt;/a&gt;, which offer better server-side rendering capabilities. These frameworks are ideal for building server-rendered React applications, enabling faster page loads and improved search engine optimization (SEO).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://blitzjs.com/" rel="noopener noreferrer"&gt;&lt;strong&gt;BlitzJS&lt;/strong&gt;&lt;/a&gt; is another popular meta meta framework(build on top of &lt;a href="https://nextjs.org/" rel="noopener noreferrer"&gt;&lt;strong&gt;NextJS&lt;/strong&gt;&lt;/a&gt;) that provides a better full-stack experience. It offers built-in features like authentication, API routes, and database integrations, simplifying the process of building full-stack React applications.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://redwoodjs.com/" rel="noopener noreferrer"&gt;&lt;strong&gt;RedwoodJS&lt;/strong&gt;&lt;/a&gt; takes this a step further, offering a full-stack experience with GraphQL. This framework allows developers to quickly build scalable applications with a single language and a single stack.&lt;/p&gt;

&lt;p&gt;For those looking to generate static websites, &lt;a href="https://www.gatsbyjs.com/" rel="noopener noreferrer"&gt;&lt;strong&gt;GatsbyJS&lt;/strong&gt;&lt;/a&gt; is a popular choice. It provides a streamlined development experience and fast performance, making it perfect for building static sites with React.&lt;/p&gt;

&lt;p&gt;Lastly, &lt;a href="https://docusaurus.io/" rel="noopener noreferrer"&gt;&lt;strong&gt;Docusaurus&lt;/strong&gt;&lt;/a&gt; is a meta framework designed specifically for creating documentation and blogging websites. It offers a range of customizable themes and built-in features, making it easy for developers to create professional-grade documentation and blogs.&lt;/p&gt;

&lt;p&gt;Overall, the availability of meta frameworks in React ecosystem offers a range of solutions to developers, making it easier to build complex applications with less effort.&lt;/p&gt;

&lt;h2&gt;
  
  
  Netlify Blog
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.netlify.com/" rel="noopener noreferrer"&gt;&lt;strong&gt;Netlify&lt;/strong&gt;&lt;/a&gt;, a widely used hosting platform for static websites and applications, recently published a &lt;a href="https://www.netlify.com/blog/framework-popularity-on-netlify/" rel="noopener noreferrer"&gt;&lt;strong&gt;blog post&lt;/strong&gt;&lt;/a&gt; sharing data on the most &lt;a href="https://www.netlify.com/blog/framework-popularity-on-netlify/" rel="noopener noreferrer"&gt;&lt;strong&gt;popular frameworks and libraries&lt;/strong&gt;&lt;/a&gt; used by developers on their platform. The data revealed that React is the most commonly used framework on Netlify, with over 40% of developers leveraging it for their projects. In addition, the next two most popular frameworks are also based on React, including &lt;a href="https://nextjs.org/" rel="noopener noreferrer"&gt;&lt;strong&gt;NextJS&lt;/strong&gt;&lt;/a&gt; with a 14% share and &lt;a href="https://www.gatsbyjs.com/" rel="noopener noreferrer"&gt;&lt;strong&gt;GatsbyJS&lt;/strong&gt;&lt;/a&gt; with an 8% share. This highlights the widespread popularity and adoption of React in the web development community, particularly for building static websites and applications.&lt;/p&gt;

&lt;h2&gt;
  
  
  New Features
&lt;/h2&gt;

&lt;p&gt;React is a constantly evolving library that is always adding new features to make it easier for developers to build web applications. One of the latest advancements from the React team is the introduction of &lt;a href="https://react.dev/blog/2020/12/21/data-fetching-with-react-server-components" rel="noopener noreferrer"&gt;&lt;strong&gt;zero-bundle-size React Server Components&lt;/strong&gt;&lt;/a&gt;. This feature aims to enable modern UX with a server-driven mental model, making it faster and more efficient to render web pages.&lt;/p&gt;

&lt;p&gt;In addition, React recently announced a brand new compiler called &lt;a href="https://react.dev/blog/2022/06/15/react-labs-what-we-have-been-working-on-june-2022#react-compiler" rel="noopener noreferrer"&gt;&lt;strong&gt;React Forget&lt;/strong&gt;&lt;/a&gt;. This compiler automatically generates the equivalent of &lt;code&gt;useMemo&lt;/code&gt; and &lt;code&gt;useCallback&lt;/code&gt; calls to minimize the cost of re-rendering, while still retaining React's programming model. This means that developers can focus on writing their code, and the compiler will take care of optimizing the performance of the application. With these new features, React continues to push the boundaries of what is possible in web development, making it easier and more efficient to create high-quality applications.&lt;/p&gt;

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

&lt;p&gt;In conclusion, React has become a popular and widely adopted JavaScript library for building modern and dynamic web applications. Its declarative approach, efficient virtual DOM, and extensive ecosystem of third-party libraries have made it a top choice for developers worldwide. With its ongoing evolution and new features being added, React is expected to remain at the forefront of web development for years to come. Whether you're a beginner or an experienced developer, learning React can open up a world of opportunities and help you build cutting-edge applications.&lt;/p&gt;

&lt;h2&gt;
  
  
  Resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Web Dev Simplified &lt;a href="https://www.youtube.com/watch?v=_Wkg3s8_75w" rel="noopener noreferrer"&gt;&lt;strong&gt;Are New Frameworks Replacing React?&lt;/strong&gt;&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;TkDodo's blog &lt;a href="https://tkdodo.eu/blog/why-react-isnt-dying" rel="noopener noreferrer"&gt;&lt;strong&gt;Why React isn't dying&lt;/strong&gt;&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;React's blog &lt;a href="https://react.dev/blog/2022/06/15/react-labs-what-we-have-been-working-on-june-2022" rel="noopener noreferrer"&gt;&lt;strong&gt;React Labs: What we have been working on (June 2022)&lt;/strong&gt;&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Netlify's blog &lt;a href="https://www.netlify.com/blog/framework-popularity-on-netlify/" rel="noopener noreferrer"&gt;&lt;strong&gt;Framework Popularity on Netlify&lt;/strong&gt;&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Closing here 👋👋👋&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This is &lt;strong&gt;Shareef&lt;/strong&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://www.linkedin.com/in/nadeem-shareef-7a8394182/" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fimg.shields.io%2Fbadge%2Flinkedin-%25230077B5.svg%3Fstyle%3Dfor-the-badge%26logo%3Dlinkedin%26logoColor%3Dwhite" alt="LinkedIn"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://twitter.com/shareefBhai99" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fimg.shields.io%2Fbadge%2FTwitter-%25231DA1F2.svg%3Fstyle%3Dfor-the-badge%26logo%3DTwitter%26logoColor%3Dwhite" alt="Twitter"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/shareef/rendering-markdown-made-easy-with-react-markdown-in-reactjs-and-nextjs-web-apps-259d"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fimg.shields.io%2Fbadge%2Fdev.to-0A0A0A%3Fstyle%3Dfor-the-badge%26logo%3Ddev.to%26logoColor%3Dwhite" alt="Dev.to blog"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Why I don't use LinkedIn and Why you should also!</title>
      <dc:creator>Mohammed Nadeem Shareef</dc:creator>
      <pubDate>Thu, 05 May 2022 12:36:09 +0000</pubDate>
      <link>https://forem.com/shareef/why-i-dont-use-linkedin-and-why-you-should-also-4k52</link>
      <guid>https://forem.com/shareef/why-i-dont-use-linkedin-and-why-you-should-also-4k52</guid>
      <description>&lt;p&gt;&lt;strong&gt;Hello Developers 🖐🖐&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In this article, I'm discussing why I don't use LinkedIn much and why you should also stop using it. LinkedIn is used by millions of humans, as I am a developer I can only write about the perspective of a developer. Disclaimer everything in this article will be from the point of view of a developer.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why you should have a LinkedIn account.
&lt;/h3&gt;

&lt;p&gt;First and foremost, let's discuss why everybody tells you to have a LinkedIn account.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;You will gain exposure to Hiring Managers and Recruiters&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;You will get offers from your LinkedIn profile.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;You will get to know about Job Postings.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;You can gain social proof of your skills and talents&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;LinkedIn can help rank your name on Google&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These points seem fair and promising, but this is not the reality of LinkedIn today.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Reality Check 🙀 !
&lt;/h3&gt;

&lt;p&gt;It's all fake, fake, and fake. Yeah, you heard me right. It's all fake, what I see whenever I open my LinkedIn. MOTIVATION, Some random dude did some small thing and shared it by over-exaggeration, someone likes or comments on something, random job posting, which I would never apply to.&lt;/p&gt;

&lt;h3&gt;
  
  
  What I hate about LinkedIn
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;MOTIVATION, the number of motivational quotes that are there in my feed just makes me irritating. There are more people wanting to motivate than the number of people who want to get motivated.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Job alerts, I wonder who is posting tens of jobs on a daily basis. And the information about the job is useless. They want you to have the knowledge of all the programming languages from the time they are made 🙂🙂🙂. And the cherry on the cake it the pay range is not disclosed by the company. If the employers of LinkedIn read my blog (It will not reach them probably) please make the requirement limited and make the pay range mandatory.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Some likes or comments on something. For the sake of humanity I don't want to know what my connections are linking and commenting on, please just remove this feature or make it an optional feature so that people who want it can enable it (Hopefully no one wants to).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It's all fake. There is no measure to check if something is fake or not. For instance, I have added in my experience that I am working at Google as a Frontend Architecture from Jan 2020 and It is showing on my profile. Check it &lt;a href="https://www.linkedin.com/in/nadeem-shareef-7a8394182/"&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;I could go on like this for hours, but I think you get my point.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Alternatives of LinkedIn.
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Github. Github is a great website to show your coding experience and your consistency through daily commits. However, it is only limited to developers.&lt;/li&gt;
&lt;li&gt;Dev Community. Dev.to is a great blogging site, and I get plenty of offers from my Dev profile.&lt;/li&gt;
&lt;li&gt;Hashnode. It is also a blogging site. It offers a lot of features free of cost.&lt;/li&gt;
&lt;li&gt;Twitter. I don't promote Twitter as much as Github and Dev, but I would say it is better than LinkedIn.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let me know what are your thoughts, agree, or disagree. Let me know in the comments.&lt;/p&gt;

&lt;p&gt;Closing here&lt;br&gt;
This is &lt;strong&gt;shareef&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;My &lt;a href="https://portfolio.shareef.vercel.app/"&gt;Portfolio&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Twitter &lt;a href="https://twitter.com/shareefBhai99"&gt;ShareefBhai99&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.linkedin.com/in/nadeem-shareef-7a8394182/"&gt;Linkedin&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>discuss</category>
      <category>webdev</category>
      <category>career</category>
      <category>showdev</category>
    </item>
    <item>
      <title>Bye, Bye, Captcha!</title>
      <dc:creator>Mohammed Nadeem Shareef</dc:creator>
      <pubDate>Thu, 28 Apr 2022 10:02:06 +0000</pubDate>
      <link>https://forem.com/shareef/bye-bye-captcha-3no</link>
      <guid>https://forem.com/shareef/bye-bye-captcha-3no</guid>
      <description>&lt;h3&gt;
  
  
  A quick history about Captcha.
&lt;/h3&gt;

&lt;p&gt;CAPTCHA is an abbreviation for &lt;strong&gt;C&lt;/strong&gt;ompletely &lt;strong&gt;A&lt;/strong&gt;utomated &lt;strong&gt;P&lt;/strong&gt;ublic &lt;strong&gt;T&lt;/strong&gt;uring &lt;strong&gt;T&lt;/strong&gt;est to &lt;strong&gt;T&lt;/strong&gt;ell &lt;strong&gt;C&lt;/strong&gt;omputers and &lt;strong&gt;H&lt;/strong&gt;umans &lt;strong&gt;A&lt;/strong&gt;part. &lt;em&gt;Well, quite a long name&lt;/em&gt;. It was created to separate Bots from Humans. Initially, it was successful, but as humans fill in more and more Captchas, scammers use machine learning to catch up with the Captcha tests making captcha tests more difficult.&lt;/p&gt;

&lt;h3&gt;
  
  
  Captcha are everywhere on the internet.
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Signup for any website. &lt;strong&gt;CAPTCHA&lt;/strong&gt;!&lt;/li&gt;
&lt;li&gt;Buying anything online. &lt;strong&gt;CAPTCHA&lt;/strong&gt;!&lt;/li&gt;
&lt;li&gt;Logging in on social media. &lt;strong&gt;CAPTCHA&lt;/strong&gt;!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LnKcwdXW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1650630544933/7421ckrXW.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LnKcwdXW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1650630544933/7421ckrXW.jpg" alt="captcha 4.jpg" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Well, now say bye-bye to CAPTCHAs and welcome to &lt;a href="https://2captcha.com/"&gt;2captcha&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;2captcha is a service that bypasses captchas for you. They use humans to solve captchas. 2Captcha is a human-powered image and CAPTCHA recognition service. The main purpose of it is to solve CAPTCHAS in a quick and accurate manner by human employees so that customers get instant access to a website that they are trying to access.&lt;/p&gt;

&lt;h3&gt;
  
  
  Human-powered CAPTCHA-solving service
&lt;/h3&gt;

&lt;p&gt;2Captcha team solves your CAPTCHA with high accuracy. &lt;br&gt;
To start using the service:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Register&lt;/li&gt;
&lt;li&gt;Implement API&lt;/li&gt;
&lt;li&gt;Send your CAPTCHAs&lt;/li&gt;
&lt;li&gt;Get your answer as a text.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It’s quick and easy! 2Captcha provides low prices and high accuracy for your CAPTCHAs.&lt;/p&gt;

&lt;h3&gt;
  
  
  2Captcha for everyone.
&lt;/h3&gt;

&lt;p&gt;2Captcha service is not limited to customers. They provide APIs in most programming languages.&lt;br&gt;
Developers can easily implement 2Chaptcha API in their applications.&lt;/p&gt;

&lt;p&gt;There are a few steps for solving the captcha problem and they are as follows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;simply send your image or captcha to their servers &lt;/li&gt;
&lt;li&gt;Get the ID of your task by 2Captcha &lt;/li&gt;
&lt;li&gt;Begin the cycle that checks if your task is completed.&lt;/li&gt;
&lt;li&gt;Get the result instantly in mere just seconds.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/channel/UC_uHJbHt_zH89w4gKGC1sdw"&gt;Check out their YouTube channel&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://akhromieiev.com/how-to-bypass-captcha-in-nodejs-using-2captcha/"&gt;Blogs on implementation of their API&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  All Captchas are solved here
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Normal Captcha&lt;/li&gt;
&lt;li&gt;Text Captcha&lt;/li&gt;
&lt;li&gt;Click Captcha&lt;/li&gt;
&lt;li&gt;Rotate Captcha&lt;/li&gt;
&lt;li&gt;reCaptcha V2&lt;/li&gt;
&lt;li&gt;And a lot more&lt;/li&gt;
&lt;li&gt;&lt;a href="https://2captcha.com/"&gt;See all here&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Let money decide
&lt;/h3&gt;

&lt;p&gt;Now you do know 2captcha is cool, but what about money? How much do you have to pay for 2Captcha services?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pS9DSi-Y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1650638241371/-8Yb0nVMy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pS9DSi-Y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1650638241371/-8Yb0nVMy.png" alt="image.png" width="800" height="271"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>The correct way of asking questions.</title>
      <dc:creator>Mohammed Nadeem Shareef</dc:creator>
      <pubDate>Fri, 22 Apr 2022 15:54:19 +0000</pubDate>
      <link>https://forem.com/shareef/the-correct-way-of-asking-questions-3239</link>
      <guid>https://forem.com/shareef/the-correct-way-of-asking-questions-3239</guid>
      <description>&lt;p&gt;&lt;strong&gt;Hello Developers&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I am an intermediate developer. I had great mentors to whom I could ask any question and they would help me. Now, as time passes I get many questions from the juniors, but I think they lack the ability to ask a question properly. Well, you might ask who I am to lecture on this topic? I learned basically everything from asking questions and googling stuff.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try to google before asking the question.
&lt;/h2&gt;

&lt;p&gt;Google is an essential skill for any developer/programmer. Whenever you are struck first approve Google.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example
&lt;/h3&gt;

&lt;p&gt;Before Googling&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You:&lt;/strong&gt; How should I pass a child state to a parent state?.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Mentor:&lt;/strong&gt; Have you googled it?.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You:&lt;/strong&gt; No...&lt;/p&gt;

&lt;p&gt;After Googling&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You:&lt;/strong&gt; I am unable to pass child state to parent state. I googled it and it says [this] and [this].  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Mentor:&lt;/strong&gt; Okay, do [this] and refer to [this] article.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tell us the real problem.
&lt;/h2&gt;

&lt;p&gt;Okay, let's say you are working on the front-end part of the project, and upon fetching data from the API you run into a CORS error. You google it and are still unable to solve it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example
&lt;/h3&gt;

&lt;p&gt;before not mentioning the real problem.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You:&lt;/strong&gt; I am trying to solve the CORS error and I did [this] and [this].&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Mentor:&lt;/strong&gt; CORS are tricky. I can't exactly solve your problem.&lt;/p&gt;

&lt;p&gt;After mentioning the real problem.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You:&lt;/strong&gt; While fetching the data from the API, I ran into a CORS error and I did [this] and [this].&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Mentor:&lt;/strong&gt; Maybe the API is not handling requests properly. Submit the response and logs to the backend team.&lt;/p&gt;

&lt;h2&gt;
  
  
  Some tips.
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Try to solve before asking the question.&lt;/li&gt;
&lt;li&gt;Google, Google, and Google.&lt;/li&gt;
&lt;li&gt;Ask the real question, not the solution you are working on.&lt;/li&gt;
&lt;li&gt;If you are stuck on a problem for too long, take a break.&lt;/li&gt;
&lt;li&gt;And above all, ask the question.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;HappyCoding&lt;/strong&gt;&lt;br&gt;
This is &lt;a href="https://shareef.hashnode.dev/"&gt;Shareef&lt;/a&gt;&lt;br&gt;
&lt;a href="https://twitter.com/shareefBhai99"&gt;My Twitter&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.linkedin.com/in/nadeem-shareef-7a8394182/"&gt;My Linkedin&lt;/a&gt;&lt;/p&gt;

</description>
      <category>questions</category>
      <category>mentoring</category>
      <category>webdev</category>
      <category>discuss</category>
    </item>
    <item>
      <title>How to publish a CLI tool on NPM</title>
      <dc:creator>Mohammed Nadeem Shareef</dc:creator>
      <pubDate>Fri, 15 Apr 2022 11:07:26 +0000</pubDate>
      <link>https://forem.com/shareef/how-to-publish-a-cli-tool-on-npm-j3p</link>
      <guid>https://forem.com/shareef/how-to-publish-a-cli-tool-on-npm-j3p</guid>
      <description>&lt;p&gt;&lt;strong&gt;Hello Developers 🙌🙌🙌&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Recently I wanted to create a CLI tool, but I only know JavaScript, so I researched and found out that we can create CLI applications using JavaScript. I published my CLI tool named &lt;em&gt;track-task&lt;/em&gt; and will show you how to publish a package in NPM. You can download and use it.&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 -g track-task
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  How to publish NPM package?
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Step 1:-&lt;/strong&gt; Initialize &lt;em&gt;npm&lt;/em&gt; by &lt;code&gt;npm init -y&lt;/code&gt;&lt;br&gt;
It will create a default package.json file, which will look something like&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"track-task"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"1.0.0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"description"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"main"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"index.js"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"scripts"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"test"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"echo &lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;Error: no test specified&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt; &amp;amp;&amp;amp; exit 1"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"keywords"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"author"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"license"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"ISC"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Points to note here&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Name should be unique, otherwise it will throw error while publishing.&lt;/li&gt;
&lt;li&gt;Start with version 1.0.0 and remember to update to version whenever you make changes to your code.&lt;/li&gt;
&lt;li&gt;Add a bin as &lt;code&gt;" bin "./index.js"&lt;/code&gt; from this point your code will run.&lt;/li&gt;
&lt;li&gt;Add keywords and author name to stand out.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 2:-&lt;/strong&gt; Code your application.&lt;br&gt;
Code your whole application and test it out locally and make sure to add &lt;code&gt;#! /usr/bin/env node&lt;/code&gt;, it makes your file executable.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3:-&lt;/strong&gt; Add more info to package.json.&lt;br&gt;
Add repository, bugs and homepage urls&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="err"&gt;...&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"repository"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"git"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"url"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"git+https://github.com/shareef99/task-tracker.git"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"bugs"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"url"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://github.com/shareef99/task-tracker/issues"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"homepage"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://github.com/shareef99/task-tracker/#readme"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 4:-&lt;/strong&gt; Publishing your CLI tool&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create &lt;em&gt;npm account&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;Login into npm account from terminal.
&lt;/li&gt;
&lt;/ul&gt;

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Enter the username and password.&lt;/li&gt;
&lt;li&gt;Make sure you are ready to publish.&lt;/li&gt;
&lt;li&gt;Publish your package.
&lt;/li&gt;
&lt;/ul&gt;

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;em&gt;Congratulations ✨✨✨ You have published the npm package.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 5:-&lt;/strong&gt; Updating package.&lt;br&gt;
Don't forget to change the version of in package.json file after update your code. Once you are done with the coding, run &lt;code&gt;npm publish&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Thanks and Happy Coding&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Closing here 👋👋👋&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This is &lt;strong&gt;Shareef&lt;/strong&gt;.&lt;br&gt;
My &lt;a href="https://portfolio.shareef.vercel.app/"&gt;Portfolio&lt;/a&gt;&lt;br&gt;
Twitter &lt;a href="https://twitter.com/shareefBhai99"&gt;ShareefBhai99&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.linkedin.com/in/nadeem-shareef-7a8394182/"&gt;Linkedin&lt;/a&gt;&lt;br&gt;
My &lt;a href="https://dev.to/shareef"&gt;other Blogs&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>npm</category>
      <category>javascript</category>
      <category>tooling</category>
      <category>showdev</category>
    </item>
    <item>
      <title>How to hide password value in inspect using React and Formik</title>
      <dc:creator>Mohammed Nadeem Shareef</dc:creator>
      <pubDate>Mon, 06 Dec 2021 16:56:04 +0000</pubDate>
      <link>https://forem.com/shareef/how-to-hide-password-value-in-inspect-using-react-and-formik-4a8n</link>
      <guid>https://forem.com/shareef/how-to-hide-password-value-in-inspect-using-react-and-formik-4a8n</guid>
      <description>&lt;p&gt;&lt;strong&gt;Hello Developers 🤩🤩&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Have you ever logged in to Facebook?&lt;br&gt;
Have you ever inspected the Facebook login page?&lt;br&gt;
If not go to &lt;a href="https://www.facebook.com/"&gt;Facebook&lt;/a&gt; and try inspecting it, you will find the value of the password filed is not showing.&lt;/p&gt;

&lt;p&gt;We will replicate that behavior using React and Formik.&lt;/p&gt;
&lt;h3&gt;
  
  
  Creating Project
&lt;/h3&gt;


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

&lt;/div&gt;


&lt;p&gt;After project setup, install formik.&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 formik --save
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Basic setup
&lt;/h3&gt;

&lt;p&gt;Setup a basic template for email and password input with submit button.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useFormik&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;formik&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;App&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;form&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;input&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"email"&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"email"&lt;/span&gt; &lt;span class="na"&gt;placeholder&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"email"&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
            &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;input&lt;/span&gt; 
                &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"password"&lt;/span&gt;
                &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"password"&lt;/span&gt;
                &lt;span class="na"&gt;placeholder&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"password"&lt;/span&gt;
            &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
            &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"submit"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Submit&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;form&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;App&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Implementing Formik
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useFormik&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;formik&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;App&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;handleSubmit&lt;/span&gt; &lt;span class="o"&gt;=&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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;values&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;formik&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useFormik&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
        &lt;span class="na"&gt;initialValues&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="na"&gt;email&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="na"&gt;password&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="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;

    &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;form&lt;/span&gt;
            &lt;span class="na"&gt;onSubmit&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&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="nf"&gt;handleSubmit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;formik&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="p"&gt;}&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;input&lt;/span&gt;
                &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"email"&lt;/span&gt;
                &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"email"&lt;/span&gt;
                &lt;span class="na"&gt;placeholder&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"email"&lt;/span&gt;
                &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;formik&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getFieldProps&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;email&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
            &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
            &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;input&lt;/span&gt;
                &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"password"&lt;/span&gt;
                &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"password"&lt;/span&gt;
                &lt;span class="na"&gt;placeholder&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"password"&lt;/span&gt;
                &lt;span class="na"&gt;onChange&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;formik&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;handleChange&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
                &lt;span class="na"&gt;onBlur&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;formik&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;handleBlur&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
            &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
            &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"submit"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Submit&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;form&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;App&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now check the value in Inspect.&lt;br&gt;
&lt;strong&gt;Kaboom 🔥🔥🔥&lt;/strong&gt;&lt;br&gt;
No value in Inspect.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://39ph6.csb.app"&gt;Live Preview&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Closing here 👋👋👋&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;a href="https://github.com/shareef99/blogs/tree/master/hide-password-value"&gt;Github Code Repo&lt;/a&gt;&lt;br&gt;
This is &lt;strong&gt;Shareef&lt;/strong&gt;.&lt;br&gt;
My recent project &lt;a href="https://yourounotes.vercel.app/"&gt;yourounotes&lt;/a&gt;&lt;br&gt;
My &lt;a href="https://portfolio.shareef.vercel.app/"&gt;Portfolio&lt;/a&gt;&lt;br&gt;
Twitter &lt;a href="https://twitter.com/shareefBhai99"&gt;ShareefBhai99&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.linkedin.com/in/nadeem-shareef-7a8394182/"&gt;Linkedin&lt;/a&gt;&lt;br&gt;
My &lt;a href="https://dev.to/shareef"&gt;other Blogs&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>Upgrade to firebase V9 NOW!!!</title>
      <dc:creator>Mohammed Nadeem Shareef</dc:creator>
      <pubDate>Mon, 29 Nov 2021 14:34:32 +0000</pubDate>
      <link>https://forem.com/shareef/upgrade-to-firebase-v9-now-1l6p</link>
      <guid>https://forem.com/shareef/upgrade-to-firebase-v9-now-1l6p</guid>
      <description>&lt;p&gt;&lt;strong&gt;Hello Developers 👋👋&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Firebase V9 is here and it is awesome...&lt;/p&gt;

&lt;p&gt;I upgraded my project &lt;a href="https://yourounotes.vercel.app/"&gt;yourounotes&lt;/a&gt; to firebase V9 and the results were impressive&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7MSyVjBP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://i.pinimg.com/originals/6e/46/6c/6e466cb0d3df7f082596fef171d6d370.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7MSyVjBP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://i.pinimg.com/originals/6e/46/6c/6e466cb0d3df7f082596fef171d6d370.jpg" alt="Firebase" width="735" height="387"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Responses time drop from 2s to 307ms, 85% faster.&lt;/p&gt;

&lt;p&gt;I go all in and update everything, from auth, to firestore, to firebase storage...&lt;/p&gt;

&lt;p&gt;I ran into many bugs and I have to read a lot of documentation and it was all worth it in the end.&lt;/p&gt;

&lt;p&gt;I am writing blogs on almost everything related to firebase&lt;/p&gt;

&lt;p&gt;Started last week with auth.&lt;/p&gt;

&lt;p&gt;Read &lt;a href="https://dev.to/shareef/firebase-v9-login-with-google-in-react-and-nextjs-426m"&gt;how to add google login functionality with firebase V9&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Would love to read about your experience with firebase V9.&lt;/p&gt;

&lt;p&gt;Closing here 👋👋👋&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This is &lt;strong&gt;Shareef&lt;/strong&gt;.&lt;br&gt;
My recent project &lt;a href="https://yourounotes.vercel.app/"&gt;yourounotes&lt;/a&gt;&lt;br&gt;
My &lt;a href="https://portfolio.shareef.vercel.app/"&gt;Portfolio&lt;/a&gt;&lt;br&gt;
Twitter &lt;a href="https://twitter.com/shareefBhai99"&gt;ShareefBhai99&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.linkedin.com/in/nadeem-shareef-7a8394182/"&gt;Linkedin&lt;/a&gt;&lt;br&gt;
My &lt;a href="https://dev.to/shareef"&gt;other Blogs&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

</description>
    </item>
    <item>
      <title>Convert Excel to JSON in ReactJS in just 2 steps</title>
      <dc:creator>Mohammed Nadeem Shareef</dc:creator>
      <pubDate>Tue, 23 Nov 2021 15:20:54 +0000</pubDate>
      <link>https://forem.com/shareef/convert-excel-to-json-in-reactjs-in-just-2-steps-4pa1</link>
      <guid>https://forem.com/shareef/convert-excel-to-json-in-reactjs-in-just-2-steps-4pa1</guid>
      <description>&lt;p&gt;&lt;strong&gt;Hello Developers 🙌&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Today we will see how to convert Excel to JSON&lt;/p&gt;

&lt;p&gt;We will use &lt;code&gt;xlsx&lt;/code&gt; package.&lt;/p&gt;

&lt;p&gt;No more talking let's jump into the coding part.&lt;/p&gt;

&lt;h3&gt;
  
  
  Install &lt;code&gt;xlsx&lt;/code&gt; package
&lt;/h3&gt;



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

&lt;/div&gt;



&lt;h3&gt;
  
  
  Create a basic structure for file upload
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;
&lt;span class="nt"&gt;&amp;lt;form&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;label&lt;/span&gt; &lt;span class="na"&gt;htmlFor=&lt;/span&gt;&lt;span class="s"&gt;"upload"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Upload File&lt;span class="nt"&gt;&amp;lt;/label&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt;
        &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"file"&lt;/span&gt;
        &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"upload"&lt;/span&gt;
        &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"upload"&lt;/span&gt;
        &lt;span class="na"&gt;onChange=&lt;/span&gt;&lt;span class="s"&gt;{readUploadFile}&lt;/span&gt;
    &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/form&amp;gt;&lt;/span&gt;

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

&lt;/div&gt;



&lt;h3&gt;
  
  
  Convert Excel file to JSON
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;readUploadFile&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="k"&gt;if &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="nx"&gt;target&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;files&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;reader&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;FileReader&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
        &lt;span class="nx"&gt;reader&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;onload&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;result&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;workbook&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;xlsx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read&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="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;array&lt;/span&gt;&lt;span class="dl"&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;sheetName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;workbook&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;SheetNames&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
            &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;worksheet&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;workbook&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Sheets&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;sheetName&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;json&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;xlsx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;utils&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sheet_to_json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;worksheet&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="p"&gt;};&lt;/span&gt;
        &lt;span class="nx"&gt;reader&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;readAsArrayBuffer&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="nx"&gt;target&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;files&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="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;Kaboom!🔥 in just two simple steps, you can convert Excel to JSON&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;HappyCoding&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Closing here 👋👋👋&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This is &lt;strong&gt;Shareef&lt;/strong&gt;.&lt;br&gt;
My recent project &lt;a href="https://yourounotes.vercel.app/"&gt;yourounotes&lt;/a&gt;&lt;br&gt;
My &lt;a href="https://portfolio.shareef.vercel.app/"&gt;Portfolio&lt;/a&gt;&lt;br&gt;
Twitter &lt;a href="https://twitter.com/shareefBhai99"&gt;ShareefBhai99&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.linkedin.com/in/nadeem-shareef-7a8394182/"&gt;Linkedin&lt;/a&gt;&lt;br&gt;
My &lt;a href="https://dev.to/shareef"&gt;other Blogs&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>tutorial</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Firebase V9 LogIn with Google in React and NextJS</title>
      <dc:creator>Mohammed Nadeem Shareef</dc:creator>
      <pubDate>Sun, 07 Nov 2021 15:49:08 +0000</pubDate>
      <link>https://forem.com/shareef/firebase-v9-login-with-google-in-react-and-nextjs-426m</link>
      <guid>https://forem.com/shareef/firebase-v9-login-with-google-in-react-and-nextjs-426m</guid>
      <description>&lt;p&gt;The easiest way to add authentication to your web app is through Firebase authentication.&lt;/p&gt;

&lt;p&gt;Before continuing with adding authentication, make sure to add firebase to your project. And I am using Context API as we need authentication on every page of the web app.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The blog doesn't show how to setup context. You can see my other blog on &lt;a href="https://dev.to/shareef/context-api-with-typescript-and-next-js-2m25"&gt;ContextAPI using NextJS and TypeScript&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Enough of talking, Let's get started.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Install firebase
&lt;/h3&gt;



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

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. Firebase setup
&lt;/h3&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="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;initializeApp&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;getApps&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;firebase/app&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;getAuth&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;firebase/auth&lt;/span&gt;&lt;span class="dl"&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;firebaseConfig&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;apiKey&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;apiKey&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;authDomain&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;authDomain&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;projectId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;projectID&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;storageBucket&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;storageBucket&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;messagingSenderId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;messagingSenderID&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;appId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;appID&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;measurementId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;measurementID&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nf"&gt;getApps&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="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;initializeApp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;firebaseConfig&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;auth&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;getAuth&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;firebaseConfig&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;here we are initializing the firebase app then exporting the getAuth function as auth.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Setting up auth functionality
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="c1"&gt;//Inside the AuthContext file.&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;GoogleAuthProvider&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;signInWithPopup&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;firebase/auth&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;auth&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;../firebase&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// Inside AuthProvider&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;provider&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;GoogleAuthProvider&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;login&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;signInWithPopup&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;auth&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;provider&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;result&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="c1"&gt;// This gives you a Google Access Token. You can use it to access the Google API.&lt;/span&gt;
            &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;credential&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;GoogleAuthProvider&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;credentialFromResult&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;result&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;token&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;credential&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;accessToken&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="c1"&gt;// The signed-in user info.&lt;/span&gt;
            &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;credential&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;token&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;user&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="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;error&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="c1"&gt;// Handle Errors here.&lt;/span&gt;
            &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;errorCode&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;code&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;errorMessage&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="c1"&gt;// The email of the user's account used.&lt;/span&gt;
            &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;email&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;email&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="c1"&gt;// The AuthCredential type that was used.&lt;/span&gt;
            &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;credential&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;GoogleAuthProvider&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;credentialFromError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;errorCode&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;errorMessage&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;email&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;credential&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;logout&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="nx"&gt;auth&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;signOut&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;logout&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;


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

&lt;/div&gt;



&lt;p&gt;Now as login and logout functions are ready, It's time to use them.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Implementing login and logout functionality
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;
&lt;span class="c1"&gt;// Import useAuth from context&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;useAuth&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;../context/AuthContext&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// Destructure login and logout functions.&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;login&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;logout&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useAuth&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

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

&lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="na"&gt;onClick&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;login&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; Login &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="na"&gt;onClick&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;logout&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; Logout &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;Login and Logout functions are not enough, we also need to listen if the used is login or not, on their next visit.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Listening to the auth state.
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Inside Context.&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;useEffect&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&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;onAuthStateChanged&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;firebase/auth&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&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="nf"&gt;onAuthStateChanged&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;auth&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&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;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&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;uid&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;uid&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;uid&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&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;no user&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="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;Thanks for reading, I have used ContextAPI here, you can read my blog on &lt;a href="https://dev.to/shareef/context-api-with-typescript-and-next-js-2m25"&gt;ContextAPI with NextJS and TypeScript&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Closing here 👋👋👋&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This is &lt;strong&gt;Shareef&lt;/strong&gt;.&lt;br&gt;
My recent project &lt;a href="https://yourounotes.vercel.app/"&gt;yourounotes&lt;/a&gt;&lt;br&gt;
My &lt;a href="https://portfolio.shareef.vercel.app/"&gt;Portfolio&lt;/a&gt;&lt;br&gt;
Twitter &lt;a href="https://twitter.com/shareefBhai99"&gt;ShareefBhai99&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.linkedin.com/in/nadeem-shareef-7a8394182/"&gt;Linkedin&lt;/a&gt;&lt;br&gt;
My &lt;a href="https://dev.to/shareef"&gt;other Blogs&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>webdev</category>
      <category>react</category>
      <category>javascript</category>
      <category>firebase</category>
    </item>
    <item>
      <title>DBMS Employee and Department</title>
      <dc:creator>Mohammed Nadeem Shareef</dc:creator>
      <pubDate>Mon, 25 Oct 2021 18:42:45 +0000</pubDate>
      <link>https://forem.com/shareef/dbms-employee-and-department-3j8a</link>
      <guid>https://forem.com/shareef/dbms-employee-and-department-3j8a</guid>
      <description>&lt;h2&gt;
  
  
  Solution
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Creating department table.&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;
&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;DEPARTMENT&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;DEPTNO&lt;/span&gt; &lt;span class="n"&gt;NUMBER&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;CONSTRAINT&lt;/span&gt; &lt;span class="n"&gt;DEPARTMENT_DEPTNO_PK&lt;/span&gt; &lt;span class="k"&gt;PRIMARY&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;DEPTNAME&lt;/span&gt; &lt;span class="n"&gt;VARCHAR2&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;CONSTRAINT&lt;/span&gt; &lt;span class="n"&gt;DEPARTMENT_DEPTNAME_UN&lt;/span&gt; &lt;span class="k"&gt;UNIQUE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;LOCATION&lt;/span&gt; &lt;span class="nb"&gt;CHAR&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="k"&gt;CONSTRAINT&lt;/span&gt; &lt;span class="n"&gt;DEPARTMENT_LOCATION_NN&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Creating employee table.&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;
&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;EMPLOYEE&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;EMPNO&lt;/span&gt; &lt;span class="n"&gt;NUMBER&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;CONSTRAINT&lt;/span&gt; &lt;span class="n"&gt;EMPLOYEE_EMPNO_PK&lt;/span&gt; &lt;span class="k"&gt;PRIMARY&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;EMPNAME&lt;/span&gt; &lt;span class="n"&gt;VARCHAR2&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;CONSTRAINT&lt;/span&gt; &lt;span class="n"&gt;EMPLOYEE_EMPNAME_UN&lt;/span&gt; &lt;span class="k"&gt;UNIQUE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;DEPTNO&lt;/span&gt; &lt;span class="n"&gt;NUMBER&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;CONSTRAINT&lt;/span&gt; &lt;span class="n"&gt;EMPLOYEE_DEPTNO_BR&lt;/span&gt; &lt;span class="k"&gt;REFERENCES&lt;/span&gt; &lt;span class="n"&gt;DEPARTMENT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;DEPTNO&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="n"&gt;MANAGER&lt;/span&gt; &lt;span class="n"&gt;NUMBER&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;CONSTRAINT&lt;/span&gt; &lt;span class="n"&gt;EMPLOYEE_MANAGER_SR&lt;/span&gt; &lt;span class="k"&gt;REFERENCES&lt;/span&gt; &lt;span class="n"&gt;EMPLOYEE&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;EMPNO&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;&lt;strong&gt;Inserting values into department table&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;
&lt;span class="k"&gt;INSERT&lt;/span&gt; &lt;span class="k"&gt;INTO&lt;/span&gt; &lt;span class="n"&gt;DEPARTMENT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;DEPTNO&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;DEPTNAME&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;LOCATION&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;VALUES&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;DEPTNO&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;DEPTNAME&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="k"&gt;LOCATION&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

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

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;press "/" for inserting second record and so on.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Inserting values into employee table&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;
&lt;span class="k"&gt;INSERT&lt;/span&gt; &lt;span class="k"&gt;INTO&lt;/span&gt; &lt;span class="n"&gt;EMPLOYEE&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;EMPNO&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;EMPNAME&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;DEPTNO&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;MANAGER&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;VALUES&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;EMPNO&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;EMPNAME&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;DEPTNO&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;MANAGER&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

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

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;press "/" for inserting second record and so on.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;Program is completed here, we have created both the tables and relationship between them.&lt;/li&gt;
&lt;li&gt;To show the department table
&lt;code&gt;sql SELECT * FROM DEPARTMENT&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;To show the employee table &lt;code&gt;sql SELECT * FROM EMPLOYEE&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;To show both the table
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;DEPARTMENT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;EMPLOYEE&lt;/span&gt; &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;DEPARTMENT&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;DEPTNO&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;EMPLOYEE&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;DEPTNO&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;First Question&lt;br&gt;
&lt;a href="https://dev.to/shareef/dbms-student-table-5gga"&gt;DBMS Student Table&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Closing here 👋👋👋&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This is &lt;strong&gt;Shareef&lt;/strong&gt;.&lt;br&gt;
My recent project &lt;a href="https://yourounotes.vercel.app/"&gt;yourounotes&lt;/a&gt;&lt;br&gt;
My &lt;a href="https://portfolio.shareef.vercel.app/"&gt;Portfolio&lt;/a&gt;&lt;br&gt;
Twitter &lt;a href="https://twitter.com/shareefBhai99"&gt;ShareefBhai99&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.linkedin.com/in/nadeem-shareef-7a8394182/"&gt;Linkedin&lt;/a&gt;&lt;br&gt;
My &lt;a href="https://dev.to/shareef"&gt;other Blogs&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>dbms</category>
      <category>sql</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
