<?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: Emmanuel Festus</title>
    <description>The latest articles on Forem by Emmanuel Festus (@aikay).</description>
    <link>https://forem.com/aikay</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%2F1031075%2F7bda6983-c582-4bff-8830-9956b45730ed.jpeg</url>
      <title>Forem: Emmanuel Festus</title>
      <link>https://forem.com/aikay</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/aikay"/>
    <language>en</language>
    <item>
      <title>Effortless Star Rating Implementation with custom useStar Visualization hook in React</title>
      <dc:creator>Emmanuel Festus</dc:creator>
      <pubDate>Sat, 29 Jul 2023 15:10:52 +0000</pubDate>
      <link>https://forem.com/aikay/effortless-star-rating-implementation-with-custom-usestar-visualization-hook-in-react-hk1</link>
      <guid>https://forem.com/aikay/effortless-star-rating-implementation-with-custom-usestar-visualization-hook-in-react-hk1</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Have you ever come across a website with a rating feature, such as an e-commerce site or a blog? Ratings play a crucial role in influencing our decisions while navigating these websites. For instance, when shopping for a laptop on Amazon, we often check the product's rating to gauge its quality based on user experiences. A positive rating might lead us to make a purchase, while a negative one could deter us.&lt;/p&gt;

&lt;p&gt;Additionally, ratings allow us to express appreciation or dissatisfaction with a product or service. If we're dissatisfied, we leave comments and rate accordingly. Star ratings are an essential part of this feedback system, and that's what we'll focus on in this blog.&lt;/p&gt;

&lt;h2&gt;
  
  
  Introducing the useStar Visualization Hook
&lt;/h2&gt;

&lt;p&gt;The useStar visualization hook is a custom hook designed to simplify the process of rendering star ratings in the UI. It alleviates the burden of handling logic for displaying stars, including choosing icons and handling fractional stars.&lt;/p&gt;

&lt;p&gt;By using the useStar hook, developers can offload all the intricate logic and icon management to the hook itself, enabling them to effortlessly render star ratings in the UI.&lt;/p&gt;

&lt;h2&gt;
  
  
  How does it work
&lt;/h2&gt;

&lt;p&gt;The useStar hook functions like a generator, taking in input and producing immediate results without involving asynchronous operations.&lt;/p&gt;

&lt;p&gt;To use the hook, you need to provide three parameters in the following order: &lt;code&gt;RATING NUMBER&lt;/code&gt;, &lt;code&gt;BASE STAR NUMBER&lt;/code&gt; and an &lt;code&gt;OBJECT CONTAINING CSS STYLES&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Rating Number
&lt;/h2&gt;

&lt;p&gt;The first parameter, the &lt;code&gt;RATING NUMBER&lt;/code&gt;, represents the actual rating given to a product or item by users. It should be a number, and the hook is strongly typed to only accept numeric values.&lt;/p&gt;

&lt;h2&gt;
  
  
  Base Star Number
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;BASE STAR NUMBER&lt;/code&gt; refers to the maximum number of stars to display. Most websites use 5 stars, but some may prefer using 7 or 10 stars to rate their products. Regardless of the number you choose, the base stars cannot exceed the rating number, as it represents the highest possible rating.&lt;/p&gt;

&lt;h2&gt;
  
  
  Object Containing CSS Styles
&lt;/h2&gt;

&lt;p&gt;The last parameter is an object containing CSS styles that override the hook's default styles. You can choose to use the default styles by passing in an empty object. The hook's default style is as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const DEFAULT_STYLE: object = {
    fontSize: "20px",
    color: "gold",
    margin: "0 5px",
  };
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When you have successfully passed in data into the hook eg. useStarVisualization(2.6, 5, {color: "red"}), the hook will take all this and spit out a react component of stars using the fontAwesome library. That is why the extension is TSX and not TS.&lt;/p&gt;

&lt;p&gt;The hook distinguishes between three types of stars: &lt;code&gt;empty star&lt;/code&gt;, &lt;code&gt;half star&lt;/code&gt;, and &lt;code&gt;full star&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NSqT6P2H--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xj76c9xpzunxkg9ul4sr.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NSqT6P2H--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xj76c9xpzunxkg9ul4sr.jpg" alt="Empty Star" width="800" height="266"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Empty star
&lt;/h2&gt;

