<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Chukwuemeka Abuba</title>
    <description>The latest articles on DEV Community by Chukwuemeka Abuba (@chukeumeka_abuba).</description>
    <link>https://dev.to/chukeumeka_abuba</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%2F1962063%2Fd408cf83-3676-4038-9191-b498d9f0d6d8.jpeg</url>
      <title>DEV Community: Chukwuemeka Abuba</title>
      <link>https://dev.to/chukeumeka_abuba</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/chukeumeka_abuba"/>
    <language>en</language>
    <item>
      <title>An Introduction to React Router - A Beginner’s Guide</title>
      <dc:creator>Chukwuemeka Abuba</dc:creator>
      <pubDate>Sat, 24 Aug 2024 09:08:22 +0000</pubDate>
      <link>https://dev.to/chukeumeka_abuba/an-introduction-to-react-router-a-beginners-guide-dc3</link>
      <guid>https://dev.to/chukeumeka_abuba/an-introduction-to-react-router-a-beginners-guide-dc3</guid>
      <description>&lt;h2&gt;
  
  
  Introducing React Router
&lt;/h2&gt;

&lt;p&gt;React router is one of React's important libraries for creating amazing UI. It allows users to navigate between web pages without reloading the page or interacting with the server. Since React framework doesn’t come with an inbuilt routing feature, react router is the solution and most used.&lt;/p&gt;

&lt;p&gt;In traditional websites that are not single-page applications, when we click on a link on the website, it sends a request to a server for a brand new HTML page. React works with SPAs (single-page applications), that handle all of the browser's routing on the frontend and don't send any additional requests to the server for a new page.&lt;/p&gt;

&lt;p&gt;In this tutorial, we will learn the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;About React router&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;How to install React router&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Using React router in routing between pages.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;To be able to install and use React router, the reader should have the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Node installed on their local development machine&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Knowledge of using React&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A basic knowledge of HTML, CSS, JavaScript&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It is assumed that the reader has basic knowledge of using React and can create components.&lt;/p&gt;

&lt;p&gt;There are four important tags needed to create a basic React router in our React application: BrowserRouter, Routes, Route, and Link.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;BrowserRouter: It's a component that wraps our entire application and allows us to use the routes within it.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Routes and Route: These are the modules that allows us to set up routes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Link/NavLink: We use this to create links between pages.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We will learn about implementing the React router in our application by creating a simple React application. Go to your preferred CMD and code editor terminal to create a React application &lt;code&gt;router-tutorial&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;The command will create a React application called router-tutorial. Then switch to in the app directory, using cd router-tutorial in your code editor and run the command bellow:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  Getting Started
&lt;/h2&gt;

&lt;p&gt;For this tutorial, we will be using three components: Home, About, and User. Within the src folder, we will create a folder called pages and add the files; Home, About, and User to it. For this example, I will use version 6.4.&lt;/p&gt;

&lt;p&gt;To install React router, go to your code editor terminal, and in the root directory of your project, type:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install react-router-dom@6.4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now that our router package is installed, we can start setting it up and adding a few different routes.&lt;/p&gt;

&lt;p&gt;Next, we will install our BrowserRouter module inside our root component and wrap our entire application inside the BrowserRouter component, and inside this component, we will set up our different routes by specifying which component should be rendered for each route.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;App.js :&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { BrowserRouter } from "react-router-dom";

function App() {
  return (
    &amp;lt;BrowserRouter&amp;gt;
      &amp;lt;div className="App"&amp;gt;
        Router Tutorial 
      &amp;lt;/div&amp;gt;
    &amp;lt;/BrowserRouter&amp;gt;
  );
}

export default App
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Inside the div tag is where all our content is rendered when we go to a specific route. Routes are a parent component for multiple different route components. We also import Routes, Route, and Link packages into our root component.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;App.js :&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Next, we create and render different &lt;code&gt;route&lt;/code&gt; inside our routes component. We set up a route component for every route in our application. since we have three routes: Home, About and User route. We also import those &lt;code&gt;route&lt;/code&gt; to our root component so they can be rendered.&lt;/p&gt;

&lt;p&gt;We will create a folder in our &lt;code&gt;src&lt;/code&gt; folder with names as pages and create three files: &lt;code&gt;Home.js&lt;/code&gt;, &lt;code&gt;About.js&lt;/code&gt;, and &lt;code&gt;User.js&lt;/code&gt; inside it. Then go to our root component and import the &lt;code&gt;Home&lt;/code&gt;, &lt;code&gt;About&lt;/code&gt; and &lt;code&gt;User&lt;/code&gt; components into our root component.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;App.js :&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { BrowserRouter, Routes, Route} from "react-router-dom";

//Pages
import Home from "./pages/Home";
import About from "./pages/About";
import User from "./pages/User";

function App() {
  return (
    &amp;lt;BrowserRouter&amp;gt;
      &amp;lt;div className="App"&amp;gt;
        &amp;lt;Routes&amp;gt;
          &amp;lt;Route path="/" element={&amp;lt;Home /&amp;gt;} /&amp;gt;
          &amp;lt;Route path="about" element={&amp;lt;About /&amp;gt;} /&amp;gt;
          &amp;lt;Route path="User" element={&amp;lt;User /&amp;gt;} /&amp;gt;
        &amp;lt;/Routes&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/BrowserRouter&amp;gt;
  );
}

