<?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: Pauline Oraro</title>
    <description>The latest articles on Forem by Pauline Oraro (@paulineoraro).</description>
    <link>https://forem.com/paulineoraro</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%2F1106323%2F78b44602-c954-4a53-b89c-5c942098cc14.jpg</url>
      <title>Forem: Pauline Oraro</title>
      <link>https://forem.com/paulineoraro</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/paulineoraro"/>
    <language>en</language>
    <item>
      <title>Mastering the Basics of UX/UI Design.</title>
      <dc:creator>Pauline Oraro</dc:creator>
      <pubDate>Mon, 01 Jan 2024 13:05:53 +0000</pubDate>
      <link>https://forem.com/paulineoraro/mastering-the-basics-of-uxui-design-e87</link>
      <guid>https://forem.com/paulineoraro/mastering-the-basics-of-uxui-design-e87</guid>
      <description>&lt;p&gt;Mastering the fundamentals of User Experience (UX) and User Interface (UI) design is important. These disciplines shape the way individuals engage with digital products. We will unravel the fundamental principles that lay the groundwork for creating user-centric digital experiences because UX/UI designers have the power to create visually appealing digital products.&lt;/p&gt;

&lt;h3&gt;
  
  
  Table of contents
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Understanding UX/UI Design&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Key Design principles&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;UX/UI Design process&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;UX/UI Design tools&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Understanding UX/UI Design &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;User Experience(UX) is the process of creating a product that is easy to use and provides a seamless experience for the user. It works on understanding the needs of the user and creating a product that meets those needs.&lt;/p&gt;

&lt;p&gt;User Interface(UI) is the process of creating visually appealing and user-friendly interface that allows users to interact with the product easily. UI designers work on designing the layout, color scheme and typography. They make the product look beautiful and appealing.&lt;/p&gt;

&lt;h2&gt;
  
  
  UX/UI Design process &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Research and analysis&lt;/strong&gt;&lt;br&gt;
This involves understanding the user's needs, preferences and behavior. UX designers use surveys, interviews to gather data.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;User persona creation&lt;/strong&gt;&lt;br&gt;
After gathering data, UX designers create user personas that represent the user and their needs, helps designers understand the user's needs and design a product that meets those needs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;User journey mapping&lt;/strong&gt;&lt;br&gt;
It involves the steps that a user takes to complete a task using the product used to identify areas of improvement.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Wireframe creation&lt;/strong&gt;&lt;br&gt;
They are sketches of the layout of the product. It helps visualize the final product. It allows us to get a basic idea of the layout of any website.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Prototyping&lt;/strong&gt;&lt;br&gt;
They are working models that allow designers to test the product and get feedback from users.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;User testing&lt;/strong&gt;&lt;br&gt;
This involves evaluating a product by testing it with users.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Key Design Principles &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Hierarchy&lt;/strong&gt; &lt;br&gt;
Helps users move through a product easily.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Information architecture-&lt;/strong&gt; This is how content is organized across the app or site. The top level is usually a primary navigation menu which you notice when you first open an app or arrive on a site.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Visualy hierarchy-&lt;/strong&gt; Guides a user's eye to the most important elements on the page for example; headings are larger than body text, links and buttons use different colors.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Consistency&lt;/strong&gt;&lt;br&gt;
You should maintain uniformity in styles, patterns and interactive elements throughout the interface. It builds familiarity for the users.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Accessibility&lt;/strong&gt;&lt;br&gt;
This ensures that your product is accessible to many people as possible. This includes catering the needs of people with disabilities.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;User-centricity&lt;/strong&gt;&lt;br&gt;
You should create products that solve users problems. You should must put the user's needs first and make decisions based on what you know about them and what they want from the product.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;User control&lt;/strong&gt;&lt;br&gt;
This involves giving the user the right amount of control over how they interact with a product. This includes incorporating undo and redo functionality, providing cancel buttons and clearly labelling alternative actions and routes the user can take if they want to revert to a particular action.&lt;/p&gt;

&lt;h2&gt;
  
  
  UX/UI Design tools &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Sketch.&lt;br&gt;
Adobe XD.&lt;br&gt;
Figma.&lt;br&gt;
Invision Studio.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>uidesign</category>
      <category>ux</category>
      <category>beginners</category>
    </item>
    <item>
      <title>A Guide To Writing Clean and Maintainable Code.</title>
      <dc:creator>Pauline Oraro</dc:creator>
      <pubDate>Mon, 04 Dec 2023 12:56:06 +0000</pubDate>
      <link>https://forem.com/paulineoraro/a-guide-to-writing-clean-and-maintainable-code-1m3l</link>
      <guid>https://forem.com/paulineoraro/a-guide-to-writing-clean-and-maintainable-code-1m3l</guid>
      <description>&lt;p&gt;When it comes to writing code, the goal is not only to make it work but also to make sure that your code is clean and easy to maintain which is super important for the long run. This blog post will share some simple tips on how to write clean and maintainable code. We'll look at different practices that help you make sure your code is efficient over time. Let's dive into the practices on how to write clean and maintainable code.&lt;/p&gt;

&lt;p&gt;Clean code refers to code that is  easy to read, understand, and maintain. Clean code is written in a way that reduces complexity and is easy for other developers to comprehend.&lt;/p&gt;

&lt;h2&gt;
  
  
  Use descriptive and meaningful names.
&lt;/h2&gt;

&lt;p&gt;You should always make a habit to use meaningful names in your code because you will be writing a lot of names for variables, functions, classes. The name that you specify in your code should reveal its use. It should specify the purpose of a variable or function. It will make your code much cleaner and easier to read for yourself and other developers. An example of a variable;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var numberOfUsers = 10;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Keep your code DRY
&lt;/h2&gt;

&lt;p&gt;DRY means don't repeat yourself. Avoid duplicating code within your codebase. The idea behind DRY is to reduce repetition in code by creating reusable components like functions, classes, or modules. This means you can improve maintainability, reduce the chances of introducing bugs when making changes, and make your code more readable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Follow a consistent coding style.
&lt;/h2&gt;

&lt;p&gt;Choose a coding style that works for you. This includes naming conventions, indentation, commenting, and whitespace usage. It will make your code more readable and easier to understand, even for developers new to the project.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Naming conventions:&lt;/strong&gt; Follow a consistent naming convention (e.g., camelCase, snake_case, PascalCase) based on the language or community standards.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Indentation:&lt;/strong&gt; Be consistent with the use of tabs or spaces, and choose one for your entire project.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Commenting:&lt;/strong&gt; Provide comments to explain your code.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Whitespace usage:&lt;/strong&gt; Avoid excessive or unnecessary blank lines.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Document and comment your code.
&lt;/h2&gt;

&lt;p&gt;Documentation helps developers and other users understand the code. Include comments in your code to explain how it works and what it does. Additionally, write other documentations such as README files or user manuals, to explain how to use the software.  Keep documentation up-to-date to help fellow developers understand the purpose and usage of your code.&lt;/p&gt;

&lt;h2&gt;
  
  
  Write modular code.
&lt;/h2&gt;

&lt;p&gt;It refers to the practice of breaking down large, complex code into smaller, more manageable units. This makes the code easier to understand, test, and maintain. It offers several benefits:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Reusability:&lt;/strong&gt; Modular code promotes code reuse that can be used in different parts of the application which saves time and effort in development.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Scalability:&lt;/strong&gt; By breaking down large code into smaller modules, you can easily modify or remove functionality without affecting the entire codebase. This reduces the risk of introducing bugs.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Organize your project.
&lt;/h2&gt;

&lt;p&gt;A well-structured folder and files make everything clear and  easier to understand a project. So make sure that your directory or folder structure should be in an organized manner. It offers several benefits:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Understanding:&lt;/strong&gt; Developers, including yourself can quickly understand the project's structure.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Navigating easily:&lt;/strong&gt; An organized structure makes it easy to navigate through the project. Developers can move between files and folders without confusion.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;Embrace these practices to keep your code clean and maintainable. Remember, the art of writing code is a journey of continuous improvement, where each line of clean and maintainable code paves the way for the success of your projects in the long term.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>coding</category>
      <category>productivity</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>Tips For Effective Code Documentation.</title>
      <dc:creator>Pauline Oraro</dc:creator>
      <pubDate>Mon, 27 Nov 2023 13:48:40 +0000</pubDate>
      <link>https://forem.com/paulineoraro/tips-for-effective-code-documentation-5ag9</link>
      <guid>https://forem.com/paulineoraro/tips-for-effective-code-documentation-5ag9</guid>
      <description>&lt;p&gt;In the fast-paced world of software development, writing clear and concise code documentation is a crucial skill that separates good developers from great ones. Whether you're a seasoned coder or just starting on your programming journey, mastering the art of documenting your code can significantly impact the readability, maintainability and collaboration aspects of your projects. In this blog post, we'll delve into essential code documentation best practices and provide practical tips to help you enhance your coding skills. Whether you're aiming to improve your individual coding practices or enhance team collaboration on software projects, our guide is tailored to offer valuable insights and actionable tips. Let's embark on this journey to master the art of code documentation and take your programming skills to new heights.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is code documentation.
&lt;/h2&gt;

&lt;p&gt;Code documentation refers to the process of creating and maintaining documentation (written text, comments, or other supplementary materials) for a computer program or software project. The main purpose of code documentation is to help developers, users, and other stakeholders understand the functionality, design, and usage of the software. &lt;/p&gt;

&lt;h2&gt;
  
  
  Tips for effective code documentation.
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Start with a comprehensive README file:
&lt;/h3&gt;

&lt;p&gt;It is a foundational principle in effective code documentation. This file serves as the entry point for anyone interacting with the project, whether they are collaborators, contributors, or users. Here is a list of what the README file contains:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Project Overview:&lt;/strong&gt; The README file provides a brief yet comprehensive overview of your project. It should clearly communicate the purpose of your software so as to help developers understand what your code is designed to achieve.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Installation Instructions:&lt;/strong&gt;  Include step-by-step instructions on how to set up and install your project. This ensures that other developers can easily get your code up and running on their local machines without encountering unnecessary obstacles.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Usage Guidelines:&lt;/strong&gt; This can include basic code snippets, command-line examples, or even screenshots demonstrating the software in action. Including practical examples helps users quickly grasp how to leverage the project to meet their needs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Dependencies and Requirements:&lt;/strong&gt; List any dependencies or external libraries that your project relies on. This information is vital for others to understand the environment your code requires to function properly.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Contributing Guidelines:&lt;/strong&gt; If you're open to collaboration and contributions from other developers, outline how they can get involved.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;License Information:&lt;/strong&gt; Specify the licensing terms under which your project is released. This is important for legal and ethical reasons, as it clarifies how others can use, modify, and distribute your code.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Contact or Support Information:&lt;/strong&gt; Provide a way for users or contributors to get in touch with you. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Use meaningful comments:
&lt;/h3&gt;

&lt;p&gt;This emphasizes the importance of providing clear and relevant comments within your codebase to enhance understanding and maintainability. Comments are annotations embedded in the code that are not executed but serve as explanatory notes for developers who read the code in the future. Comments should go beyond merely describing what a piece of code does, they should explain why it's written that way.&lt;br&gt;
As code evolves, it's essential to keep comments in sync with the code changes. Outdated comments that do not reflect the current state of the code can be misleading and counterproductive. When modifying code, take a moment to update or remove any comments that are no longer accurate.&lt;/p&gt;