&lt;p&gt;The empty star represents the state when the user's rating doesn't fill up all the stars. For example, a rating of 3.0 with a base of 5 will show 3 full stars and 2 empty stars. The calculation for empty stars is base star - rating. When a half star is present, the calculation changes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cjH94NYu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7ozum3kshhbdf5a9obvr.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cjH94NYu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7ozum3kshhbdf5a9obvr.jpg" alt="Half Star" width="800" height="318"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Half star
&lt;/h2&gt;

&lt;p&gt;The half star represents the state between a full star and an empty star. When the decimal unit of the rating is greater than 0, a half star appears. For example, a rating of 3.0 with a base of 5 will not have a half star, while a rating of 2.8 with a base of 5 will display 2 full stars, 1 half star, and 2 empty stars.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0cbYKUwx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4vlxkjq2u22w9vjy8u54.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0cbYKUwx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4vlxkjq2u22w9vjy8u54.jpg" alt="Full Star" width="773" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Full star
&lt;/h2&gt;

&lt;p&gt;The full star represents the maximum state of a star. It corresponds to the whole number part of the rating. For instance, a 5.0 rating with a base of 5 will display 5 full stars, while a 2.1 rating with a base of 10 will show 2 full stars, 1 half star, and 7 empty stars.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to use
&lt;/h2&gt;

&lt;p&gt;Before we proceed to use the hook, let's first clone the repository to get access to the hook and install the necessary dependencies.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Clone the Repository&lt;br&gt;
&lt;code&gt;https://github.com/GeneralAike/useStarVisualization.git&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Copy the useStarVisualization hook from the hooks folder into your project. The file is located at &lt;code&gt;src/hooks/useStarVisualization.tsx.&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Import the useStarVisualization hook&lt;br&gt;
&lt;code&gt;import useStarVisualization from "./hooks/useStarVisualization";&lt;/code&gt;.&lt;br&gt;
Edit the directory to your appropriate hooks folder where the useStarVisualization file is.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Install the following dependencies&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install @fortawesome/react-fontawesome
npm install @fortawesome/free-solid-svg-icons
npm install @fortawesome/fontawesome-svg-core
npm install @fortawesome/free-regular-svg-icons
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see, these dependencies are used for the icons only. The core code is written purely in TypeScript.&lt;/p&gt;

&lt;p&gt;Generate your stars by calling the function in your JSX or TSX&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div&amp;gt;
  {useStarVisualization(data.rating.rate, 5, {
  fontSize: "18px",
  color: "red",
  margin: "3px",
  })}
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once you have completed these steps, useStarVisualization hook will be integrated into your project successfully.&lt;/p&gt;

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

&lt;p&gt;The useStar visualization hook was designed by developers for developers. I hope you now understand how to integrate the hook into your project seamlessly and use it effectively. If you found this blog helpful, please consider leaving a like and sharing your experience in the comments. Thank you!&lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>How to Consume an API with Vanilla Javascript</title>
      <dc:creator>Emmanuel Festus</dc:creator>
      <pubDate>Thu, 02 Mar 2023 22:49:49 +0000</pubDate>
      <link>https://forem.com/aikay/how-to-consume-an-api-with-vanilla-javascript-5ec7</link>
      <guid>https://forem.com/aikay/how-to-consume-an-api-with-vanilla-javascript-5ec7</guid>
      <description>&lt;h2&gt;
  
  
  INTRODUCTION
&lt;/h2&gt;

&lt;p&gt;API consumption or API fetching refers to the process of accessing and using data or services provided by an Application Programming Interface (API). Almost all websites use APIs to communicate with their backends or servers. APIs contain important information that you may want to show in the front-end of your website, such as a weather forecast or current crypto prices. In this tutorial, we will show you how to consume an API using JavaScript.&lt;/p&gt;

&lt;h2&gt;
  
  
  Requirements
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Basic knowledge of HTML, CSS and Javascript&lt;/li&gt;
&lt;li&gt;an IDE (example: VScode)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 1: Creating the HTML template
&lt;/h2&gt;