export default App
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each route comes with two props which are, &lt;code&gt;path&lt;/code&gt; and &lt;code&gt;element&lt;/code&gt;. For example, the path in the route component means that if we specify &lt;code&gt;/about&lt;/code&gt;, when we go to or click &lt;code&gt;/about&lt;/code&gt; in our web-page, it matches with the about component and show an element. The element we want to show is the About page. The path for the home page is usually set as &lt;code&gt;/&lt;/code&gt; or &lt;code&gt;index&lt;/code&gt;. in this tutorial we will use backslash &lt;code&gt;/&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Home.js :&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from 'react'

function Home() {
  return (
    &amp;lt;div&amp;gt;
        &amp;lt;div className='home'&amp;gt;
            &amp;lt;h2&amp;gt;Welcome&amp;lt;/h2&amp;gt;
            &amp;lt;p&amp;gt;Lorem ipsum dolor sit amet consectetur adipisicing elit.               
            Qui officiis in, molestias expedita vero pariatur,
            obcaecati, sit consequatur voluptas blanditiis laboriosam       
            velit voluptatem! Magnam corrupti, eos expedita earum
            ratione fugit. Ratione quaerat nam nulla? Vitae doloremque         
            tenetur, laboriosam distinctio, modi animi similique nam,
            totam neque quas obcaecati. Tempora voluptatibus id corporis                             
            dolorum? Cupiditate porro modi cum praesentium?&amp;lt;/p&amp;gt;

            &amp;lt;p&amp;gt;Lorem ipsum dolor sit amet consectetur adipisicing elit. 
            Qui officiis in, molestias expedita vero pariatur,
            obcaecati, sit consequatur voluptas blanditiis laboriosam             
            velit voluptatem! Magnam corrupti, eos expedita earum
            ratione fugit. Ratione quaerat nam nulla? Vitae doloremque 
            tenetur, laboriosam distinctio, modi animi similique nam,
            totam neque quas obcaecati. Tempora voluptatibus id corporis         
            dolorum? Cupiditate porro modi cum praesentium?&amp;lt;/p&amp;gt;

            &amp;lt;p&amp;gt;Lorem ipsum dolor sit amet consectetur adipisicing elit. 
            Qui officiis in, molestias expedita vero pariatur,
            obcaecati, sit consequatur voluptas blanditiis laboriosam 
            velit voluptatem! Magnam corrupti, eos expedita earum
            ratione fugit. Ratione quaerat nam nulla? Vitae doloremque 
            tenetur, laboriosam distinctio, modi animi similique nam,
            totam neque quas obcaecati. Tempora voluptatibus id corporis 
            dolorum? Cupiditate porro modi cum praesentium?&amp;lt;/p&amp;gt;
        &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  )
}

export default Home
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;About.js :&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from 'react'

function About() {
  return (
    &amp;lt;div&amp;gt;
        &amp;lt;div className='about'&amp;gt;
            &amp;lt;h2&amp;gt;Welcome&amp;lt;/h2&amp;gt;
            &amp;lt;p&amp;gt;Lorem ipsum dolor sit amet consectetur adipisicing elit.               
            Qui officiis in, molestias expedita vero pariatur,
            obcaecati, sit consequatur voluptas blanditiis laboriosam       
            velit voluptatem! Magnam corrupti, eos expedita earum
            ratione fugit. Ratione quaerat nam nulla? Vitae doloremque         
            tenetur, laboriosam distinctio, modi animi similique nam,
            totam neque quas obcaecati. Tempora voluptatibus id corporis                             
            dolorum? Cupiditate porro modi cum praesentium?&amp;lt;/p&amp;gt;

            &amp;lt;p&amp;gt;Lorem ipsum dolor sit amet consectetur adipisicing elit. 
            Qui officiis in, molestias expedita vero pariatur,
            obcaecati, sit consequatur voluptas blanditiis laboriosam             
            velit voluptatem! Magnam corrupti, eos expedita earum
            ratione fugit. Ratione quaerat nam nulla? Vitae doloremque 
            tenetur, laboriosam distinctio, modi animi similique nam,
            totam neque quas obcaecati. Tempora voluptatibus id corporis         
            dolorum? Cupiditate porro modi cum praesentium?&amp;lt;/p&amp;gt;

            &amp;lt;p&amp;gt;Lorem ipsum dolor sit amet consectetur adipisicing elit. 
            Qui officiis in, molestias expedita vero pariatur,
            obcaecati, sit consequatur voluptas blanditiis laboriosam 
            velit voluptatem! Magnam corrupti, eos expedita earum
            ratione fugit. Ratione quaerat nam nulla? Vitae doloremque 
            tenetur, laboriosam distinctio, modi animi similique nam,
            totam neque quas obcaecati. Tempora voluptatibus id corporis 
            dolorum? Cupiditate porro modi cum praesentium?&amp;lt;/p&amp;gt;
        &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  )
}

export default About
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;User.js :&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from 'react'