&lt;h3&gt;
  
  
  Choose Descriptive Variable and Function Names:
&lt;/h3&gt;

&lt;p&gt;It is a crucial aspect of writing clean and maintainable code. This point emphasizes the importance of selecting names for your variables and functions that clearly convey their purpose and role in the code.  It promotes clarity, understanding, and maintainability, contributing to the overall quality of your codebase and making it more accessible to yourself and your collaborators. Descriptive names enhance the readability of your code. When someone, including yourself, reads the code, they should be able to quickly understand the purpose of a variable or function based on its name. This eliminates the need for excessive comments to explain the meaning of each element.&lt;/p&gt;

&lt;h3&gt;
  
  
  Update Documentation Alongside Code Changes:
&lt;/h3&gt;

&lt;p&gt;Documentation should evolve alongside your codebase. When you make changes to your code, update the corresponding documentation in parallel. This practice prevents the documentation from becoming outdated and ensures that future developers can rely on accurate information. When documentation aligns with the latest version of the code, it accurately represents the current state of the software. Developers who refer to the documentation can trust that the information provided is relevant and applicable to the version they are working on.&lt;/p&gt;

&lt;h3&gt;
  
  
  Keep it clear and concise:
&lt;/h3&gt;

&lt;p&gt;It is a principle in code documentation that encourages developers to maintain a balance between providing sufficient information and avoiding unnecessary details. The idea is to create documentation that is clear, concise, and directly relevant to the understanding and usage of the codebase. A concise and focused documentation is more likely to be read and understood. Developers often need to quickly grasp the essentials of a codebase, and a redundant documentation can hinder rather than help in this regard.&lt;/p&gt;

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

&lt;p&gt;Code documentation is a craft that requires attention, care, and commitment. By following these tips, developers can create documentation that not only serves as a reliable guide but also fosters collaboration and understanding within development teams.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>codenewbie</category>
      <category>learning</category>
      <category>abotwrotethis</category>
    </item>
    <item>
      <title>Debugging Techniques: How To Solve Common Coding Errors.</title>
      <dc:creator>Pauline Oraro</dc:creator>
      <pubDate>Sat, 18 Nov 2023 12:24:51 +0000</pubDate>
      <link>https://forem.com/paulineoraro/debugging-techniques-how-to-solve-common-coding-errors-28jc</link>
      <guid>https://forem.com/paulineoraro/debugging-techniques-how-to-solve-common-coding-errors-28jc</guid>
      <description>&lt;p&gt;Debugging is an essential skill for every programmer. No mater how experienced you are, encountering bugs and issues in your code is inevitable. The ability to effectively debug and resolve these problems can significantly impact your productivity and the quality of your software. In this blog post we will explore debugging techniques, helping you to be a more proficient programmer.&lt;/p&gt;

&lt;h2&gt;
  
  
  The art of reading error messages.
&lt;/h2&gt;

&lt;p&gt;Before you jump into debugging, it is crucial to understand the information provided by error messages. Error messages are your first line of defense in debugging. They hold clues that pinpoint the problem. When encountering an error follow these steps to decode the message effectively;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Read the error message thoroughly-&lt;/strong&gt; Begin by reading the error message and understand what the error is saying.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Identify the error type-&lt;/strong&gt; Errors typically fall into categories like syntax errors, runtime errors or logical errors. Knowing the type of error can narrow down the potential causes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Look for error codes-&lt;/strong&gt; Error messages often come with error codes or identifiers. These can be useful for searching online or in documentation for more information about the specific error.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Check for line numbers-&lt;/strong&gt; Many error messages specify the line number where the issue occurred. This is a valuable piece of information that directs you to the exact location in your code that needs attention.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Search for contextual information -&lt;/strong&gt; Sometimes error messages provide context or suggestions on how to resolve the issue. Read any additional information or suggestions provided.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Isolate the problem
&lt;/h2&gt;

&lt;p&gt;When faced with a bug, don't try to tackle the entire codebase at once, instead embrace the divide and conquer strategy which involves breaking smaller managable pieces to pinpoint and resolve issues.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Isolate the problem area-&lt;/strong&gt; Begin by identifying where the error or bug is occurring. This might be a specific function, module or a few lines of code. If you are unsure read the error message carefully which points you in the right direction by mentoring line numbers or function names.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Focus on the isolated area-&lt;/strong&gt; Once you have pinpointed the problem area, concentrate your efforts there.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Use print statements and logs-&lt;/strong&gt; Insert print statements or log messages strategically within the problem area to track variable values and the flow of your code which will help you understand what's happening and identify the root cause of the issue.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Test incrementally-&lt;/strong&gt; Test your code after each change make small controlled modifications and check if they resolve the problem. By incrementally testing you can identify the exact change that triggered or fixed the bug.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Utilize debugging tools
&lt;/h2&gt;

&lt;p&gt;Debugging tools are assets for programmers. They offer a more systematic and efficient approach to debugging. Let's explore some of the currently used debugging tools;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Integrated development environment debuggers-&lt;/strong&gt; Most modern IDEs' offer built-in debugging tools. These tools allow you to step through your code, inspect variables and watch how your program behaves in real time. Examples are; Visual studio, Code blocks, Eclipse.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Standalone debuggers-&lt;/strong&gt; Some programming languages have standalone debuggers which can use it to debug code that is not tied to a specific IDE. GDB stands for GNU debugger. It is a debugger used for debugging programs written in languages like C and C++.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Browser dev tools-&lt;/strong&gt; When debugging web applications browser dev tools for example; google chrome dev tools, mozilla firefox dev tools and microsoft edge dev tools can be incredibly useful. They allow you to inspect web page elements, monitor requests and debug Javascript in real time.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Code reviews
&lt;/h2&gt;

&lt;p&gt;No matter how adept a programmer you are, another set of eyes can offer a fresh perspective. During a code review, a fellow developer examines your code for readability and logic errors. An experienced reviewer can spot logical errors, potential security vulnerabilities or inefficient code that might lead to performance issues. Code reviews also provide an opportunity for knowledge transfer within a team. As code is examined and discussed team members gain insights into different parts of the codebase. It fosters a collaborative environment where developers can learn from each other leading to a more skilled and cohesive team.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>learning</category>
    </item>
    <item>
      <title>The Future of Web Development in The Era of AI.</title>
      <dc:creator>Pauline Oraro</dc:creator>
      <pubDate>Sat, 11 Nov 2023 08:37:39 +0000</pubDate>
      <link>https://forem.com/paulineoraro/the-future-of-web-development-in-the-era-of-ai-2hm5</link>
      <guid>https://forem.com/paulineoraro/the-future-of-web-development-in-the-era-of-ai-2hm5</guid>
      <description>&lt;p&gt;Web development has come a long way since the early days of static HTML pages and simple Javascript animations. The world of web development is constantly evolving and with the rise of AI it is entering a new era. AI technologies have already started to revolutionize the web development landscape making websites smarter, more interactive and user-friendly. In this blog post, we will explore the impact of AI on web development.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Automated web development&lt;/strong&gt;&lt;br&gt;
One of the most significant changes brought about by AI is the automation of web development tasks. Automated web development is a modern approach to build websites and web applications that leverages automation and pre-built components to simplify the development process. Traditionally web developers have had to write extensive code for various functions like data processing, form validation and user authentication. Tools like AI-powered website builders and content managment systems have emerged, allowing users to create sophisticated websites without deep coding knowledge. This not only speeds up the development process but also makes web development more accessible to non-developers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Enhanced user experience&lt;/strong&gt;&lt;br&gt;
AI technologies are playing a crucial role in enhancing the way users interact with websites. Here's how AI contributes to this enhancement;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Chatbots and virtual assistants-&lt;/strong&gt; many websites now incorporate chatbots or virtual assistants that are powered by AI. These intelligent agents can engage with visitors in real time, answering their questions, assisting with tasks and provide information. They do this through natuaral language processing. By having these chatbots readily available, websites can offer instant support and guidance making the user's journey more convenient and efficient.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Personalization-&lt;/strong&gt; AI algorithms can analyze user behavior, preferences and past interactions with a website. This data is then used to create a highly personalized experience for each user. From recommending products or content suggestions, personalization makes users feel like the website understands and caters to their individual needs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Accessibility-&lt;/strong&gt; AI can make websites more inclusive by ensuring they are accessible to people with disabilities. Screen readers, voice assistants and other AI-driven tools can help users with visual or auditory impairments access and interact with websites ensuring a more inclusive and user-friendly experience for all.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Efficient navigation-&lt;/strong&gt; AI can improve website navigation by suggesting relevant links, offering search suggestions or guiding users to the information they seek. This ensures that users can easily find what they are looking for, reducing frustration and enhancing the overall experience.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Content generation and curation&lt;/strong&gt;&lt;br&gt;
Content creation is a time-consuming and labour-intensive aspect of web development. AI-powered content generators such as chat-GPT are already capable of producing human-like text making it easier to draft blog posts product descriptions and other content. AI can assist in creating and curating content, reducing the time and effort required by human content creators.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Improved S.E.O strategies-&lt;/strong&gt; Search engine optimization is an ever-evolving field in web development. AI is playing a pivotal role in enhancing S.E.O strategies. AI-driven S.E.O tools can analyze vast amounts of data including keyword trends, backlinks profiles and user behavior to fine-tune S.E.O efforts. They can predict algorithm changes, monitor rankings and suggest on-page improvements enabling web developers to stay ahead of the curve and higher search engine rankings.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Streamlined development process-&lt;/strong&gt; Developers can leverage AI for automated code generation, helping to reduce the time and effort required to write and debug code. Tools like Github Copilot use machine learning to assist developers in writing code more efficiently, offering code suggestions and autocompletions. Testing and quality assurance can also benefit from AI. Automated testing tools powered by AI can identify and report issues more quickly improving the overall quality of web applications. This ensures that web developers can deliver bug-free, reliable products to clients and end-users.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
The field of AI is in a constant state of evolution. To remain competitive, web developers need to stay updated on the latest AI developments and adapt to the changing landscape of web development.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>ai</category>
      <category>learning</category>
      <category>development</category>
    </item>
    <item>
      <title>Learn React By Building A React Finance Tracker.</title>
      <dc:creator>Pauline Oraro</dc:creator>
      <pubDate>Sat, 07 Oct 2023 11:19:00 +0000</pubDate>
      <link>https://forem.com/paulineoraro/learn-react-by-building-a-react-finance-tracker-4fpj</link>
      <guid>https://forem.com/paulineoraro/learn-react-by-building-a-react-finance-tracker-4fpj</guid>
      <description>&lt;p&gt;In today's fast paced world managing your finances effectively is a necessity. Keeping a close eye on your income and expenses can help you make informed financial decisions, save for your goals and achieve financial stability. Fortunately, technology has made this task more accessible and user-friendly than ever before. In this blog post, we will embark on a journey to create a powerful and customizable financial tracking tool using react.&lt;/p&gt;