&lt;p&gt;Before we start writing JavaScript code, we need to create the HTML template. Here is a sample template that you can use as a reference. You can also use an image as a placeholder until you get your API up and running.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv8vi3grl7msqjyz7h3po.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%2Fv8vi3grl7msqjyz7h3po.png" alt="My Template"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Finding an API
&lt;/h2&gt;

&lt;p&gt;We will use 2 API links in this tutorial&lt;/p&gt;

&lt;p&gt;&lt;code&gt;https://xsgames.co/randomusers/avatar.php?g=male&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This is for the profile image&lt;/p&gt;

&lt;p&gt;&lt;code&gt;https://randomuser.me/api/&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This is for the user details.&lt;/p&gt;

&lt;p&gt;We are using different links because the image in the second API isn't working, so we had to find another API that provides only images.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Fetching data from the API
&lt;/h2&gt;

&lt;p&gt;Now that we have the necessary API links, we can start consuming them. Let's start with the image. We will simply put the link for the image API inside the src attribute of the img tag in our HTML template.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;        &amp;lt;div class="imghold"&amp;gt;
            &amp;lt;img src="https://xsgames.co/randomusers/avatar.php?g=male" alt=""&amp;gt;
        &amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This should generate a random image every time you reload the page.&lt;/p&gt;

&lt;p&gt;STEP 4&lt;/p&gt;

&lt;p&gt;In your javascript file, we will assign the API link to a constant variable so that we can reuse it throughout our code.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;const url = "https://randomuser.me/api/"&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Doing this will make our link reuseable so if you want to use your link anywhere else on your code, you can just call the url variable.&lt;br&gt;
NOTE: Its a constant so you wont be able to change its value anywhere eles in your code&lt;/p&gt;

&lt;p&gt;Lets use an in-built Javascript function called fetch. fetch() is a built-in function in JavaScript that is used to make network requests and retrieve resources from a server using the Fetch API.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;fetch(url)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This will return a promise, which either resolves or rejects. If you are not familiar with promises, think of them as sending someone on an errand to go and get something. The person either comes back with what you sent them to get (resolved) or comes back without it (rejected).&lt;/p&gt;

&lt;p&gt;When we log out fetch(url) to the console, we get a pending promise because the data has not yet been returned from the API.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzdvmn2xz7scxkovo7x4d.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%2Fzdvmn2xz7scxkovo7x4d.png" alt="Fetch in console"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is because at the time this promise fetch url was logged out, it didnt come back with the information from the API yet, so we get pending promise instead of the actual data.&lt;/p&gt;

&lt;p&gt;To handle this issue, we can use the then() method to register a callback function that will be called when the Promise is resolved successfully. Within the callback function, we can then extract the JSON data using the json() method and use it in our code.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;.then(resolve =&amp;gt; resolve.json())&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This attaches a callback function to the Promise object returned by fetch(). The callback function takes the resolved Response object as its argument and calls the json() method on it to extract the JSON data from the response. The json() method also returns a Promise object that resolves to the parsed JSON data.&lt;br&gt;
Since it returns another promise, we have to use a then function again so we can get the json data&lt;/p&gt;

&lt;p&gt;&lt;code&gt;.then(data =&amp;gt; {console.log(data)})&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;if you console.log data, it will give you an object containing all the information you want&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6cs9gwl2xq0x2j43dqbb.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%2F6cs9gwl2xq0x2j43dqbb.png" alt="My console"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is a complex object containing arrays and other objects inside, so you have to navigate through to get what you want. If you dont know how, just know that you use dot nothation (.) to navigate an object, by calling the key (example: object.key, this will give you the value of that key) or if you want to navigat an array, you use box notation ([]) by inputting the index, Note that the index of an array starts from 0, so the first item in the array has an index of 0 (example: myArr[1], this will get the second item in myArr). This is how mine looks.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const url = "https://randomuser.me/api/"
fetch(url)
.then(resolve =&amp;gt; resolve.json())
.then(data =&amp;gt; {
    let name = `${data.results[0].name.title} ${data.results[0].name.first} ${data.results[0].name.last}`
    document.querySelector("#name").innerHTML = name
    document.querySelector("#email").innerHTML = data.results[0].email
    document.querySelector("#phone").innerHTML = data.results[0].phone
    document.querySelector("#age").innerHTML = data.results[0].dob.age
    document.querySelector("#gender").innerHTML = data.results[0].gender
})
.catch((err) =&amp;gt; {
    console.log(err);
})

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