function About() {
  return (
    &amp;lt;div&amp;gt;
        &amp;lt;div className='about'&amp;gt;
            &amp;lt;h2&amp;gt;Welcome&amp;lt;/h2&amp;gt;
            &amp;lt;p&amp;gt;Lorem ipsum dolor sit amet consectetur adipisicing elit.               
            Qui officiis in, molestias expedita vero pariatur,
            obcaecati, sit consequatur voluptas blanditiis laboriosam       
            velit voluptatem! Magnam corrupti, eos expedita earum
            ratione fugit. Ratione quaerat nam nulla? Vitae doloremque         
            tenetur, laboriosam distinctio, modi animi similique nam,
            totam neque quas obcaecati. Tempora voluptatibus id corporis                             
            dolorum? Cupiditate porro modi cum praesentium?&amp;lt;/p&amp;gt;

            &amp;lt;p&amp;gt;Lorem ipsum dolor sit amet consectetur adipisicing elit. 
            Qui officiis in, molestias expedita vero pariatur,
            obcaecati, sit consequatur voluptas blanditiis laboriosam             
            velit voluptatem! Magnam corrupti, eos expedita earum
            ratione fugit. Ratione quaerat nam nulla? Vitae doloremque 
            tenetur, laboriosam distinctio, modi animi similique nam,
            totam neque quas obcaecati. Tempora voluptatibus id corporis         
            dolorum? Cupiditate porro modi cum praesentium?&amp;lt;/p&amp;gt;

            &amp;lt;p&amp;gt;Lorem ipsum dolor sit amet consectetur adipisicing elit. 
            Qui officiis in, molestias expedita vero pariatur,
            obcaecati, sit consequatur voluptas blanditiis laboriosam 
            velit voluptatem! Magnam corrupti, eos expedita earum
            ratione fugit. Ratione quaerat nam nulla? Vitae doloremque 
            tenetur, laboriosam distinctio, modi animi similique nam,
            totam neque quas obcaecati. Tempora voluptatibus id corporis 
            dolorum? Cupiditate porro modi cum praesentium?&amp;lt;/p&amp;gt;
        &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  )
}

export default About
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We will now introduce &lt;code&gt;Link&lt;/code&gt; or the NavLink that we talked about earliar in this tutorial. If the &lt;code&gt;Link&lt;/code&gt; is clicked on, it will look at the route and access the path, if the link matches the element route, it shows that page. We will be using &lt;code&gt;Link&lt;/code&gt; instaed of &lt;code&gt;NavLink&lt;/code&gt; for this tutorial.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;App.js :&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { BrowserRouter, Routes, Route, Link} from "react-router-dom";

//Pages
import Home from "./pages/Home";
import About from "./pages/About";
import User from "./pages/User";

function App() {
  return (
    &amp;lt;BrowserRouter&amp;gt;
      &amp;lt;div className="App"&amp;gt;
        &amp;lt;header&amp;gt;
          &amp;lt;nav className="nav-flex"&amp;gt;
            &amp;lt;Link to='/'&amp;gt;Home&amp;lt;/Link&amp;gt;
            &amp;lt;Link to='about'&amp;gt;About&amp;lt;/Link&amp;gt;
            &amp;lt;Link to='user'&amp;gt;User&amp;lt;/Link&amp;gt;
          &amp;lt;/nav&amp;gt;
        &amp;lt;/header&amp;gt;
        &amp;lt;Routes&amp;gt;
          &amp;lt;Route path="/" element={&amp;lt;Home /&amp;gt;} /&amp;gt;
          &amp;lt;Route path="about" element={&amp;lt;About /&amp;gt;} /&amp;gt;
          &amp;lt;Route path="User" element={&amp;lt;User /&amp;gt;} /&amp;gt;
        &amp;lt;/Routes&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/BrowserRouter&amp;gt;
  );
}

export default App
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you have been following the tutorial till now, if you run &lt;code&gt;npm start&lt;/code&gt; in your code editor terminal, the image bellow will be dispalyed on your browser. You can now move between &lt;code&gt;Home&lt;/code&gt;, &lt;code&gt;About&lt;/code&gt;, and &lt;code&gt;User&lt;/code&gt; routes.&lt;/p&gt;

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

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