&lt;p&gt;You can view the &lt;a href="https://github.com/Pauline-Oraro/finance-tracker" rel="noopener noreferrer"&gt;code&lt;/a&gt; and live &lt;a href="https://finance-tracker-orpin.vercel.app/" rel="noopener noreferrer"&gt;demo&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This is what we will be building;&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%2Fwadm0udgp4kd72lho99m.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%2Fwadm0udgp4kd72lho99m.PNG" alt="Financial Tracker"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The user can;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Add income and expenses which have a name and a cost.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Remove/delete the transactions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;View the balance.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;View their total income and expenses.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Table of contents
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Prerequisites.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Setting up the project.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Display the financial details.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Disply the transaction details.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The financial tracker&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;Before we dive into the tutorial, make sure you have the following;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Node.js and npm- Ensure you have Node.js and npm(Node Package Manager) installed on your machine. You can download and install them from the &lt;a href="https://nodejs.org/en" rel="noopener noreferrer"&gt;official Node.js website&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Basic understanding of React- Familiarize yourself with the basics of React if you haven't already. You can check out the &lt;a href="https://react.dev/learn" rel="noopener noreferrer"&gt;official react documentation&lt;/a&gt; for a quick start.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Code editor- You can use a code editor of your choice.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Setting up the project &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Let's start by creating a new react application using create-react-app. Open your terminal and run 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;npx create-react-app finance-tracker
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command will create a new React project named "finance-tracker". Once the project is created, navigate to the project directory;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd finance-tracker
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next we are going to install a package that allows us to generate ID's, run 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;npm i uuid
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Jump into the src folder and create a new folder called components. Within the components folder create other three folders.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;moneyDetails&lt;/strong&gt;- It shows the balance, income and expenses. It has two files; &lt;strong&gt;detail.js and details.css&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;transactionItem&lt;/strong&gt; - It contains the history of all transactions and has two files; &lt;strong&gt;item.js and item.css.&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;moneyManager&lt;/strong&gt; - It is the financial tracker which allows users to add, view and delete transactions. It has two files; &lt;strong&gt;manager.js and manager.css&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here is what the folder structure should look like;&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%2Fjbt1429t9sk1fc2vq9r7.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%2Fjbt1429t9sk1fc2vq9r7.PNG" alt="finance tracker folder structure"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Display the financial details &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import './details.css';

//responsible for rendering the balance, income and expenses
const MoneyDetails = props =&amp;gt;{
    //represent the financial values for balance, income and expenses
    const {balanceAmount, incomeAmount, expensesAmount} = props
    return (
        &amp;lt;div className="money-details-container"&amp;gt;
            &amp;lt;div className="balance-container"&amp;gt;
                &amp;lt;img 
                src = "/balance-sheet.png"
                alt="balance"
                className='details-img'
                /&amp;gt;
                &amp;lt;div&amp;gt;
                    &amp;lt;p className='details-text'&amp;gt;Your Balance&amp;lt;/p&amp;gt;
                    &amp;lt;p className='details-money' testid="balanceAmount"&amp;gt; Ksh {balanceAmount}&amp;lt;/p&amp;gt;
                &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
            &amp;lt;div className='income-container'&amp;gt;
                &amp;lt;img 
                src = "/growth.png"
                alt='income'
                className='details-img'
                /&amp;gt;
                &amp;lt;div&amp;gt;
                    &amp;lt;p className='details-text'&amp;gt;Your Income&amp;lt;/p&amp;gt;
                    &amp;lt;p className='details-money' testid="incomeAmount"&amp;gt;Ksh {incomeAmount}&amp;lt;/p&amp;gt;
                &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
            &amp;lt;div className='expenses-container'&amp;gt;
                &amp;lt;img 
                src='/expenses.png'
                alt='expenses'
                className='details-img'
                /&amp;gt;
                &amp;lt;div&amp;gt;
                    &amp;lt;p className='details-text'&amp;gt;Your Expenses&amp;lt;/p&amp;gt;
                    &amp;lt;p className='details-money' testid="expensesAmount"&amp;gt;Ksh {expensesAmount}&amp;lt;/p&amp;gt;
                &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;
    )
}


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

&lt;/div&gt;



&lt;p&gt;Let's head into the &lt;strong&gt;details.js&lt;/strong&gt; file which is in the &lt;strong&gt;moneyDetails&lt;/strong&gt; folder and type the above code.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;MoneyDetails&lt;/strong&gt; component is responsible for rendering a summary of financial information which include balance, income and expenses with the provided values.&lt;/p&gt;

&lt;p&gt;The component takes three props; &lt;strong&gt;balanceAmount, incomeAmount and expensesAmount&lt;/strong&gt;. They represent the financial values for balance, income, expenses. Props are like arguments passed into react components. They are like function arguments in Javascript and attributes in HTML.&lt;/p&gt;

&lt;h2&gt;
  
  
  Display all transactions details &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//display the history of the user's transactions
const TransactionItem = props =&amp;gt; {
    const {transactionDetails, deleteTransaction} = props
    //represent the details of a transaction
    const {id, title, amount, type} = transactionDetails

    //it is called when the delete button is clicked
    const onDeleteTransaction = () =&amp;gt; {
        deleteTransaction(id)
    }

    return (
        &amp;lt;li className='table-row'&amp;gt;
            &amp;lt;p className='transaction-text'&amp;gt;{title}&amp;lt;/p&amp;gt;
            &amp;lt;p className='transaction-text'&amp;gt;Ksh {amount}&amp;lt;/p&amp;gt;
            &amp;lt;p className='transaction-text'&amp;gt;{type}&amp;lt;/p&amp;gt;
            &amp;lt;div className='delete-container'&amp;gt;
                &amp;lt;button className='delete-button' type='button' onClick={onDeleteTransaction} testid="delete"&amp;gt;
                    &amp;lt;img 
                    className='delete-img'
                    src="/bin.png"
                    alt='delete'
                    /&amp;gt;
                &amp;lt;/button&amp;gt;
            &amp;lt;/div&amp;gt;
        &amp;lt;/li&amp;gt;
    )
}

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

&lt;/div&gt;



&lt;p&gt;Let's head into the &lt;strong&gt;item.js&lt;/strong&gt; file which is in the &lt;strong&gt;transactionItem&lt;/strong&gt; folder and type the above code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TransactionItem&lt;/strong&gt; component is a functional component that displays all transaction details and allows the user to delete any transaction by clicking the delete button. It takes a single argument &lt;strong&gt;"props"&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;transactionDetails and deleteTransaction&lt;/strong&gt; are destructured from the &lt;strong&gt;"props"&lt;/strong&gt; object. It allows the component to access these props easily.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;transactionDetails&lt;/strong&gt; is further destructured to extract four properties; &lt;strong&gt;id, title, amount, type&lt;/strong&gt;. These properties represent the details of a transactions.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;onDeleteTransaction&lt;/strong&gt; function is called when the delete button is clicked and responsible for deleting the transaction. It takes no arguments and simply calls the &lt;strong&gt;deleteTransaction&lt;/strong&gt; function with the id of the current transaction as an argument.&lt;/p&gt;

&lt;p&gt;The return statement contains the JSX code that defines the structure of the transaction item. The paragraph displays the title, amount and type of the transaction. When the delete button is clicked it triggers the &lt;strong&gt;onDeleteTransaction&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The financial tracker &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { v4 } from 'uuid';
import TransactionItem from '../transactionItem/item';
import MoneyDetails from '../moneyDetails/details';
import React from 'react';

//an array that represents transaction types: income and expenses
const transactionTypeOptions = [
    {
        optionId: 'INCOME',
        displayText: 'Income',
    },
    {
        optionId: 'EXPENSES',
        displayText: 'Expenses',
    },
];

class MoneyManager extends React.Component {
    state = {
        transactionsList: [],
        titleInput: '',
        amountInput: '',
        optionId: transactionTypeOptions[0].optionId,
    }

    deleteTransaction = id =&amp;gt; {
        const {transactionsList} = this.state;
        const updatedTransactionList = transactionsList.filter(
        eachTransaction =&amp;gt; id !== eachTransaction.id,
    )
        this.setState({
        transactionsList: updatedTransactionList,
    })
    }


    onAddTransaction = event =&amp;gt; {
            event.preventDefault()
            const {titleInput, amountInput, optionId} = this.state
            const typeOption = transactionTypeOptions.find(
        eachTransaction =&amp;gt; eachTransaction.optionId === optionId,
    )
            const {displayText} = typeOption
            const newTransaction = {
        id: v4(),
        title: titleInput,
        amount: parseInt(amountInput),
        type: displayText,
    }
    this.setState(prevState =&amp;gt; ({
        transactionsList: [...prevState.transactionsList, newTransaction],
        titleInput: '',
        amountInput: '',
        optionId: transactionTypeOptions[0].optionId,
    }))
    }

    onChangeOptionId = event =&amp;gt; {
    this.setState({optionId: event.target.value})
    }

    onChangeAmountInput = event =&amp;gt; {
    this.setState({amountInput: event.target.value})
    }

    onChangeTitleInput = event =&amp;gt; {
    this.setState({titleInput: event.target.value})
    }

    getExpenses = () =&amp;gt; {
        const {transactionsList} = this.state
        let expensesAmount = 0

        transactionsList.forEach(eachTransaction =&amp;gt; {
        if (eachTransaction.type === transactionTypeOptions[1].displayText) {
        expensesAmount += eachTransaction.amount
        }
    })

    return expensesAmount;
    }

    getIncome = () =&amp;gt; {
        const {transactionsList} = this.state
        let incomeAmount = 0
        transactionsList.forEach(eachTransaction =&amp;gt; {
        if (eachTransaction.type === transactionTypeOptions[0].displayText) {
        incomeAmount += eachTransaction.amount;
        }
    })

    return incomeAmount;
    }

    getBalance = () =&amp;gt; {
    const {transactionsList} = this.state
    let balanceAmount = 0
    let incomeAmount = 0
    let expensesAmount = 0

    transactionsList.forEach(eachTransaction =&amp;gt; {
        if (eachTransaction.type === transactionTypeOptions[0].displayText) {
        incomeAmount += eachTransaction.amount
        } else {
        expensesAmount += eachTransaction.amount
        }
    })

    balanceAmount = incomeAmount - expensesAmount

    return balanceAmount
    }