&lt;/div&gt;



&lt;p&gt;We also add a catch() method to catch any errors that may occur during the fetch() request, which can help us debug any issues and handle them appropriately.&lt;br&gt;
This is my final result&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0rqzpdbz041b86d5t3b1.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%2F0rqzpdbz041b86d5t3b1.png" alt="Final Result"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To conclude, consuming APIs is an essential part of modern web development, and with the Fetch API, it has become easier than ever to interact with web services and retrieve data. We learned that fetch() is a Promise-based function that returns a Promise object, which resolves to the Response object representing the response to our request. We also learned that the Response object provides a set of methods to extract the data we need, and that we can chain these methods together using the then() method.&lt;/p&gt;

&lt;p&gt;In addition, we explored the json() method, which is used to extract JSON data from a Response object, and how we can use dot and box notation to navigate complex objects and arrays. Finally, we saw an example of how to use fetch() to consume an API and update a web page with the retrieved data.&lt;/p&gt;

&lt;p&gt;Overall, fetch() is a powerful and flexible tool that can be used to interact with a wide variety of APIs, and with some practice, you can leverage it to create dynamic and engaging web applications.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>tutorial</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Developing an E-Commerce Website with Javascript and Firebase: A Comprehensive Guide - Series 1</title>
      <dc:creator>Emmanuel Festus</dc:creator>
      <pubDate>Tue, 21 Feb 2023 18:40:05 +0000</pubDate>
      <link>https://forem.com/aikay/developing-an-e-commerce-website-with-javascript-and-firebase-a-comprehensive-guide-series-1-3m73</link>
      <guid>https://forem.com/aikay/developing-an-e-commerce-website-with-javascript-and-firebase-a-comprehensive-guide-series-1-3m73</guid>
      <description>&lt;p&gt;As a developer, it is essential to learn and master programming languages that are relevant to your field. For web development, JavaScript is typically the first programming language that most developers learn. However, it is important to note that HTML and CSS are markup languages and not programming languages. Once you have learned JavaScript, you are typically eager to start building your first project to advance your skills.&lt;/p&gt;

&lt;p&gt;In this tutorial, we will build an e-commerce website using vanilla JavaScript, which is plain JavaScript without any framework. We will also use Firebase to handle our back-end operations. Firebase is capable of performing a variety of back-end operations, including storage, real-time database, and authentication, among others. Given the broad scope of creating an e-commerce website, we will only cover a section of it in this post and cover more in other series.&lt;/p&gt;

&lt;p&gt;Before we begin, here are some prerequisites:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://code.visualstudio.com/" rel="noopener noreferrer"&gt;Visual studio code&lt;/a&gt; or any source-code editor&lt;/li&gt;
&lt;li&gt;&lt;a href="https://firebase.google.com/" rel="noopener noreferrer"&gt;A firebase account&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://nodejs.org/en/" rel="noopener noreferrer"&gt;Node.js&lt;/a&gt; installed in your computer&lt;/li&gt;
&lt;li&gt;Good knowledge of Html, CSS, and Javascript&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once you have these tools, you are ready to get started.&lt;/p&gt;

&lt;h2&gt;
  
  
  STEP 1
&lt;/h2&gt;

&lt;p&gt;Lets get our basic html and css set-up&lt;/p&gt;

&lt;p&gt;Before we begin coding, you should design your website based on the design you feel comfortable with. You can add fake products to your website to act as a placeholder until you can set up your Firebase. If you find it hard to design websites on your own, you can go to &lt;a href="https://colorlib.com/" rel="noopener noreferrer"&gt;colorlib&lt;/a&gt; if you find it hard to design websites on your own.&lt;/p&gt;