&lt;p&gt;I hope you have been able to create your first React router application. This tutorial only covers the basic use of React router. If you wish to learn more exciting features about the React router library, you can check out `Net Ninja React router course on youtube.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>A basic Introduction to Javascript</title>
      <dc:creator>Chukwuemeka Abuba</dc:creator>
      <pubDate>Fri, 23 Aug 2024 20:54:48 +0000</pubDate>
      <link>https://dev.to/chukeumeka_abuba/a-basic-introduction-to-javascript-4em0</link>
      <guid>https://dev.to/chukeumeka_abuba/a-basic-introduction-to-javascript-4em0</guid>
      <description>&lt;p&gt;JavaScript was introduced in 1995 to add programs to web pages in the Netscape Navigator browser. The language has since been adopted by all other major graphical web browsers. It has made modern web applications possible, with which you can interact directly without doing a page reload for every action. JavaScript is also used in more traditional websites to provide various forms of interactivity and cleverness.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Javascript
&lt;/h2&gt;

&lt;p&gt;Javascript is a cross-platform, object-oriented scripting language used to make webpages interactive (e.g., habing complex animations, clickable buttons etc). There are also more advanced server-side versions of javascript such as Node js, which allows you to add more functionality to a website than downloading files.&lt;/p&gt;

&lt;p&gt;JavaScript is one of the most popular languages which includes numerous features when it comes to web development. It’s amongst the top programming languages as per Github and we must know the features of JavaScript properly to understand what it is capable of.&lt;/p&gt;

&lt;h3&gt;
  
  
  Features of Javascript
&lt;/h3&gt;

&lt;p&gt;1.Light Weight Scripting language&lt;/p&gt;

&lt;p&gt;2.Dynamic Typing&lt;/p&gt;

&lt;p&gt;3.Object-oriented programming support&lt;/p&gt;

&lt;p&gt;4.Functional Style&lt;/p&gt;

&lt;p&gt;5.Platform Independent&lt;/p&gt;

&lt;p&gt;6.Prototype-based&lt;/p&gt;

&lt;p&gt;Let’s see all these features in detail so you can understand them starting from the first to the last&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Light Weight Scripting Language&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;JavaScript is a lightweight scripting language because it is made for data handling in the browser only. Since it is not a general-purpose language it has a limited set of libraries. Also as it is only meant for client-side execution and that too for web applications, hence the lightweight nature of JavaScript is a great feature.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Dynamic Typing&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;JavaScript supports dynamic typing which means types of the variable are defined based on the stored value. For example, if you declare a variable x then you can store either a string or a Number type value or an array or an object. This is known as dynamic typing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Object-Oriented Programming Support&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Starting from ES6, the concept of class and OOPs has been more refined. Also, in JavaScript, two important principles with OOP in JavaScript are Object Creation patterns (Encapsulation) and Code Reuse patterns (Inheritance). Although JavaScript developers rarely use this feature but is there for everyone to explore.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Functional Style&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This implies that JavaScript uses a functional approach, even objects are created from the constructor functions and each constructor function represents a unique &lt;code&gt;object-type&lt;/code&gt;. Also, functions in JavaScript can be used as objects and can be passed to other functions too.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Platform Independent&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This implies that JavaScript is platform-independent or we can say it is portable; which simply means that you can simply write the script once and run it anywhere and anytime. In general, you can write your JavaScript applications and run them on any platform or any browser without affecting the output of the Script.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Prototype-based Language&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;JavaScript is a prototype-based scripting Language. This means JavaScript uses prototypes instead of classes or inheritance. In languages like Java, we create a class and then we create objects for those classes. But in JavaScript, we define an object prototype and then more objects can be created using this object prototype.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7. Interpreted Language&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;JavaScript is an interpreted language which means the script written inside javascript is processed line by line. These Scripts are interpreted by JavaScript interpreter which is a built-in component of the Web browser. But these days many JavaScript engines in browsers like the V8 engine in Chrome use &lt;code&gt;just-in-time&lt;/code&gt; compilation for JavaScript code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;8. Async Processing&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;JavaScript supports Promise which enables asynchronous requests wherein a request is initiated and JavaScript doesn’t have to wait for the response, which at times blocks the request processing. Also starting from ES8, Async functions are also supported in JavaScript, these functions don’t execute one by one, rather they are processed parallelly which has a positive effect on the processing time, reducing it to a great extent.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It is worth noting the core differences between Java and JavaScript.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Javascript and Java are similar in some ways but fundamentally different in some others.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Javascript is a free-form language compared to Java. You do not have to declare all variables, classes, and methods. Yo do not have to be concerned with whether methods are public, private, or protected, and you do not have to implement interfaces while Java is a class-based programming language designed for fast execution and type safety meaning that you can’t cast a java integer into an object reference or access private memory by corrupting the java bytecode.&lt;/p&gt;

&lt;h2&gt;
  
  
  ES6 Features in Javascript with Examples
&lt;/h2&gt;

&lt;p&gt;Es6(ECMAScript 2015) is a major update to javascript that includes a whole lot of new features with a focus on simplicity and readability.7&lt;/p&gt;

&lt;p&gt;Let’s find out about these new features and when and how to use it&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. The let and const keyword&lt;/strong&gt;&lt;br&gt;
Before the introduction of Es6, the var keyword was the only way to declare variables in JavaScript. With the const keyword, you can declare a variable as a constant and as a constant, it will be read-only.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Copy code
// Using let
let age = 25; 
console.log(age); // Output: 25

age = 26; 
console.log(age); // Output: 26

// Using const
const birthYear = 1998; 
console.log(birthYear); // Output: 1998
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. Arrow function&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here we use =&amp;gt; instead of the function keyword. The arrow function makes our code more readable, clean and shorter.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Traditional function
function add(a, b) {
  return a + b;
}

// Arrow function equivalent
const add = (a, b) =&amp;gt; a + b;

// Usage
console.log(add(3, 5)); // Output: 8
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;3. Objects&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Objects are simply collections of properties which are made up of key, value pairs.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Define an object to represent a person
const person = {
    firstName: "John",
    lastName: "Doe",
    age: 30,
    job: "Software Engineer",
    hobbies: ["Reading", "Coding", "Hiking"],
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;4. Classes&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The class keyword is used to formalize the pattern of simulating class-like inheritance hierarchies using functions and prototypes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Define a class called "Person"
class Person {
  // Constructor method to initialize an object
  constructor(name, age) {
    this.name = name;
    this.age = age;
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;5. Promises&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This simply makes asynchronous calls easy and effortless.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Function that returns a promise
function fetchData() {
  return new Promise((resolve, reject) =&amp;gt; {
    const success = true; // Simulate a successful operation

    setTimeout(() =&amp;gt; {
      if (success) {
        resolve("Data fetched successfully!");
      } else {
        reject("Error fetching data.");
      }
    }, 2000); // Simulate an async operation with a 2-second delay
  });
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;6. Template Literals&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Template literals simply means having variables in a string.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Variables
const name = "Alice";
const age = 30;
const job = "developer";
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vyije2al75w3el97yrvv.png)

// Using Template Literals
const introduction = `Hello, my name is ${name}. I am ${age} years old, and I work as a ${job}.`;

console.log(introduction);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Thanks for reading, and always know that I’m rooting for you!!!!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>programming</category>
      <category>react</category>
    </item>
    <item>
      <title>Securing Your Node.js App: A Deep Dive into Effective Authentication Techniques</title>
      <dc:creator>Chukwuemeka Abuba</dc:creator>
      <pubDate>Thu, 22 Aug 2024 15:31:43 +0000</pubDate>
      <link>https://dev.to/chukeumeka_abuba/hh-8fi</link>
      <guid>https://dev.to/chukeumeka_abuba/hh-8fi</guid>
      <description>&lt;p&gt;Authentication plays a pivotal role in the security of modern web applications, ensuring a safe and personalized user experience. It involves the verification of user identities and permissions, safeguarding sensitive data and resources from unauthorized access. In this post, we will explore the significance of authentication, and its benefits to users, and discuss various authentication techniques. We will then delve into setting up different types of authentication using Node.js, my favourite framework known for its performance and flexibility.&lt;/p&gt;

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

&lt;p&gt;To follow through in this article, a basic understanding of the following is required:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;NodeJS&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;ExpressJS&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Command Line&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Postman&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;Authentication is the process of verifying the identity of a user to determine if they are authorized to access specific resources. It involves asking the user "Who are you" and validating their credentials. For instance, during a login attempt, the user's input on the client side is compared with the stored data on the server side. If the information matches, the user is successfully authenticated and allowed access.&lt;/p&gt;

&lt;p&gt;Analogous to the Cinderella story, where the prince used a shoe fitting test to authenticate the rightful owner, authentication serves to confirm and validate the user's identity.&lt;/p&gt;

&lt;h2&gt;
  
  
  Authentication Techniques
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Local or Basic Authentication: The simplest form, where users provide a username and password, and access is granted if the credentials match those stored in the database.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Authentication by OTP: Also known as password-free authentication, this method sends a one-time password (OTP) to the user's device. The user is authenticated if the entered OTP matches the one on the server side.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Single Sign-On (SSO): This technique allows users to access multiple applications with just one sign-in. An example is using one account to access both Gmail and Gdrive.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Open Authorization (OAuth): Involves using existing login credentials from various platforms like Google, Twitter, Facebook, or Github for authentication, without requiring additional security measures.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Two-Factor/Multi-Factor Authentication (2FA/MFA): An extra layer of security is added, requiring additional checks before successful authentication, such as sending an OTP to the user's device or a token to their email address.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now you’ve understood the different authentication techniques, let’s discuss how to implement the various types.&lt;/p&gt;

&lt;h2&gt;
  
  
  Session or Cookie-based Authentication:
&lt;/h2&gt;

&lt;h3&gt;
  
  
  How it works:
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Upon receiving a login request from a client, the server verifies the provided credentials and proceeds to generate a session.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The session data is temporarily held in the server's memory and assigned a unique session ID.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The client stores the received session ID within a cookie for future reference.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Subsequent client requests include the current session ID from the cookie to maintain the session's continuity.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When the user initiates a logout, the server clears both the session ID stored in the cookie and removes the associated session data from the server. As a result, the same session ID cannot be reused.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Run the command below in your terminal to set up a session or cookie-based authentication:&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 express express-session
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By running the aforementioned command, the necessary modules and dependencies will be installed, enabling the implementation of session or cookie-based authentication. Below is a code snippet to assist you in this process:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create an &lt;code&gt;app.js&lt;/code&gt; file inside the project directory and paste the code below:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;app.js:&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const express = require('express');
const session = require('express-session');

const app = express();
app.use(session({
  secret: 'your-secret-key',
  resave: false,
  saveUninitialized: false
}));

// Function to generate a session id
function generateSessionId() {
  return Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
}

// Middleware to check if the user is logged in
function checkLoggedIn(req, res, next) {
  if (req.session.userId) {
    next();
  } else {
    res.status(401).send('Unauthorized: Please log in.');
  }
}
// Login route
app.post('/login', (req, res) =&amp;gt; 
  req.session.userId = generateSessionId();
  res.send('Login successful');
});

app.get('/authenticatedRoute', checkLoggedIn, (req, res) =&amp;gt; {
    res.send('Authenticated Route!');
});

// Logout route
app.post('/logout', (req, res) =&amp;gt; {
  req.session.destroy(err =&amp;gt; {
    if (err) {
      res.status(500).send('Error logging out.');
    } else {
      res.clearCookie('connect.sid');
      res.send('Logout successful');
    }
  });
});

// Start the server
const port = 8000;
app.listen(port, () =&amp;gt; {
  console.log(`Server running on port ${port}`);
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Explanation:
&lt;/h3&gt;

&lt;p&gt;When a user initiates a login request through the &lt;code&gt;/login&lt;/code&gt; route, a fresh session is established, and a unique userId is generated randomly. This userId is then stored within the session. Access to the &lt;code&gt;/authenticatedRoute&lt;/code&gt; route is safeguarded by the &lt;code&gt;checkLoggedIn middleware&lt;/code&gt;, which permits only authenticated users (those possessing a valid userId within their session) to proceed.&lt;/p&gt;

&lt;p&gt;Whenever the user decides to log out using the &lt;code&gt;/logout&lt;/code&gt; route, their session is terminated, and the associated session ID cookie is cleared. Before running the server with the provided code, ensure you have installed the necessary dependencies. You can then start the server by running node &lt;code&gt;app.js&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Token-Based Authentication:
&lt;/h2&gt;

&lt;h3&gt;
  
  
  How it works:
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Users submit their credentials(username and password) which are encoded into a string using the base64 algorithm.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The encoded string is set in the Authorization header and is sent along with each HTTP Request.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To set up token-based authentication, run the command below in your terminal:&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 express body-parser jsonwebtoken
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By running the aforementioned command, the necessary modules and dependencies will be installed, enabling the implementation of token-based authentication. Below is a code snippet to assist you in this process:&lt;/p&gt;

&lt;p&gt;Create an &lt;code&gt;app.js&lt;/code&gt; file inside the project directory and paste the code below:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;app.js:&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
const express = require('express');
const bodyParser = require('body-parser');
const jwt = require('jsonwebtoken');

const app = express();
const secretKey = 'your-secret-key'; 

const users = [
  { username: 'user1', password: 'hashedPassword1' }, 
  { username: 'user2', password: 'hashedPassword2' },
];

function generateToken(username) {
  return jwt.sign({ username }, secretKey, { expiresIn: '1h' }); 
}

function authenticateToken(req, res, next) {
  const authHeader = req.headers['authorization'];
  const token = authHeader &amp;amp;&amp;amp; authHeader.split(' ')[1];

  if (!token) {
    return res.sendStatus(401);
  }

  jwt.verify(token, secretKey, (err, decoded) =&amp;gt; {
    if (err) {
      return res.sendStatus(403);
    }

    req.user = decoded;
    next();
  });
}

app.use(bodyParser.json());

app.post('/login', (req, res) =&amp;gt; {
  const { username, password } = req.body;
  const user = users.find((user) =&amp;gt; user.username === username &amp;amp;&amp;amp; user.password === password);

  if (!user) {
    return res.sendStatus(401);
  }

  const token = generateToken(username);
  res.json({ token });
});

app.get('/protected', authenticateToken, (req, res) =&amp;gt; {
  res.json({ message: 'Protected Resource Accessed', user: req.user });
});

const port = 3000;
app.listen(port, () =&amp;gt; {
  console.log(`Server running on port ${port}`);
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;generateToken&lt;/code&gt;function generates a JWT with a 1-hour expiration time based on the provided username. In addition, the authenticateToken middleware uses &lt;code&gt;jwt.verify&lt;/code&gt; to validate the token found in the Authorization header.&lt;/p&gt;

&lt;p&gt;Upon successful validation, the decoded username is added to the request object &lt;code&gt;(req.user)&lt;/code&gt;, allowing the middleware to proceed with the request. The /login route remains responsible for user authentication and returns a JWT upon successful login. The &lt;code&gt;/protected&lt;/code&gt; route remains protected by the authenticateToken middleware, granting access to the protected resource only when a valid JWT is provided.&lt;/p&gt;

&lt;h3&gt;
  
  
  Passwordless Authentication:
&lt;/h3&gt;

&lt;p&gt;Passwordless authentication involves sending a magic link to the user's email address instead of traditional credentials.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How it works:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;The user provides their email address during the registration process. After that, a unique magic link generated by the server is generated. The magic link is associated with the user’s account.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The magic link is sent to the user's email address. The email usually includes a call-to-action button or URL that the user can click.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When the user clicks the magic link, they are redirected to the application or website.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If the magic link is valid and not expired, the user is considered authenticated and granted access to the website or resource.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Magic links are one-time-use tokens, which means they are valid for a single authentication session. This means that once the user clicks the magic link and successfully authenticates, the link becomes invalid, thereby enhancing security.&lt;br&gt;
To setup passwordless authentication, run the command below in your terminal:&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 express body-parser nodemailer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By running the aforementioned command, the necessary modules and dependencies will be installed, enabling the implementation of passwordless authentication. Below is a code snippet to assist you in this process:&lt;/p&gt;

&lt;p&gt;Create an &lt;code&gt;app.js&lt;/code&gt; file inside the project directory and paste the code below:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;app.js:&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const express = require('express');
const bodyParser = require('body-parser');
const nodemailer = require('nodemailer');

const app = express();
const PORT = 3000;

// In a real application, use a proper database for user accounts.
const users = [
  { id: 1, email: 'user1@example.com' },
  { id: 2, email: 'user2@example.com' },
];

// Generate a magic link for the user
function generateToken() {
  return Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
}

// Send the magic link to the user's email
async function sendMagicLink(email, token) {
  try {

    const transporter = nodemailer.createTransport({
      host: 'smtp.example.com',
      port: 587,
      secure: false,
      auth: {
        user: 'your-email@example.com',
        pass: 'your-email-password',
      },
    });

    const message = {
      from: 'your-email@example.com',
      to: email,
      subject: 'Magic Link for Authentication',
      text: `Click the following link to log in: http://localhost:${PORT}/auth/${token}`,
    };

    await transporter.sendMail(message);
  } catch (error) {
    console.error('Error sending email:', error);
  }
}