    render() {
        const {titleInput, amountInput, optionId, transactionsList} = this.state
        const balanceAmount = this.getBalance()
        const incomeAmount = this.getIncome()
        const expensesAmount = this.getExpenses()

        return (
        &amp;lt;div className="app-container"&amp;gt;
        &amp;lt;div className="responsive-container"&amp;gt;
            &amp;lt;div className="header-container"&amp;gt;
            &amp;lt;h1 className="heading"&amp;gt;Finance Tracker &amp;amp;#128176;&amp;lt;/h1&amp;gt;
            &amp;lt;/div&amp;gt;
            &amp;lt;MoneyDetails
                balanceAmount={balanceAmount}
                incomeAmount={incomeAmount}
                expensesAmount={expensesAmount}
            /&amp;gt;
            &amp;lt;div className="transaction-details"&amp;gt;
            &amp;lt;form className="transaction-form" onSubmit={this.onAddTransaction}&amp;gt;
                &amp;lt;h1 className="transaction-header"&amp;gt;Add Transaction&amp;lt;/h1&amp;gt;
                &amp;lt;label className="input-label" htmlFor="title"&amp;gt;
                    TITLE
                &amp;lt;/label&amp;gt;
                &amp;lt;input
                    type="text"
                    id="title"
                    value={titleInput}
                    onChange={this.onChangeTitleInput}
                    className="input"
                /&amp;gt;
                &amp;lt;label className="input-label" htmlFor="amount"&amp;gt;
                    AMOUNT
                &amp;lt;/label&amp;gt;
                &amp;lt;input
                    type="text"
                    id="amount"
                    className="input"
                    value={amountInput}
                    onChange={this.onChangeAmountInput}
                /&amp;gt;
                &amp;lt;label className="input-label" htmlFor="select"&amp;gt;
                    TYPE
                &amp;lt;/label&amp;gt;
                &amp;lt;select
                    id="select"
                    className="input"
                    value={optionId}
                    onChange={this.onChangeOptionId}
                &amp;gt;
                    {transactionTypeOptions.map(eachOption =&amp;gt; (
                    &amp;lt;option key={eachOption.optionId} value={eachOption.optionId}&amp;gt;
                        {eachOption.displayText}
                    &amp;lt;/option&amp;gt;
                ))}
                &amp;lt;/select&amp;gt;
                &amp;lt;button type="submit" className="button"&amp;gt;ADD&amp;lt;/button&amp;gt;
            &amp;lt;/form&amp;gt;
            &amp;lt;div className='hTransactions'&amp;gt;
            &amp;lt;div className="history-transactions"&amp;gt;
                &amp;lt;h1 className="transaction-header"&amp;gt;History&amp;lt;/h1&amp;gt;
                &amp;lt;div className="transactions-table-container"&amp;gt;
                    &amp;lt;ul className="transactions-table"&amp;gt;
                    &amp;lt;li className="table-header"&amp;gt;
                        &amp;lt;p className="table-header-cell" &amp;gt;Title&amp;lt;/p&amp;gt;
                        &amp;lt;p className="table-header-cell" &amp;gt;Amount&amp;lt;/p&amp;gt;
                        &amp;lt;p className="table-header-cell" &amp;gt;Type&amp;lt;/p&amp;gt;
                    &amp;lt;/li&amp;gt;
                    {transactionsList.map(eachTransaction =&amp;gt; (
                    &amp;lt;TransactionItem
                        key={eachTransaction.id}
                        transactionDetails={eachTransaction}
                        deleteTransaction={this.deleteTransaction}
                    /&amp;gt;
                    ))}
                &amp;lt;/ul&amp;gt;
                &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;

            &amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;
    )
    }
}

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

&lt;/div&gt;



&lt;p&gt;Let's head into the &lt;strong&gt;manager.js&lt;/strong&gt; file which is in the &lt;strong&gt;moneyManager&lt;/strong&gt; folder and type the above code.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;MoneyManager&lt;/strong&gt; component serves as a financial tracker which allows users to add, view and delete transactions, categorize them as income or expenses.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;transactionTypeOptions&lt;/strong&gt; is an array that contains two objects representing transaction types which are income and expenses. Each object has an &lt;strong&gt;optionId&lt;/strong&gt; and a &lt;strong&gt;displayText&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;MoneyManager&lt;/strong&gt; is a class component and it contains;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;state&lt;/strong&gt;- it keeps track of;&lt;br&gt;
         - &lt;strong&gt;transactionsList&lt;/strong&gt; - an array to store individual transactions.&lt;br&gt;
         - &lt;strong&gt;titleInput&lt;/strong&gt; - a string to represent the title of a new transaction.&lt;br&gt;
         - &lt;strong&gt;amountInput&lt;/strong&gt; - a string to represent the amount of a new transaction.&lt;br&gt;
         - &lt;strong&gt;optionId&lt;/strong&gt; - the selected transaction type from the dropdown menu. It is initially set to the first option from &lt;strong&gt;transactionTypeOptions&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;deleteTransaction&lt;/strong&gt;- It takes an id as an argument and is responsible for removing a transaction from the &lt;strong&gt;transactionsList&lt;/strong&gt; array. It uses the filter method to create a new array that contains transactions where the id does not match the id provided as an argument to the &lt;strong&gt;deleteTransaction&lt;/strong&gt;. The state is then updated to reflect the updated list of transactions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;onAddTransaction&lt;/strong&gt; - It is called when the user submits the transaction form. It prevents the default form submission extract the &lt;strong&gt;titleInput, amountInput and optionId&lt;/strong&gt; from the component's state. It finds the corresponding transaction type either(income or expenses) from the &lt;strong&gt;transactionTypeOptions&lt;/strong&gt; array. It creates a new transaction. It updates the component state, appends the &lt;strong&gt;newTransaction&lt;/strong&gt; to the existing &lt;strong&gt;transactionList&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;onChangeOptionId, onChangeAmountInput and onChangeTitleInput&lt;/strong&gt; are used to handle changes in the input fields and the selection of transaction type. They update the corresponding fields in the component's state.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;getExpenses&lt;/strong&gt; calculates the total expenses by iterating through the &lt;strong&gt;transactionsList&lt;/strong&gt; and summing up the amounts of transactions with the expense type.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;getIncome&lt;/strong&gt; calculates the total income by iterating through the &lt;strong&gt;transactionsList&lt;/strong&gt; and summing up the amounts of transactions with the income type.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;getBalance&lt;/strong&gt; calculates the balance by subtracting total expenses from total income.&lt;/p&gt;

&lt;p&gt;You can style your application with my css styling or you can customize your own styling. You can check out the &lt;a href="https://github.com/Pauline-Oraro/finance-tracker" rel="noopener noreferrer"&gt;code&lt;/a&gt; and live &lt;a href="https://finance-tracker-orpin.vercel.app/" rel="noopener noreferrer"&gt;demo&lt;/a&gt;.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Building A Simple React Login Form: A Step By Step Guide.</title>
      <dc:creator>Pauline Oraro</dc:creator>
      <pubDate>Sat, 23 Sep 2023 07:57:55 +0000</pubDate>
      <link>https://forem.com/paulineoraro/building-a-simple-react-login-form-a-step-by-step-guide-17g1</link>
      <guid>https://forem.com/paulineoraro/building-a-simple-react-login-form-a-step-by-step-guide-17g1</guid>
      <description>&lt;p&gt;In today's digital age, user authentication is a fundamental aspect of web development. Whether you are building a social media platform, an e-commerce site or a personal blog you need a login form to secure user data. In this step-by-step guide we will walk you through the process of building a simple login form using react. By the end of this tutorial you will have a functional login form that you can integrate into your React application. You can view the &lt;a href="https://github.com/Pauline-Oraro/react-login-form" rel="noopener noreferrer"&gt;code&lt;/a&gt; and live &lt;a href="https://react-login-form-one.vercel.app/" rel="noopener noreferrer"&gt;demo&lt;/a&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  Table of contents
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Prerequisites.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Setting up the project.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Creating the LoginForm component in App.js.&lt;br&gt;
           1. The App component.&lt;br&gt;
           2. The LoginForm component.&lt;br&gt;
           3. Constructor.&lt;br&gt;
           4. handleChange() method.&lt;br&gt;
           5. handleSubmit() method.&lt;br&gt;
           6. validate() method.&lt;br&gt;
           7. render() method.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Conclusion.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;Before we dive into the tutorial, make sure you have the following;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Node.js and npm-&lt;/strong&gt; Ensure you have Node.js and npm(Node Package Manager) installed on your machine. You can download and install them from the official &lt;a href="https://nodejs.org/en" rel="noopener noreferrer"&gt;Node.js website&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Basic understanding of React-&lt;/strong&gt; Familiarize yourself with the basics of React if you haven't already. You can check out the official &lt;a href="https://react.dev/learn" rel="noopener noreferrer"&gt;react documentation&lt;/a&gt; for a quick start.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Code editor-&lt;/strong&gt; You can use a code editor of your choice.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Setting up the project &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Let's start by creating a new react application using create-react-app. Open your terminal and run the following command;&lt;/p&gt;

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

npx create-react-app react-login-form


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

&lt;/div&gt;

&lt;p&gt;This command will create a new React project named "react-login-form". Once the project is created, navigate to the project directory;&lt;/p&gt;

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

cd react-login-form


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

&lt;/div&gt;

&lt;p&gt;Now you can open the project in your favourite code editor. Here is what the folder structure should look like;&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%2Feaihqmxzcxs6uof2r4ke.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%2Feaihqmxzcxs6uof2r4ke.PNG" alt="folder structure"&gt;&lt;/a&gt;&lt;br&gt;
We will work primarily within the &lt;strong&gt;src&lt;/strong&gt; directory for this tutorial.&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating the LoginForm component in App.js &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;This component defines a simple registration form with validation. The form allows users to input their username, email address, password and confirm password. Here is a step by step explanation of the code;&lt;/p&gt;


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

&lt;p&gt;import React from 'react';&lt;br&gt;
import './App.css';&lt;/p&gt;