&lt;p&gt;This is an example of a design template I came up with in a short time:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fveko139ucbcywntqfm0r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fveko139ucbcywntqfm0r.png" alt=" " width="800" height="358"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is just a visual aid to give you an idea of what we will be working with. This is how my item card looks like. You can visit the website &lt;a href="https://shop-site-269eb.web.app/" rel="noopener noreferrer"&gt;here&lt;/a&gt; and the the link to the github soucre code &lt;a href="https://github.com/GeneralAike/Shop-website" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fcppxx8efm4czkfrrdyhy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fcppxx8efm4czkfrrdyhy.png" alt=" " width="800" height="361"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The capabilities of this website are:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Displaying products on the wesbite&lt;/li&gt;
&lt;li&gt;Adding products to cart&lt;/li&gt;
&lt;li&gt;Deleting and adding products to the website&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  STEP 2
&lt;/h2&gt;

&lt;p&gt;Now that we done with all the boring HTML, CSS and designing, lets go on to setting up our firebase account&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Assuming you have created an account on firebase, go to console&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Ff9s6m03d44z6hn0k01uo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Ff9s6m03d44z6hn0k01uo.png" alt=" " width="800" height="331"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click on "Add project," give it a product name, and follow all the steps. As you can see from mine, I have already created my project named SHOP-WEBSITE:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F0qnzo7agkyqkd8smdq1q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F0qnzo7agkyqkd8smdq1q.png" alt=" " width="800" height="362"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;-Follow all the steps till you reach this page:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fdakm0p1euer7wha1rr9h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fdakm0p1euer7wha1rr9h.png" alt=" " width="800" height="365"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on "Web," and follow all the steps and continue to the console.&lt;/p&gt;

&lt;p&gt;-Go to your project settings and het your config, this should look like this&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fis1alywcc27zlbqo4nza.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fis1alywcc27zlbqo4nza.png" alt=" " width="800" height="363"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Copy this and keep it somewhere, we will need it later&lt;/p&gt;

&lt;h2&gt;
  
  
  STEP 3
&lt;/h2&gt;

&lt;p&gt;To set up Firebase in your project, it is important to first ensure that Node.js is installed on your VS Code. To check if Node.js is installed, simply type "node --version"&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;in your terminal. If it is installed, it will return a version number.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fijn2ro0d5zfynkahetvi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fijn2ro0d5zfynkahetvi.png" alt=" " width="275" height="166"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After ensuring that Node.js is installed, follow these steps to set up Firebase in your project:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Navigate to the root folder of your website using the VS Code terminal and type "firebase login".
&lt;/li&gt;
&lt;/ol&gt;

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

&lt;/div&gt;



&lt;p&gt;This will prompt you to log in to your Google account, so follow the steps in your browser until you are logged in.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Next, initialize Firebase in your project by typing "firebase init" in the terminal.
&lt;/li&gt;
&lt;/ol&gt;

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

&lt;/div&gt;



&lt;p&gt;This will prompt a series of questions that you should answer based on your specific needs and preferences. If you are unsure about any of the questions, there are plenty of resources available online, including Stack Overflow, that can provide assistance.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Once Firebase has been initialized in the directory, there are a few additional steps you need to take. Specifically, you need to add the Firebase script tag to the head of your HTML file by including the following line:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;script src="https://www.gstatic.com/firebasejs/6.0.2/firebase.js"&amp;gt;&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Finally, create a JavaScript file, add your Firebase configuration, and initialize Firebase using the following code:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const firebaseConfig = {
  apiKey: "AIzaSyC-AYn0Oos9Z_yqojxKjMdeuKrF68quVnw",
  authDomain: "blog-16faf.firebaseapp.com",
  projectId: "blog-16faf",
  storageBucket: "blog-16faf.appspot.com",
  messagingSenderId: "31630474371",
  appId: "1:31630474371:web:f0135de93da7ba016aafb6",
  measurementId: "G-BMTYFXS9LH"
};

// Initialize Firebase
firebase.initializeApp(firebaseConfig);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By following these steps, you have successfully set up Firebase in your project and can begin utilizing it for your specific purposes. In our next series, I will cover how to setup firebase Realtime Database for storing and retrieving of the details of our items.&lt;/p&gt;

</description>
      <category>api</category>
      <category>softwaredevelopment</category>
      <category>discuss</category>
    </item>
  </channel>
</rss>