app.use(bodyParser.json());

// Initialization of passwordless authentication
app.post('/login', (req, res) =&amp;gt; {
  const { email } = req.body;
  const user = users.find((u) =&amp;gt; u.email === email);

  if (!user) {
    return res.status(404).json({ error: 'User not found.' });
  }

  const token = generateToken();

  sendMagicLink(email, token);
  res.json({ message: 'Magic link sent to your email. Check your inbox.' });
});

// Authentication route using the magic link
app.get('/auth/:token', (req, res) =&amp;gt; {
  const { token } = req.params;
  res.json({ message: 'Authentication successful. You are now logged in.' });
});

app.listen(PORT, () =&amp;gt; {
  console.log(`Server running on port ${PORT}`);
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The code utilizes Express and Nodemailer for passwordless authentication. It stores sample user data in the user's array. The generateToken function creates a random token for users, while sendMagicLink simulates sending the magic link via Nodemailer (in a real app, configure a proper email transporter).&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;/login&lt;/code&gt; route initiates passwordless authentication, generating a token based on the provided email and saving it for verification. The &lt;code&gt;/auth/:token&lt;/code&gt; route simulates authentication using the magic link.&lt;/p&gt;

&lt;h2&gt;
  
  
  Importance of Authentication
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Security: Authentication ensures that only authorized users can access sensitive data, preventing unauthorized external access.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Privacy: It helps maintain data privacy and protects against external intrusion.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;User experience: Authentication enhances user experience by providing personalized services, such as displaying account history and personal information.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

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

&lt;p&gt;In conclusion, authentication is crucial in verifying user identities, ensuring data security, and providing a better user experience. Different techniques can be employed based on the desired level of security and user convenience.&lt;/p&gt;

&lt;p&gt;Write to you again soon... &lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>react</category>
      <category>node</category>
    </item>
    <item>
      <title>Master the Essentials of Git and GitHub in Just 20 Minutes</title>
      <dc:creator>Chukwuemeka Abuba</dc:creator>
      <pubDate>Thu, 22 Aug 2024 03:21:29 +0000</pubDate>
      <link>https://dev.to/chukeumeka_abuba/master-the-essentials-of-git-and-github-in-just-20-minutes-4nce</link>
      <guid>https://dev.to/chukeumeka_abuba/master-the-essentials-of-git-and-github-in-just-20-minutes-4nce</guid>
      <description>&lt;h2&gt;
  
  
  What is Version Control?
&lt;/h2&gt;

&lt;p&gt;Version Control, also known as source control, is the practice of tracking and managing changes to files. Version control systems are systems that record changes to a file over time so that you can record versions of it later. Some of the popular version control systems is Git which is a popular control system/software.&lt;/p&gt;

&lt;p&gt;Now, let’s move to git…&lt;/p&gt;

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

&lt;p&gt;Git is a version-control system that is used to track changes in computer files. Git is used for tracking code changes, Tracking who made changes, and Coding Collaborations. To get started with git, you need to first &lt;a href="https://git-scm.com/downloads" rel="noopener noreferrer"&gt;go to the&lt;/a&gt; and download and install the software.&lt;/p&gt;

&lt;p&gt;Okay, now let’s move to GitHub&lt;/p&gt;

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

&lt;p&gt;GitHub is a code hosting platform for version control and collaboration. It lets you and others work together on projects from anywhere. For you to use GitHub, you need to &lt;a href="https://www.com.github.com/" rel="noopener noreferrer"&gt;go to&lt;/a&gt; and sign up for an account&lt;/p&gt;

&lt;p&gt;Getting interesting right? Now, let’s move to the main business of the day&lt;/p&gt;

&lt;p&gt;Git Work Flow&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyi908fnns1mkux4gje1e.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyi908fnns1mkux4gje1e.jpeg" alt="Image description" width="656" height="400"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  4 fundamentals of git workflow
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Working Directory&lt;/li&gt;
&lt;li&gt;Staging Area&lt;/li&gt;
&lt;li&gt;Local Repository&lt;/li&gt;
&lt;li&gt;Remote Repository&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now, there are three states in the file in your working directory:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;It can be staged: This simply means that any updates made on your files can be staged and ready to be committed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It can be modified: Here, we are simply saying that those changes made on the files have not yet being stored on the local repository( repo in short form).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It can be committed: Those changes you made to your files can be stored in the local repository.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I hope it is getting more interesting. Don’t worry, there is still time remaining. Let’s keep learning!&lt;/p&gt;

&lt;p&gt;Now let’s learn the basic git commands&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will make git to be aware of the folder.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git status
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will show the status of the files that are to be staged or modified.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git add
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will add a file that is in the working directory to the staging area.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git commit
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What this does is to keep track of our code base. It is basically used to add all files that are staged to the local repository.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git push
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is used to push our code from our local machine to GitHub. Here, all the committed files in the local repository are moved to the remote repository.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git fetch
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is used to get files from the remote repository to the local repository.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git merge
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is used to get files from the local repository into the working directory.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git pull

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

&lt;/div&gt;



&lt;p&gt;This is used to get files from the remote repository into the working directory. It does the joint work of git fetch and git merge. So instead of doing git fetch and git merge, you can simply just do a git pull.&lt;/p&gt;

&lt;p&gt;Now, let’s not make this too boring. Let’s create your first repo together with just these few steps&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Create a git hub account&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Simply click on this link and create one. If you already have one, move to step two genie.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2: Check if git is installed on your computer&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To do this, type the following commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git -- version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you have git already, it will show you the version you have installed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Set up your identity&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Set your username and email address. This information is very important because whenever you make a Commit, git uses your identity (username and password) and it's immutably baked into the commits you start creating. To achieve this, you type the following commands.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git config –global user.name “Rose Abuba”
$ git config –global user. Email “roseabuba@outlook.com
$ git config --global –list # to check the data provided 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 4: Create a repo&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Create a new repository on GitHub. Move to your GitHub account and create a new repo by clicking on the new button and selecting Create Repository (you can name your repo anything you wish). After doing this, you will see a list of options for pushing a new repository or an already existing repository.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 5: Create a folder and file&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now, create a file and open it with any code editor of your choice. Then open your terminal. To create a file on your terminal, type the commands below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ touch Index.html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 6: Initialize git&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You do this by typing the commands below&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 7: Staging of files for Commit&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Type the following commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git add . 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This adds all the files in the local repository and stages them for commit&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git add Index.html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To add a specific file Before we commit our files, let’s check the status of our files&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git status
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 7: Commit changes to your git Repository&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git commit -m "First Commit"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add a remote origin and Push&lt;/p&gt;

&lt;p&gt;To update the changes you have made to the main branch because it won’t be automatically updated on Git hub. All those changes are in the local Repository.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git remote add origin remote_repository_URL
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To list connections with other repositories, type the following commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git remote -v 

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

&lt;/div&gt;



&lt;p&gt;This will list the URLS of the remote connections you have with other repositories&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 9: Push Changes made from your local repository to the remote repository.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Type the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git push -u origin main #pushes changes to origin
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The next thing is to refresh. If you followed the above steps, you will see that your codes have been successfully pushed to GitHub.&lt;/p&gt;

&lt;p&gt;HI Genie! If you followed up this far, You are one step to Collaboration! People can now view your code online. All you need to do is to share your repo link and you are good to go!&lt;/p&gt;

&lt;p&gt;Note that each time you make changes on your local repository and you want it to reflect on your Github, These following commands are the most common command flow used.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git add .
$ git status
$ git commit -m "Second Commit"
$ git push -u origin main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In case you want to work with other people’s repositories on Github, you can clone their repos. To do this, type the following commands.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git clone remote_repository_URL
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now let’s move to collaboration&lt;/p&gt;

&lt;p&gt;When you work with a team, That is, for example, a group of developers working on a project. Each time you make a change and push it into the main repo, your colleagues have to pull those changes that you pushed into the git repo. Simply put it this way. To keep up with updates and the latest changes on the git repo, all you need is a git pull command. To achieve this, type the following commands.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git pull origin main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git fetch
    AND
$ git merge  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;git pull is equilavent to git fetch and git merge&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Lastly, let me teach you the basic things you need to know about Branches&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git branch develop
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This creates a new branch called the develop&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git branch
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This shows a list of branches already created&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git checkout develop
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This automatically moves to the branch develop&lt;/p&gt;

&lt;p&gt;These are just the basic things you need to know about Git and GitHub. Stay tuned for more articles on how to use git and GitHub.&lt;/p&gt;

&lt;h2&gt;
  
  
  Additional resources
&lt;/h2&gt;

&lt;p&gt;…And always remember, in case of fire, Do these 3 things;&lt;/p&gt;

&lt;p&gt;Git commit&lt;br&gt;
Git Push&lt;br&gt;
Leave Building&lt;br&gt;
Okay, Byeeeee………&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>typescript</category>
      <category>github</category>
      <category>git</category>
    </item>
  </channel>
</rss>