&lt;p&gt;function App() {&lt;br&gt;
  class LoginForm extends React.Component{&lt;br&gt;
    constructor(){&lt;br&gt;
      super();&lt;br&gt;
      this.state = {&lt;br&gt;
        //holds the users values for the form fields&lt;br&gt;
        input: {},&lt;br&gt;
        //holds errors that occur during form submission&lt;br&gt;
        errors: {}&lt;br&gt;
      };&lt;br&gt;
      this.handleChange = this.handleChange.bind(this);&lt;br&gt;
      this.handleSubmit = this.handleSubmit.bind(this);&lt;br&gt;
    }&lt;br&gt;
    //called when the user interacts with any input field&lt;br&gt;
    handleChange(event){&lt;br&gt;
      let input = this.state.input;&lt;br&gt;
      //identify the input field based on its name attribute&lt;br&gt;
      input[event.target.name] = event.target.value;&lt;br&gt;
      this.setState({input})&lt;br&gt;
    }&lt;br&gt;
    //called when the form is submitted&lt;br&gt;
    handleSubmit(event){&lt;br&gt;
      //prevents the default form submission behavior&lt;br&gt;
      event.preventDefault();&lt;br&gt;
      //calls the validate function to check the validity of the form inputs and if it is valid the form is submitted&lt;br&gt;
      if (this.validate()){&lt;br&gt;
        console.log(this.state);&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    let input = {};
    input["username"] = "";
    input["email"] = "";
    input["password"] = "";
    input["confirm_password"] = "";
    this.setState({input : input});

    alert("Form is submitted");
  }
}

validate() {
  let input = this.state.input;
  let errors = {};
  let isValid = true;

  //checks if the username is null or undefined
  if (!input["username"]){
    isValid = false;
    errors["username"] ="Please enter your username";
  }

  if (typeof input["username"] !== "undefined"){
    const re = /^\S*$/;
    if(input["username"].length &amp;amp;lt; 6 || !re.test(input["username"])){
      isValid = false;
      errors["username"] = "Please enter valid username"
    }
  }

  if(!input["email"]){
    isValid = false;
    errors["email"] = "Please enter your email address"
  }

  if(typeof input["email"] !== "undefined"){
    var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
    if(!pattern.test(input["email"])){
      isValid = false;
      errors["email"] = "Please enter a valid email address"
    }
  }

  if(!input["password"]){
    isValid = false;
    errors["password"] = "Please enter your password"
  }


  if(typeof input["password"] !== "undefined"){
    var patternPassword = new RegExp("^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&amp;amp;amp;*])(?=.{8,})");
    if(!patternPassword.test(input["password"])){
      isValid = false;
      errors["password"] = "The password should contain atleast one lowercase, one uppercase, one digit and one special character. The password should be atleast 8 characters long."
    }
  }

  if ( typeof input["password"] !== "undefined" &amp;amp;amp;&amp;amp;amp; typeof input["confirm_password"] !== "undefined"){
    if (input["password"] !== input["confirm_password"]){
      isValid = false;
      errors["confirm_password"] = "Passwords don't match"
    }
  }

  this.setState({errors: errors});

  return isValid;
}
render(){
  return(
    &amp;amp;lt;div className='container'&amp;amp;gt;
      &amp;amp;lt;h1 className='text-center mb-4'&amp;amp;gt;REGISTRATION FORM&amp;amp;lt;/h1&amp;amp;gt;
      &amp;amp;lt;form onSubmit={this.handleSubmit}&amp;amp;gt;
        &amp;amp;lt;div className='form-group'&amp;amp;gt;
          &amp;amp;lt;label for="username" className='form-label fs-5 fw-bold'&amp;amp;gt;USERNAME:&amp;amp;lt;/label&amp;amp;gt;
          &amp;amp;lt;input
          type="text"
          name="username"
          value={this.state.input.username}
          onChange={this.handleChange}
          className='form-control fs-5'
          placeholder='Enter username'
          id="username"
          /&amp;amp;gt;
          &amp;amp;lt;div className='text-danger form-text fw-bold fs-5'&amp;amp;gt;{this.state.errors.username}&amp;amp;lt;/div&amp;amp;gt;
        &amp;amp;lt;/div&amp;amp;gt;
        &amp;amp;lt;div className='form-group'&amp;amp;gt;
          &amp;amp;lt;label for="email" className='form-label fs-5 fw-bold'&amp;amp;gt;EMAIL ADDRESS:&amp;amp;lt;/label&amp;amp;gt;
          &amp;amp;lt;input
          type="text"
          name="email"
          value={this.state.input.email}
          onChange={this.handleChange}
          className='form-control fs-5'
          placeholder='Enter Email'
          id="email"
          /&amp;amp;gt;
          &amp;amp;lt;div className='text-danger form-text fw-bold fs-5'&amp;amp;gt;{this.state.errors.email}&amp;amp;lt;/div&amp;amp;gt;

          &amp;amp;lt;div className='form-group'&amp;amp;gt;
            &amp;amp;lt;label for="password" className='form-label fs-5 fw-bold'&amp;amp;gt;PASSWORD:&amp;amp;lt;/label&amp;amp;gt;
            &amp;amp;lt;input 
            type="password"
            name="password"
            value={this.state.input.password}
            onChange={this.handleChange}
            className='form-control fs-5'
            placeholder='Enter password'
            id="password"
            /&amp;amp;gt;
            &amp;amp;lt;div className='text-danger form-text fw-bold fs-5'&amp;amp;gt;{this.state.errors.password}&amp;amp;lt;/div&amp;amp;gt;
          &amp;amp;lt;/div&amp;amp;gt;

          &amp;amp;lt;div className='form-group'&amp;amp;gt;
            &amp;amp;lt;label for="confirm-password" className='form-label fs-5 fw-bold'&amp;amp;gt;CONFIRM PASSWORD:&amp;amp;lt;/label&amp;amp;gt;
            &amp;amp;lt;input 
            type="password"
            name="confirm-password"
            id="confirm-password"
            value={this.state.input.confirm_password}
            onChange={this.handleChange}
            className='form-control fs-5'
            placeholder='Enter confirm password'
            /&amp;amp;gt;
            &amp;amp;lt;div className='text-danger form-text mb-5 fw-bold fs-5'&amp;amp;gt;{this.state.errors.confirm_password}&amp;amp;lt;/div&amp;amp;gt;
          &amp;amp;lt;/div&amp;amp;gt;


        &amp;amp;lt;/div&amp;amp;gt;
        &amp;amp;lt;input 
          type="submit"
          value="SUBMIT"
          className='btn btn-success d-flex justify-content-center mx-auto mb-3 px-3'
          /&amp;amp;gt;
      &amp;amp;lt;/form&amp;amp;gt;
    &amp;amp;lt;/div&amp;amp;gt;
  )
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;}&lt;br&gt;
  return (&lt;br&gt;
    &amp;lt;div className="App"&amp;gt;&lt;br&gt;
      &amp;lt;LoginForm/&amp;gt;&lt;br&gt;
    &amp;lt;/div&amp;gt;&lt;br&gt;
  );&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;export default App;&lt;/p&gt;

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

&lt;/div&gt;
&lt;h3&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  The App component &lt;a&gt; &lt;/a&gt;&lt;br&gt;
&lt;/h3&gt;

&lt;p&gt;This is the main component of the application. It contains the entire registration form.&lt;/p&gt;

&lt;h3&gt;
  
  
  The LoginForm component &lt;a&gt;&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;LoginForm&lt;/strong&gt; is a nested class component within the &lt;strong&gt;App&lt;/strong&gt; component. It represents the registration form itself.&lt;/p&gt;

&lt;h3&gt;
  
  
  Constructor &lt;a&gt;&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;The &lt;strong&gt;super()&lt;/strong&gt; statement executes the parent component constructor function and your &lt;strong&gt;LoginForm&lt;/strong&gt; component has access to all the functions of the parent component(&lt;strong&gt;React.Component&lt;/strong&gt;).&lt;br&gt;
The component state is initialized with two properties; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;input which holds the user input values.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;errors which hold any validation errors that occur during form submission.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The &lt;strong&gt;handleChange&lt;/strong&gt; and &lt;strong&gt;handleSubmit&lt;/strong&gt; methods are bound to the component using &lt;strong&gt;bind&lt;/strong&gt; it ensures that "&lt;strong&gt;this&lt;/strong&gt;" inside these methods refers to the &lt;strong&gt;LoginForm&lt;/strong&gt; component.&lt;/p&gt;

&lt;h3&gt;
  
  
  handleChange() method &lt;a&gt;&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;It is called whenever the user interacts with any input fields in the form. &lt;br&gt;
It;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Retrieves the current input state.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Updates the value of the corresponding input field based on the name attribute of the input element that triggered the event.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Sets the updated input state using &lt;strong&gt;this.setState&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  handleSubmit() method &lt;a&gt;&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;It is called when the form is submitted. It prevents the default form submission behavior using &lt;strong&gt;event.preventDefault()&lt;/strong&gt;. It calls the &lt;strong&gt;validate&lt;/strong&gt; method to check the validity of the form inputs. If form is valid based on the validate method it logs the current state, clears the input fields and displays an alert message indicating that the form was submitted.&lt;/p&gt;

&lt;h3&gt;
  
  
  validate() method &lt;a&gt;&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;It is responsible for validating the form inputs. It initializes &lt;strong&gt;input, errors, isValid&lt;/strong&gt; as variables.&lt;/p&gt;

&lt;p&gt;It checks if the username is empty and adds an error message to &lt;strong&gt;errors&lt;/strong&gt; if it is empty. It checks if the username follows a pattern(atleast 6 characters without spaces) and adds an error message if it doesn't follow the pattern.&lt;/p&gt;

&lt;p&gt;It checks if the email is empty and adds an error message if it is empty. It validates the email address format using a regular expression and if it doesn't match it adds an error message.&lt;/p&gt;

&lt;p&gt;It checks if the password is empty and adds an error message if it is empty. It validates the password against a regular expression(atleast one lowercase, one uppercase, one digit, one special character and atleast 8 characters long). If the given password doesn't match the regular expression, it adds an error message.&lt;/p&gt;

&lt;p&gt;It checks if the confirm password matches the password.&lt;/p&gt;

&lt;p&gt;It updates the &lt;strong&gt;errors&lt;/strong&gt; state with any validation errors and returns &lt;strong&gt;isValid&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  render() method &lt;a&gt;&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;It returns the JSX for rendering the form.&lt;/p&gt;

&lt;p&gt;Each input field is associated with a name, value and onChange event handler. The value of each input field is bound to the corresponding property in the input state and the &lt;strong&gt;handleChange() method&lt;/strong&gt; is called when the user interacts with the field.&lt;/p&gt;

&lt;p&gt;Error messages are displayed below each input field based on the &lt;strong&gt;errors&lt;/strong&gt; state.&lt;/p&gt;

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

&lt;p&gt;In conclusion, this code defines a React application that contains a registration form component &lt;strong&gt;(LoginForm)&lt;/strong&gt; with input validation. The registration form includes fields for username, email, password, and confirm password, and it provides error messages for each field when validation fails. Key points to note are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The &lt;strong&gt;LoginForm&lt;/strong&gt; component manages its state to store user input values and validation errors.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Input values and errors are updated in the component's state as users interact with the form.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The &lt;strong&gt;validate&lt;/strong&gt; method checks the validity of form inputs based on specific criteria (e.g., username length, email format, password complexity, and password confirmation).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When the form is submitted, it prevents the default behavior, performs input validation, and displays an alert if the form is submitted successfully.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Upon successful submission, the form fields are cleared, and a success message is displayed.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can view the &lt;a href="https://github.com/Pauline-Oraro/react-login-form" rel="noopener noreferrer"&gt;code&lt;/a&gt; and live &lt;a href="https://react-login-form-one.vercel.app/" rel="noopener noreferrer"&gt;demo&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>react</category>
      <category>tutorial</category>
      <category>programmers</category>
    </item>
    <item>
      <title>Mastering Javascript: Building An Interactive Shopping List App.</title>
      <dc:creator>Pauline Oraro</dc:creator>
      <pubDate>Sat, 16 Sep 2023 15:57:57 +0000</pubDate>
      <link>https://forem.com/paulineoraro/mastering-javascript-building-an-interactive-shopping-list-app-3j4f</link>
      <guid>https://forem.com/paulineoraro/mastering-javascript-building-an-interactive-shopping-list-app-3j4f</guid>
      <description>&lt;p&gt;Javascript is the backbone of modern web development. It empowers developers to create dynamic and interactive web applications that can engage users in various ways. In this blog post we will embark on a journey to master Javascript by building a practical web application: an interactive shopping list app. Whether you are a beginner or an experienced developer looking to enhance your Javascript skills, this project will help you gain valuable insights into the language core concepts. You can view the live demo &lt;a href="https://codepen.io/Pauline-Oraro/pen/ExOwVJL"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  Table of contents
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Setting up the project&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;HTML Structure&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;CSS Structure&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Javascript Structure&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Conclusion&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Setting up the project &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Before diving into coding ensure that you have;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;A code editor (codepen, visual studio code or any of your choice).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A web browser.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A basic understanding of HTML, CSS and Javascript.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  HTML Structure &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Start by building the foundation of your shopping list app with HTML. A typical structure might include;&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 id="header"&amp;gt;
  &amp;lt;h1&amp;gt;Shopping List &amp;amp;#128221;&amp;lt;/h1&amp;gt;
  &amp;lt;h2&amp;gt;Add what you will buy&amp;lt;/h2&amp;gt;
  &amp;lt;input id="inputText" type="text"&amp;gt;
  &amp;lt;button onclick="addToList()"&amp;gt;ADD&amp;lt;/button&amp;gt;
  &amp;lt;ul id="list"&amp;gt;&amp;lt;/ul&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Styling with CSS &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Make your app visually appealing by styling it with CSS. You can design your shopping list however you like, but here is an example, I used SCSS.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;body{
  background-color: #171515;
  font-size: 1.35em;
  #header{
    background-color: #6F5B3E;
    margin: 30px auto;
    padding: 20px 20px 30px;
    text-align: center;
    h1{
      font-family: cursive;
      text-decoration-line: underline;
    } 
    h2{
      font-family: cursive;
    } 
    #inputText{
      font-size: 1.15em;
      font-family: monospace;
      padding: 8px;
      width: 50%;
      background-color: #F9F6F0;
      border: 3px solid #F9F6F0;
      border-radius: 10px; 
    } 
    button{
      font-size: 1.15em;
      font-family: monospace;
      font-weight: bolder;
      padding: 5px;
      margin-left: 20px;
      border: 3px solid #F9F6F0;
      border-radius: 10px;
      background-color: #F9F6F0;
    } 
    #list{
      list-style-type: none;
      margin: 20px auto;
      padding:0;
      font-family: monospace;
      font-size: 1.15em;
    } 
    li{
      font-weight: bold;
      padding: 10px;
    } 
    li:nth-child(even) {
      background-color: #C4AE78;
    } 
    li:nth-child(odd) {
      background-color: #F9F6F0;
    } 
    span.close{
      position: absolute;
      right: 0;
      padding-right: 30px;
      cursor: pointer;
    }
  } 
} 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Javascript Structure &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;This Javascript code defines a function named "&lt;strong&gt;addToList()&lt;/strong&gt;" and adds an event listener to the "&lt;strong&gt;document.body&lt;/strong&gt;" to handle the removal of items from a shopping list when the "&lt;strong&gt;X&lt;/strong&gt;" button is clicked. Let us break down the code;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//add value to list item 
function addToList() {
  //get value from input
  var value=document.getElementById("inputText").value;
  //alert that the text box is empty 
  if(value === "") {
    alert("To add an item type its name into the box") 
  } else {
    //create list item element
    var li=document.createElement("li");
    var textNode =document.createTextNode(value);
    //append value to the list element
    li.appendChild(textNode);
  document.getElementById("list").appendChild(li);
    li.className="item";
    //add X to each list element
    var close=document.createElement("span");
    var closeNode=document.createTextNode("X");
    close.appendChild(closeNode);
    li.appendChild(close);
    close.className="close";
  } 
} 
//have X remove list item when clicked
document.body.addEventListener("click", function(event){
  if(event.target.className == "close") 
    event.target.parentElement.style.display="none"
} );
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Function addToList()&lt;/strong&gt;&lt;br&gt;
This function is called when the "&lt;strong&gt;ADD&lt;/strong&gt;" button is clicked as indicated by the onclick attribute in the HTML code below.&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;button onclick="addToList()"&amp;gt;ADD&amp;lt;/button&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It performs the following actions;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The variable named value&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; var value=document.getElementById("inputText").value;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This line retrieves the value entered in the input field with the id "&lt;strong&gt;inputText&lt;/strong&gt;" and stores it in the value variable.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;if structure&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if(value === "") {
    alert("To add an item type its name into the box") 
  } else {
    //create list item element
    var li=document.createElement("li");
    var textNode =document.createTextNode(value);
    //append value to the list element
    li.appendChild(textNode);
  document.getElementById("list").appendChild(li);
    li.className="item";
    //add X to each list element
    var close=document.createElement("span");
    var closeNode=document.createTextNode("X");
    close.appendChild(closeNode);
    li.appendChild(close);
    close.className="close";
  } 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It checks if the "&lt;strong&gt;value&lt;/strong&gt;" is an empty string. If the input is empty it displays an alert message instructing the user to type the name of the item into the input box.&lt;br&gt;
If the input is not empty, the function proceeds to create a new list item "&lt;strong&gt;(&amp;lt;"li"&amp;gt;)&lt;/strong&gt;" element, appends the entered text to it, adds a close button represented by an "&lt;strong&gt;X&lt;/strong&gt;" and appends this list item to the unordered list "&lt;strong&gt;(&amp;lt;"ul"&amp;gt;)&lt;/strong&gt;" with the id called &lt;strong&gt;list&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Event listener&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;document.body.addEventListener("click", function(event){
  if(event.target.className == "close") 
    event.target.parentElement.style.display="none"
} );
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It listens for clicks anywhere on the page and executes the provided function when a click event occurs. The function takes an "&lt;strong&gt;event&lt;/strong&gt;" object as a parameter.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;It checks if the clicked element has a class name equal to "&lt;strong&gt;close&lt;/strong&gt;" which corresponds to the "&lt;strong&gt;X&lt;/strong&gt;" button.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If the clicked element has the "&lt;strong&gt;close&lt;/strong&gt;" class, it sets the "&lt;strong&gt;style.display&lt;/strong&gt;" property of the parent element (the list item) to none effectively hiding the list item from view.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;In summary this Javascript code allows users to add items to a shopping list by entering text in an input field and clicking the "&lt;strong&gt;ADD&lt;/strong&gt;" button. Each item is added as a list item with a corresponding "&lt;strong&gt;X&lt;/strong&gt;" button to remove it. The event listener on the document body ensures that when the "&lt;strong&gt;X&lt;/strong&gt;" button is clicked the corresponding list item is hidden from view. You can view the live demo &lt;a href="https://codepen.io/Pauline-Oraro/pen/ExOwVJL"&gt;here&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>tutorial</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>Mastering The Fetch API In Javascript: A Comprehensive Guide.</title>
      <dc:creator>Pauline Oraro</dc:creator>
      <pubDate>Sat, 09 Sep 2023 12:33:16 +0000</pubDate>
      <link>https://forem.com/paulineoraro/mastering-the-fetch-api-in-javascript-a-comprehensive-guide-53io</link>
      <guid>https://forem.com/paulineoraro/mastering-the-fetch-api-in-javascript-a-comprehensive-guide-53io</guid>
      <description>&lt;p&gt;In the realm of web development, handling network requests and fetching data from servers is a common task. The fetch API in Javascript has become the go to solution for making HTTP requests that offers a more modern and user-friendly approach compared to XMLHttpRequest. In this guide, we will delve into the fetch API, exploring its capabilities, syntax and best practises to empower you to master this essential tool for web development.&lt;/p&gt;

&lt;h4&gt;
  
  
  Table of contents
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Defination of terms&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;What is Fetch API&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Fetch API syntax&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Let's create a random user generator&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Conclusion&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Defination of terms &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Meaning of A.P.I&lt;/strong&gt;&lt;br&gt;
A.P.I stands for application programming interface. It is a software intermediary that allows two applications to communicate with each other. They are an accessible way to extract and share data within and across applications.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;XMLHttpRequest&lt;/strong&gt;&lt;br&gt;
It is an object in Javascript that allow you to make HTTP requests to a web server from a web page. It is commonly used to retrieve data from a server without requiring the entire web page to be refreshed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;HTTP Requests&lt;/strong&gt;&lt;br&gt;
The Hypertext Transfer Protocol is designed to enable web clients such as browsers to request resources like webpages, images or data from web servers. HTTP methods define the action to be performed on the resource. The methods are;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;get-&lt;/strong&gt; retrieve data from the server.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;post-&lt;/strong&gt; send data to the server to be processed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;put-&lt;/strong&gt; update an existing resource on the server.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;delete-&lt;/strong&gt; remove a resource from the server.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  What is Fetch API &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;The fetch API is a Javascript interface that provides a straightfoward and flexible way to make network requests. It allows you to fetch resources such as webpages, images or other files from servers using HTTP or HTTPS protocols. The fetch API uses promises making it more elegant and easier to work with asynchronous operations.&lt;/p&gt;
&lt;h2&gt;
  
  
  Fetch API syntax &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;fetch(url)  
    .then(response =&amp;gt; response.json())
    .then(data =&amp;gt; console.log(data))
    .catch(err =&amp;gt; console.error(err));
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;The fetch (url) initiates a get request to the specified url. This part sends the request and returns a promise that resolves to the response from the server.&lt;/p&gt;

&lt;p&gt;The first ".then()" in the promise chain takes the response returned from the fetch call and calls the ".json()" method on it. This method parses the response body as JSON.&lt;/p&gt;

&lt;p&gt;The second ".then()" takes the parsed JSON data returned from the previous ".then()" and logs it into the console.&lt;/p&gt;

&lt;p&gt;The catch block will catch the error and log it into the console.&lt;/p&gt;
&lt;h2&gt;
  
  
  Let's create a random user generator &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;This project example fetches and displays a random user data from the specified url when a button is clicked. You can view the live demo here &lt;a href="https://codepen.io/Pauline-Oraro/pen/MWZJymL"&gt;random user generator&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var img = document.querySelector("img");
var fullname = document.querySelector("#fullname");
var username = document.querySelector("#username");
var email = document.querySelector("#email");
var city = document.querySelector("#city");
var gender = document.querySelector("#gender");
var btn = document.querySelector("button");
var url = 'https://randomuser.me/api';

btn.addEventListener("click", function(){
  fetch(url)
  .then(handleErrors)
  .then(parseJSON)
  .then(updateProfile)
  .catch(printErrors)
})

function handleErrors(res){
  if (!res.ok){
    throw Error("There are some errors:" + res.status)
  }
  return res;
}

function parseJSON(res){
  return res.json().then(function(parsedData){
    return parsedData.results[0];
  });
}

function updateProfile(data){
  img.src = data.picture.medium;
  fullname.innerText = "Name: " + data.name.first + " " + data.name.last;
  username.innerText = "Username: " + data.login.username;
  gender.innerText = "Gender: " + data.gender;
  email.innerText = "Email: " + data.email;
  city.innerText = "City: " + data.location.city;
}

function printErrors(error){
  console.log(error);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;HTML elements&lt;/strong&gt;&lt;br&gt;
Select various HTML elements using the document.querySelector and assigns them to variables.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;event listener&lt;/strong&gt;&lt;br&gt;
Add an event listener to the "btn" element for the click event. When the button is clicked it triggers a sequence of actions using the fetch API to retrieve random user data from the specified url.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;fetch url&lt;/strong&gt;&lt;br&gt;
It is chained with several ".then()" and "catch()" methods to handle the asynchronous flow of data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;handleErrors() function&lt;/strong&gt;&lt;br&gt;
It is called in the ".then()" block after the initial fetch. It checks if the response from the API is successful (HTTP status code 200) using "res.ok". If there is an error (the API returns an error status code) it throws an error with a message including the HTTP status code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;parseJSON () function&lt;/strong&gt;&lt;br&gt;
It is called after the response is successfully retrieved. It parses the response as JSON data using ".json()" method and returns the first result from the parsed data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;updateProfile() function&lt;/strong&gt;&lt;br&gt;
It takes the parsed data and updates various HTML elements on the page with user's information.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;printErrors() function&lt;/strong&gt;&lt;br&gt;
If any error occurs at any point in the promise chain they are caught and handled by the function which logs the errors to the console.&lt;/p&gt;

&lt;p&gt;In summary, when the button is clicked this code makes an API request to the specified url, handles any potential errors, parses the response as JSON data and updates the page with the retrieved user's information or logs an error if something goes wrong.&lt;br&gt;
It is a simple example of making an API request and updating a web page with the fetched data.&lt;/p&gt;

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

&lt;p&gt;In the world of modern web development, the Fetch API has become an indispensable tool for fetching data asynchronously. Its simplicity, versatility, and seamless integration with Promises make it a valuable asset in building responsive and dynamic web applications. By mastering the Fetch API, you open the doors to a world of possibilities in creating powerful and efficient web solutions.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>api</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>A Beginner's Guide To Understand Application Programming Interface.</title>
      <dc:creator>Pauline Oraro</dc:creator>
      <pubDate>Wed, 06 Sep 2023 16:32:05 +0000</pubDate>
      <link>https://forem.com/paulineoraro/a-beginners-guide-to-understand-application-programming-interface-5ca9</link>
      <guid>https://forem.com/paulineoraro/a-beginners-guide-to-understand-application-programming-interface-5ca9</guid>
      <description>&lt;p&gt;In today's digital age, we always hear about application programming interface or API's in short. What exactly are API's and why are they important in the world of technology? They play a fundamental role in modern software development and the digital services we use daily. In this guide we will demystify API's, explain what they are, how they work and why they matter.&lt;/p&gt;

&lt;h3&gt;
  
  
  Table of contents
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;What is an application programming interface&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;How an API works&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Types of API's&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Real world examples of API's&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Advantages of API's&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Disadvantages of API's&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Conclusion&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What is an application programming interface &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;An application programming interface is a set of rules and protocols that allow different software applications to communicate and interact with each other. It serves as a bridge between two separate software systems enabling them to exchange data and function properly.&lt;/p&gt;

&lt;h2&gt;
  
  
  How an API works &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Initialization-&lt;/strong&gt; The API provider creates and publishes the API along with docs that describe how to use it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Request-&lt;/strong&gt; A developer initiates communication by sending a request to a specific endpoint of the API. This request typically includes the following components;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;endpoint-&lt;/strong&gt; The URL that represents the specific resources the developer wants to access.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;HTTP methods-&lt;/strong&gt; specifies the type of action to be performed on the resource such as get, post, put and delete.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;headers-&lt;/strong&gt; contain more information about the request.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;parameters-&lt;/strong&gt; additional data that is needed for the request often passed as query parameters in the URL or as part of the request body.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Authentication and Authorization-&lt;/strong&gt; some API's require authentication to ensure that only authorized users or applications can access their resources. It is typically done using API keys, OAuth tokens and so on. It helps to check the credentials provided in the request to determine if the requester has the necessary permissions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Server processing-&lt;/strong&gt; the server processes the request based on the information provided which includes understanding the request methods, headers and parameters as well as ensuring proper authentication and authorization if required.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Response-&lt;/strong&gt; after processing the request the server generates a response which includes;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;data-&lt;/strong&gt; the requested data often in a structured format like JSON.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;HTTP status code-&lt;/strong&gt; a code that indicates the outcome of the request eg; 200 for success, 404 for not found and 500 for server error.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;headers-&lt;/strong&gt; additional information about the response such as content type and length.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Client handling-&lt;/strong&gt; the client receives the response from the server and processes it according to the information provided which may involve displaying the retrieved data to the user.&lt;/p&gt;

&lt;h2&gt;
  
  
  Types of API's &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Ownership
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Open API's-&lt;/strong&gt; they are publicly available to developers with minimal restrictions. They may require registration, use an API key or OAuth tokens. They focus on external users to access data or services.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Internal API's-&lt;/strong&gt; they are designed for internal use within an organization and are hidden from the outside world.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Partner API's-&lt;/strong&gt; they are exposed to business partners and are not publicly available and need specific entitlement to access them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Composite API's-&lt;/strong&gt; combines different data and services API's. You can use them if you need data from various applications or data sources.&lt;/p&gt;

&lt;h3&gt;
  
  
  Architecture
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Representational state transfer(R.E.S.T)-&lt;/strong&gt; it is a widely used architectural style that uses standard HTTP methods to interact with resources identified by URLs. REST messages are typically simpler and use lightweight data formats like JSON, XML, YAML, plain text or HTML for data exchange. However, REST does not prescribe a specific data format. REST APIs follow a stateless communication model, meaning each request from a client to a server must contain all the information needed to understand and process the request. REST is more lightweight and is commonly used for public APIs, web services, and mobile applications. It's well-suited for scenarios where simplicity, scalability, and ease of use are important.&lt;/p&gt;

&lt;h3&gt;
  
  
  Protocol
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Simple object access protocol(S.O.A.P)-&lt;/strong&gt; SOAP is a protocol for exchanging structured information in the implementation of web services. It means that it has a defined set of rules and standards for structuring messages. It specifies how data should be formatted, transmitted, and processed. SOAP messages are typically formatted as XML documents. These XML messages have a specific structure with an envelope, header, and body. SOAP is inherently stateful, meaning it can support complex transactions and operations. It includes features like message sequencing and guaranteed message delivery, which make it suitable for applications that require strong reliability and consistency.  SOAP is often used in enterprise-level applications, web services that require strong security and transaction support.&lt;/p&gt;

&lt;h3&gt;
  
  
  System
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Database API's-&lt;/strong&gt; They enable communication between an application and a database managment system.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Web API's-&lt;/strong&gt; are API's that deliver requests from web applications and responses from servers using Hypertext Transfer Protocol.&lt;/p&gt;

&lt;h2&gt;
  
  
  Real world examples of API's &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Weather Data-&lt;/strong&gt; Weather services like OpenWeatherMap have APIs that developers can use to fetch current weather conditions and forecasts for specific locations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Maps and location services-&lt;/strong&gt; Google Maps offer APIs that developers use to embed interactive maps and location-based features into their apps.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Social Media-&lt;/strong&gt; Apps like Facebook, Twitter, and Instagram offer APIs that allow developers to integrate their platforms into other apps. For instance, you can log into a website using your Facebook credentials.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Payment processing-&lt;/strong&gt; PayPal and Stripe provides APIs that enable businesses to accept online payments and manage their financial transactions securely.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;News and content-&lt;/strong&gt; News outlets like The New York Times offer APIs to access their articles and media content for integration into news apps and websites.&lt;/p&gt;

&lt;h2&gt;
  
  
  Advantages of API's &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Security-&lt;/strong&gt; APIs provide a controlled and secure way to access data and functionality. Authentication, authorization, and rate limiting can be implemented at the API level to protect sensitive information and resources.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Real-Time updates-&lt;/strong&gt; Many APIs offer real-time data and updates, ensuring that applications have access to the most current information.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Analytics and Insights-&lt;/strong&gt; APIs often come with built-in analytics tools that allow developers and businesses to monitor how their services are used. This data can be used to make informed decisions and optimize offerings.&lt;/p&gt;

&lt;h2&gt;
  
  
  Disadvantages of API's &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Latency and performance-&lt;/strong&gt;  The performance of your application may be affected by the latency introduced by external API calls. Slow or unreliable APIs can lead to a poor user experience.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Rate limits-&lt;/strong&gt; Many APIs impose rate limits on the number of requests you can make within a specific time frame. This can be a limitation if your application requires frequent or high-volume access to the API.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Costs-&lt;/strong&gt; Some APIs are not free, and their usage can incur costs, which can become significant if your application relies heavily on them. Pricing models for APIs vary, and it's essential to understand the pricing structure before integrating them into your application.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion &lt;a&gt;&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;In essence, APIs serve as intermediaries that enable different software components to collaborate and share data, functionalities, or services seamlessly. They allow developers to focus on building innovative applications without needing to understand all the intricacies of the systems they are connecting to.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>beginners</category>
      <category>api</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>A Beginner's Guide To Javascript async / await.</title>
      <dc:creator>Pauline Oraro</dc:creator>
      <pubDate>Fri, 01 Sep 2023 10:45:10 +0000</pubDate>
      <link>https://forem.com/paulineoraro/a-beginners-guide-to-javascript-async-await-37kh</link>
      <guid>https://forem.com/paulineoraro/a-beginners-guide-to-javascript-async-await-37kh</guid>
      <description>&lt;p&gt;Javascript is a powerful programming language used extensively in web development. When building web applications, you often encounter tasks that require fetching data from external sources or executing time-consuming operations. Handling these tasks asynchronously is crucial to ensure your application remains responsive and efficient. One of the essential tools for asynchronous programming in Javascript is async and await keywords. In this guide we'll explore what async and await keywords are, how they work and how to use them effectively in your code.&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Javascript callbacks&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Understanding the meaning of asynchronous&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Javascript promises&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Introducing async and await keywords&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Benefits of async and await&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Conclusion&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Javascript callbacks &lt;a&gt;&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;Before we understand the async and await keywords, we must know what are callbacks in Javascript. &lt;br&gt;
A callback is a function that is passed as an argument to another function. It allows a function to call another function and it runs after another function is finished.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function myFirst(a){
    document.write(a)
}
function myCalculator(num1, num2, myCallback){
    let sum = num1 + num2;
    myCallback(sum)
}

myCalculator(10, 10, myFirst);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the code above, myFirst is a callback function which is passed as an argument in the myCalculator function.&lt;/p&gt;

&lt;h3&gt;
  
  
  Understanding the meaning of asynchronous &lt;a&gt;&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;Before diving into async and await , let's briefly understand the meaning of asynchronous in Javascript.&lt;/p&gt;

&lt;p&gt;In a synchronous program, code execution happens sequentially. This means one operation must complete before the next one begins. However, when dealing with tasks like data fetching from an API or reading a file or waiting for the operation to be completed can make your application feel slow or unresponsive.&lt;/p&gt;

&lt;p&gt;In an asynchronous program it allows your code to execute tasks without waiting for the each task to complete.&lt;br&gt;
Most modern asynchronous Javascript methods don't use callbacks, instead asynchronous programming is solved using promises.&lt;/p&gt;
&lt;h3&gt;
  
  
  Javascript promises &lt;a&gt;&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;A promise is an object that represents the completion or failure of an asynchronous operation. They provide a way to work with asynchronous code in a more organized and readable manner.&lt;br&gt;
A promise exists in one of these states;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Pending - initial state when the promise is created.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Fulfilled - the state when the asynchronous operation is successfully completed. The promise holds a result value.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Rejected - the state when the asynchronous operation encounters an error or fails. The promise holds an error value.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A promise that is either resolved or rejected is called settled.&lt;br&gt;
The promise methods are;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;then() - it specifies what should happen when a promise is fulfilled. It takes two callback functions which are optional as arguments, one for fulfillment and one for rejection.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;catch() - it specifies what should happen when a promise is rejected.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;finally() - it specifies a callback that should be executed regardless of whether the promise is fulfilled or rejected.&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;let promise = new Promise(function(resolve, reject){
    setTimeout(() =&amp;gt; {
        const randomValue = Math.random();

        if (randomValue &amp;lt; 0.5) {
            resolve(`success random value: ${randomValue}`)
        } else {
            reject(`error random value: ${randomValue}`)
        }
    }, 2000)
});

promise
    .then((value) =&amp;gt; {
        console.log("Promise resolved:", value)
})
    .catch((error) =&amp;gt; {
        console.log("Promise rejected:", error)
})
    .finally(() =&amp;gt; {
        console.log("Promise operation completed, regardless of success or failure.")
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;Promise constructor&lt;/strong&gt;&lt;br&gt;
A new promise is created using the promise constructor. The constructor takes a single argument which is called the executor function.&lt;br&gt;
The executor function has two parameters which are resolve and reject. They are provided by the promise system to signal the successful resolution or the rejection of the promise.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;setTimeout function&lt;/strong&gt;&lt;br&gt;
Inside the executor function, a setTimeout function is used to simulate an asynchronous operation with a 2 second delay. After the delay a random value is generated using &lt;strong&gt;Math.random&lt;/strong&gt;.&lt;br&gt;
If the randomValue is less than 0.5, the resolve function is generated indicating a successful resolution of the promise. If the randomValue is greater than 0.5, the reject function is called indicating a rejection of the promise.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;methods&lt;/strong&gt;&lt;br&gt;
After the promise is created, it can be consumed using the then(), catch() and finally() methods.&lt;br&gt;
If the promise is successful the then() callback will be executed, if it is rejected the catch() callback will be executed. The finally() callback executes regardless of the promise outcome.&lt;/p&gt;

&lt;p&gt;But there is a more better way to write asynchronous code which is using async and await keywords. They make the asynchronous code more readable and easy to manage. They are built on top of Javascript promises.&lt;/p&gt;
&lt;h3&gt;
  
  
  Introducing async and await keywords &lt;a&gt;&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;async and await were introduced in ECMAScript 2017(ES8). They take asynchronous programming a step further by providing a synchronous-like syntax.&lt;br&gt;
&lt;strong&gt;async keyword&lt;/strong&gt;&lt;br&gt;
The async keyword is for a function that is supposed to perform an asynchronous operation. It is used to define a function that returns a promise.&lt;br&gt;
&lt;strong&gt;await keyword&lt;/strong&gt;&lt;br&gt;
The await keyword is used inside an async function to pause the execution until a promise is settled(resolved or rejected). It allows you to write asynchronous code that looks and behaves more like synchronous code making it easier to manage complex asynchronous flows.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function fetchData() {
    return new Promise((resolve) =&amp;gt; {
        setTimeout(() =&amp;gt; {
            const data = {message:"Data fetched successfully"}
            resolve(data);
        },3000)
    })
}
async function fetchDataAsync(){
    try {
        const result = await fetchData()
        console.log(result.message);
    } catch (error){
        console.error("Error fetching data", error);
    }
}

fetchDataAsync();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;fetchData function&lt;/strong&gt;&lt;br&gt;
The fetchData function returns a promise and inside the promise there is a setTimeout function which simulates a delay of 3 seconds. After the delay, it resolves the promise with an object data containing a message.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;fetchDataAsync&lt;/strong&gt;&lt;br&gt;
The fetchDataAsync is an asynchronous function declared with the async keyword. It uses the await keyword to call the fetchData function. It means that the execution of the fetchDataAsync will pause until the promise returned by fetchData is resolved.&lt;/p&gt;

&lt;p&gt;If the promise is resolved successfully without errors the result is stored in the result variable then the message is displayed in the console.&lt;/p&gt;

&lt;p&gt;The try and catch block is used to handle potential errors that might occur during the asynchronous operation. If there was an error during the promise resolution, the catch block will catch the error and log an error message along which the specific error that occured.&lt;/p&gt;

&lt;h3&gt;
  
  
  Benefits of async and await &lt;a&gt;&lt;/a&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Readability&lt;/strong&gt; - asynchronous code written with async and await is easier to read and understand compared to nested callbacks or chained promises.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Error-handling&lt;/strong&gt; - error handling is simplified through try and catch blocks which makes it easier to manage errors.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Synchronous-like flow&lt;/strong&gt; - asynchronous code written with async and await looks and behaves like synchronous code making it easier for developers to reason about its flow.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Conclusion &lt;a&gt;&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;Asynchronous programming is a cornerstone of modern JavaScript development, and async and await are powerful tools that streamline the process. They provide a way to handle asynchronous operations in a synchronous-like manner, resulting in more readable, maintainable, and efficient code.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>beginners</category>
      <category>coding</category>
    </item>
    <item>
      <title>Building A B.M.I Calculator using Typescript</title>
      <dc:creator>Pauline Oraro</dc:creator>
      <pubDate>Sat, 19 Aug 2023 06:59:14 +0000</pubDate>
      <link>https://forem.com/paulineoraro/building-a-bmi-calculator-using-typescript-26ah</link>
      <guid>https://forem.com/paulineoraro/building-a-bmi-calculator-using-typescript-26ah</guid>
      <description>&lt;p&gt;In today's tech driven world, health and wellness are a paramount importance so is the ability to leverage programming to aid in various aspects of our lives. In this article, we will embark on an exciting journey to create a Body Mass Index calculator using Typescript-a powerful and statically-typed superset of Javascript. Understanding BMI is crucial for assessing one's health and by the end of this tutorial, you will have a functional tool that can help users calculate their BMI based on their weight and height.&lt;/p&gt;

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

&lt;p&gt;The Body Mass Index is a measure that uses your height and weight to work out if your weight is healthy. The calculation is a person's weight in kg divided by the square of height in meters.&lt;br&gt;
If your BMI is;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Below 18.5- underweight range.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Between 28.5 and 24.9- you are in the healthy weight range.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Between 25 and 29.9- you are in the overweight range.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;30 or over- you are in the obese range.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Setting up the project
&lt;/h2&gt;

&lt;p&gt;Before you begin ensure you have &lt;a href="https://nodejs.org/en"&gt;Node.js&lt;/a&gt; and &lt;a href="https://www.typescriptlang.org/download"&gt;Typescript&lt;/a&gt; installed.&lt;/p&gt;

&lt;p&gt;Create a project folder called bmi and the bmi folder should have build and src folders. In the build folder it should contain HTML and CSS files and in the src folder it should contain a Typescript file.&lt;/p&gt;

&lt;p&gt;Go to the terminal and type;&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;This creates a typescript configuration file named tsconfig.json which specifies how Typescript should compile your code and what settings to use.&lt;br&gt;
Open it and make the following changes;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"rootDir": "./src"
"outDir": "./build/JS"
"include":["src"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When you run the Typescript compiler, it will look for Typescript files in the src directory compile them and place the compiled files in the build/JS directory.&lt;br&gt;
The include option specifies which files should be included in the compilation process, so Typescript will include all Typescript files within the src directory.&lt;/p&gt;

&lt;p&gt;After that, type this into the terminal;&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;This watches for changes in your Typescript files and recompiles them as needed.&lt;br&gt;
This is the folder structure;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NNMVnpMY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nhdoa8n81iuakj3tpt2g.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NNMVnpMY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nhdoa8n81iuakj3tpt2g.PNG" alt="folder structure" width="222" height="224"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Create the HTML file
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div class="container"&amp;gt;
        &amp;lt;h1&amp;gt;BMI CALCULATOR&amp;lt;/h1&amp;gt;

        &amp;lt;!-- displays the calculated bmi value and its category--&amp;gt;
        &amp;lt;div class="display"&amp;gt;
            &amp;lt;p id="result"&amp;gt;20.0&amp;lt;/p&amp;gt;
            &amp;lt;p id="category"&amp;gt;Normal Weight&amp;lt;/p&amp;gt;
        &amp;lt;/div&amp;gt;

        &amp;lt;!--a range slider for selecting the weight--&amp;gt;
        &amp;lt;div class="row"&amp;gt;
            &amp;lt;input type="range" min="20" max="200" value="20" id="weight" oninput="calculate()"&amp;gt;
            &amp;lt;span id="weight-val"&amp;gt;20kg&amp;lt;/span&amp;gt;
        &amp;lt;/div&amp;gt;

        &amp;lt;!--a range slider for selecting the height--&amp;gt;
        &amp;lt;div class="row"&amp;gt;
            &amp;lt;input type="range" min="100" max="250" value="100" id="height" oninput="calculate()"&amp;gt;
            &amp;lt;span id="height-val"&amp;gt;100cm&amp;lt;/span&amp;gt;
        &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;script src="/build/JS/bmi.js"&amp;gt;&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;This HTML code provides a user interface for a BMI calculator where users can input their weight and height using range inputs and a display area for showing the calculated BMI value and its category.&lt;/p&gt;
&lt;h2&gt;
  
  
  Create a Typescript file.
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//the void type does not return any value
function calculate():void{
    //stores the calculated BMI as a string
    var bmi:string;
    //holds the reference to an HTML element with the id result
    var result = document.getElementById("result") as HTMLElement;
    //the height value is extracted from the input element and the value is converted into an integer
    var height= parseInt((document.getElementById("height") as HTMLInputElement).value);
    //the weight value is extracted from the input element and the value is converted into an integer
    var weight =parseInt((document.getElementById("weight") as HTMLInputElement).value);

    //displays weight and height values
    document.getElementById("weight-val")!.textContent = weight + "kg";
    document.getElementById("height-val")!.textContent = height + "cm";

    //calculate the BMI using the height and weight values and toFixed ensures the BMI is rounded to one decimal place 
    bmi = (weight / Math.pow(height / 100, 2)).toFixed(1);
    result.textContent = bmi;
    let category: string;

    //determines the BMI category based on the calculated BMI value
    if(parseFloat(bmi)&amp;lt; 18.5){
        category = "Underweight 😔";
        result.style.color= "#ffc44d";
        //checks if it is between 18.5 and 24.9
    } else if (parseFloat(bmi) &amp;gt;= 18.5 &amp;amp;&amp;amp; parseFloat(bmi) &amp;lt;= 24.9){
        category = "Normal weight 🤩";
        result.style.color = "#0be881";
        //checks if it is between 25 and 29.9
    } else if (parseFloat(bmi) &amp;gt;= 25 &amp;amp;&amp;amp; parseFloat(bmi) &amp;lt;= 29.9){
        category = "Overweight 😮";
        result.style.color = "#ff884d";
    } else {
        category = "Obese 😱";
        result.style.color = "#ff5e57";
    }

    //display BMI category
    document.getElementById("category")!.textContent = category;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;This Typescript code calculates the BMI based on user inputs, updates the displayed values and categories on the webpage and adjusts the text color based on the calculated BMI category. This code enables the BMI calculator interface to dynamically update as users interact with the height and weight sliders.&lt;/p&gt;
&lt;h2&gt;
  
  
  Create the CSS code
&lt;/h2&gt;

&lt;p&gt;Style the BMI calculator.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;*, *::before, *::after{
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

body{
    height: 100vh;
    font-family: monospace;
    background-color: #3D5B59;
}

.container{
    background-color: #bd8c92;
    padding: 10px 40px;
    width: 350px;
    margin: 50px auto;
    border-radius: 5px;
}

.container h1{
    text-align: center;
    font-size: 23px;
    margin: 20px auto;
    font-family: cursive;
}

.row{
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.display{
    margin-bottom: 30px;
    margin-top: 30px;
    font-size: 20px;
}

#result, #category{
    text-align: center;
    margin-right: 10px;
    font-weight: 1000;
}

.row span{
    margin-bottom: 20px;
    font-size: 20px;
    margin-right: 15px;
}

input[type=range]{
    width: 50%;
    margin-bottom: 20px;
    height: 5px;
    appearance: none;
    background-color: black;
    border-radius: 5px;
    outline: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb{
    appearance: none;
    height: 15px;
    Width: 15px;
    background-color: #B5E5CF;
    cursor: pointer;
    border-radius: 100%;
} 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can check out the code on my &lt;a href="https://github.com/Pauline-Oraro/bmi-typescript-calculator"&gt;github&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>tutorial</category>
      <category>typescript</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
