<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Brian Maina</title>
    <description>The latest articles on DEV Community by Brian Maina (@mainakibe).</description>
    <link>https://dev.to/mainakibe</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%2F579593%2F58d0acfa-a02b-4b3c-96de-2e403c45f080.jpg</url>
      <title>DEV Community: Brian Maina</title>
      <link>https://dev.to/mainakibe</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mainakibe"/>
    <language>en</language>
    <item>
      <title>Higher Order Components.</title>
      <dc:creator>Brian Maina</dc:creator>
      <pubDate>Sat, 16 Apr 2022 23:52:45 +0000</pubDate>
      <link>https://dev.to/mainakibe/higher-order-components-1637</link>
      <guid>https://dev.to/mainakibe/higher-order-components-1637</guid>
      <description>&lt;p&gt;Have you ever used React and felt compelled to duplicate the same logic across numerous components? I'm sure you're wondering if there's a method to reuse logic across multiple components in React without rewriting it. Yes, there is! Higher-Order Components (HOCs). HOCs offer an advanced approach to dealing with such cross-cutting concerns.&lt;br&gt;
In this tutorial, you'll explore HOCs in-depth, why there’s a need for HOCs, when to use the pattern, what's a HOC and finally, create a simple React app using HOCs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why’s there a need for a HOC?
&lt;/h2&gt;

&lt;p&gt;Imagine a client approached you, then asked you to create an App with a button indicating the number of times it’s clicked. You create a component called &lt;code&gt;ClickCounter&lt;/code&gt;, where you store the &lt;code&gt;button&lt;/code&gt; and its counter functionality. Export, then import and render it in the &lt;code&gt;App&lt;/code&gt; component.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/p5mC2S31"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--34twjZuX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/brTBRcg8/1.png" alt="1.png" width="880" height="623"&gt;&lt;/a&gt;&lt;br&gt;
After some time, the client comes back and asks you to add a heading indicating the number of times it’s hovered over. Basically a &lt;code&gt;ClickCounter&lt;/code&gt; with click functionality replaced by hover functionality. You create a new component called &lt;code&gt;HoverCounter&lt;/code&gt; which stores the heading and counter functionality. Export, then import and render it in the &lt;code&gt;App&lt;/code&gt; component under &lt;code&gt;ClickCounter&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/tZWFRV5W"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--57GjloUq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/vBShzrxq/2.png" alt="2.png" width="880" height="621"&gt;&lt;/a&gt;&lt;br&gt;
Again, the client comes back and asks you to add an input that counts the number of keypresses in the project. For Example A key up in an input element to increment a counter value and display it. You can of course implement it the same way you implemented the counter in &lt;code&gt;ClickCounter&lt;/code&gt; and &lt;code&gt;HoverCounter&lt;/code&gt;. But realize you are duplicating code and not really reusing the counter functionality. So if 10 different components needed the counter functionality you would write the same code over and over again.&lt;br&gt;
So how can you really reuse the counter functionality?&lt;br&gt;
The immediate thought is to lift &lt;code&gt;state&lt;/code&gt; from the parent component and pass it down the handler as a &lt;code&gt;prop&lt;/code&gt;. Define the counter functionality in &lt;code&gt;App&lt;/code&gt; component, provide the state and the handler as props to &lt;code&gt;ClickCounter&lt;/code&gt; and &lt;code&gt;HoverCounter&lt;/code&gt;. Since you only have two components, it would work. But imagine a scenario where the counter components are scattered across the React App. Lifting the &lt;code&gt;state&lt;/code&gt; would definitely not be the correct solution. So there’s a need to share common functionality among components without repeating code. That’s where the concept of HOCs comes in.&lt;/p&gt;

&lt;h2&gt;
  
  
  So when do you really use the HOC pattern?
&lt;/h2&gt;

&lt;p&gt;Basically HOCs allow you to share common functionality between components.&lt;/p&gt;

&lt;h2&gt;
  
  
  What’s a HOC?
&lt;/h2&gt;

&lt;p&gt;Basically, a HOC is a pattern where a function takes a component as an argument and returns a new component.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/jWsjnnty"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9ngTs_6v--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/25WLJnt9/3.png" alt="3.png" width="862" height="95"&gt;&lt;/a&gt;&lt;br&gt;
A HOC adds additional data or functionality to the component. The new component can be referred to an &lt;code&gt;EnhancedComponent&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/pmvW3593"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OiMheeg_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/pLhmhDPV/4.png" alt="4.png" width="880" height="94"&gt;&lt;/a&gt;&lt;br&gt;
From a non-technical point of view&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/bsrYPfL9"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hGy_I-NZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/CLHRjFqX/5.png" alt="5.png" width="573" height="114"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;withSuit&lt;/code&gt; is the function that will enhance &lt;code&gt;TonyStark&lt;/code&gt; and return &lt;code&gt;IronMan&lt;/code&gt; which is the &lt;code&gt;EnhancedComponent&lt;/code&gt;.&lt;br&gt;
From React's point of view we have function which accepts &lt;code&gt;OriginalComponent&lt;/code&gt; adds functionality and returns the &lt;code&gt;EnhancedComponent&lt;/code&gt;.&lt;br&gt;
Consider implementing a basic HOC then implement it with the counter example-&lt;br&gt;
Create a new file called &lt;code&gt;withCounter.js&lt;/code&gt; within the components folder.&lt;/p&gt;

&lt;h3&gt;
  
  
  Consider this example-
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/G9hT4NqH"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--A1JN-r_r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/QNcQyZ7k/6.png" alt="6.png" width="863" height="387"&gt;&lt;/a&gt;&lt;br&gt;
In the above example, the &lt;code&gt;UpdatedComponent&lt;/code&gt; is a function that takes a component called &lt;code&gt;OriginalComponent&lt;/code&gt; as an argument. You have created a new component called &lt;code&gt;NewComponent&lt;/code&gt; which returns the &lt;code&gt;OriginalComponent&lt;/code&gt; with a name &lt;code&gt;prop&lt;/code&gt; from its render function. While this actually adds no functionality, it depicts the common pattern that every HOC will follow.&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating a simple React app using HOCs.
&lt;/h2&gt;

&lt;p&gt;Apply the HOC pattern to the &lt;code&gt;ClickCounter&lt;/code&gt; and &lt;code&gt;HoverCounter&lt;/code&gt;. In &lt;code&gt;ClickCounter&lt;/code&gt; you will import &lt;code&gt;UpdatedComponent&lt;/code&gt; from &lt;code&gt;withCounter&lt;/code&gt; while exporting it will call the &lt;code&gt;UpdatedComponent&lt;/code&gt; function passing in the &lt;code&gt;ClickCounter&lt;/code&gt; component. You’ll do the same for &lt;code&gt;HoverCounter&lt;/code&gt;. Instead of exporting the &lt;code&gt;ClickCounter&lt;/code&gt; or &lt;code&gt;HoverCounter&lt;/code&gt; component you export the &lt;code&gt;UpdatedComponent&lt;/code&gt;. The HOC in addition to being the &lt;code&gt;ClickCounter&lt;/code&gt; or &lt;code&gt;HoverCounter&lt;/code&gt;.&lt;br&gt;
To modify your HOC so as to allow the counter functionality to be shared among components. You will cut the &lt;code&gt;constructor&lt;/code&gt;and &lt;code&gt;incrementCount&lt;/code&gt; function from &lt;code&gt;ClickCounter&lt;/code&gt; into the HOC. Since it’s the common functionality we want to share, remove the same code from &lt;code&gt;HoverCounter&lt;/code&gt;.&lt;br&gt;
You need to pass down the &lt;code&gt;state&lt;/code&gt; and &lt;code&gt;incrementCount&lt;/code&gt; method as &lt;code&gt;props&lt;/code&gt; so that the &lt;code&gt;OriginalComponent&lt;/code&gt; can make use of that functionality.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/wyY97JBQ"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lPO4t_cP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/MTvH3m2N/7.png" alt="7.png" width="619" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In both &lt;code&gt;ClickCounter&lt;/code&gt; and &lt;code&gt;HoverCounter&lt;/code&gt; you will destructure &lt;code&gt;count&lt;/code&gt; and &lt;code&gt;incrementCount&lt;/code&gt; from &lt;code&gt;this.props&lt;/code&gt;. If you look at the project, it functions as perfectly but the difference now is that you are reusing code instead of duplicating it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/6y71rMYh"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--egwKoEBV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/8PwQV3vx/8.png" alt="8.png" width="880" height="345"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/9428jCVx"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mO28J7Fb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/CKBWkx2V/9.png" alt="9.png" width="880" height="416"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, you can change the naming convention. The component and functions you have used are different from what you typically see. So change them. The function and file name is usually the same, it indicates the functionality being added to the components. The &lt;code&gt;OriginalComponent&lt;/code&gt; is usually referred to as the &lt;code&gt;WrappedComponent&lt;/code&gt;. The &lt;code&gt;NewComponent&lt;/code&gt; is usually the same as the function name, but in &lt;code&gt;Pascal case&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/Pvkb365v"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fe1TsDua--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/1X8Wz2xB/10.png" alt="10.png" width="595" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You’ll make the same changes to the naming convention while importing and exporting the HOC in the &lt;code&gt;ClickCounter&lt;/code&gt; and &lt;code&gt;HoverCounter&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/1VFYDHQt"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kFRc_1pG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/Rhp55spc/11.png" alt="11.png" width="880" height="384"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/d70H5vYg"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--EL5IqsIV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/8CR2PPnk/12.png" alt="12.png" width="880" height="411"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Before winding up consider these two things:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Passing down the &lt;code&gt;props&lt;/code&gt;.
In &lt;code&gt;App&lt;/code&gt; component you will pass a name &lt;code&gt;prop&lt;/code&gt; in the &lt;code&gt;ClickCounter&lt;/code&gt; component.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/9RGznDyf"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SJQSG-f1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/vBK9D9B5/13.png" alt="13.png" width="649" height="580"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Render the name &lt;code&gt;prop&lt;/code&gt; in &lt;code&gt;ClickCounter&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/nszQL4N9"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--eqEHA_zB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/GpPPqzQK/14.png" alt="14.png" width="726" height="617"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you go to the browser the name value is not displayed. This is a common mistake when starting off with HOCs. The problem here is that when you specified &lt;code&gt;props&lt;/code&gt; on the &lt;code&gt;ClickCounter&lt;/code&gt; component, the props are passed down to the HOC and not &lt;code&gt;ClickCounter&lt;/code&gt;. If you log out the name from in the HOC in the &lt;code&gt;render&lt;/code&gt; method. You can see you do have the name &lt;code&gt;prop&lt;/code&gt; for &lt;code&gt;ClickCounter&lt;/code&gt; and undefined for &lt;code&gt;HoverCounter&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/VJZwBnH8"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xUW-sgtI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/N0B0tx65/15.png" alt="15.png" width="880" height="44"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To fix this issue you need to pass down the remaining &lt;code&gt;props&lt;/code&gt; to the &lt;code&gt;WrappedComponent&lt;/code&gt; using the spread operator. Basically the HOC adds two &lt;code&gt;props&lt;/code&gt; to the &lt;code&gt;App&lt;/code&gt; component then passes down the remaining specified &lt;code&gt;props&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/23xSLbmz"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--amio6hHu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/8k2J3M0r/16.png" alt="16.png" width="526" height="163"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Passing parameters to the HOC function.
In the HOC instead of incrementing the value by 1. You would want to increment it by different numbers for both &lt;code&gt;Counter&lt;/code&gt; components. You can do that by passing a parameter to the HOC function.
First &lt;code&gt;WrappedComponent&lt;/code&gt; and second &lt;code&gt;incrementNumber&lt;/code&gt;. You will now increment the &lt;code&gt;incrementCount&lt;/code&gt; by the &lt;code&gt;incrementNumber&lt;/code&gt; parameter.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/fkywhvg4"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KCOatq-4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/9XtzZ8df/with-Counter.png" alt="with-Counter.png" width="880" height="553"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In &lt;code&gt;ClickCounter&lt;/code&gt; you will add a second argument 5 and &lt;code&gt;HoverCounter&lt;/code&gt; You will add 10.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/rRsyn17k"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--AjmftrVK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/rsCdpgJK/click-Counter.png" alt="click-Counter.png" width="880" height="487"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;Congratulations! 🚀 You’ve reused common functionality within components in your application. Following the methodology in this tutorial can reduce errors caused by duplicating code. I hope you enjoyed this tutorial!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Creating a Simple Horizontal Switchable Tabs Panel Using HTML, CSS &amp; JavaScript.</title>
      <dc:creator>Brian Maina</dc:creator>
      <pubDate>Tue, 08 Jun 2021 08:04:31 +0000</pubDate>
      <link>https://dev.to/mainakibe/creating-a-simple-horizontal-switchable-tabs-panel-using-html-css-javascript-e0l</link>
      <guid>https://dev.to/mainakibe/creating-a-simple-horizontal-switchable-tabs-panel-using-html-css-javascript-e0l</guid>
      <description>&lt;p&gt;Tabs are ideal for singular page web apps or websites with multiple subjects to display. In this tutorial, we shall create a simple web application with a horizontal switchable tabs panel. The web application can do the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Show the active tab.&lt;/li&gt;
&lt;li&gt;Switch between the tabs.&lt;/li&gt;
&lt;li&gt;Display the contents of each tab.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We will define the structure of the web application using HTML. Then render the elements on the screen using CSS and finally, add the functionality using some bit of Vanilla JavaScript. That's right, no fancy JavaScript framework is needed, just the simple Vanilla JavaScript we all know. Let's begin!&lt;/p&gt;

&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;p&gt;Before getting into the coding part of this project, ensure you have the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Intermediate level knowledge in HTML, CSS &amp;amp; JavaScript.&lt;/li&gt;
&lt;li&gt;Text editor or a codepen account.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 1: Setting up the HTML
&lt;/h2&gt;

&lt;p&gt;Essentially the HTML has a few levels of elements:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The wrapper of the tabbed panel.&lt;/li&gt;
&lt;li&gt;The sidebar&lt;/li&gt;
&lt;li&gt;The tab contents&lt;/li&gt;
&lt;li&gt;The actual tab buttons.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Begin by constructing the tab panel wrapper. Create a &lt;code&gt;div&lt;/code&gt;, give it a class, and call it &lt;code&gt;tabs&lt;/code&gt;; this will be the wrapper for the tab panel. Create a new &lt;code&gt;div&lt;/code&gt; inside the wrapper, give it a class, and title it &lt;code&gt;sidebar&lt;/code&gt;; this will contain the tab buttons. Create three buttons in the &lt;code&gt;sidebar&lt;/code&gt;, then give each one the &lt;code&gt;tab-btn&lt;/code&gt; class. To the first button, add a &lt;code&gt;tab-btn-active&lt;/code&gt; class. The active class will come in handy when specifying in the CSS and JavaScript what happens to the tab when the tab &lt;code&gt;button&lt;/code&gt; is clicked. Add HTML, CSS, and JavaScript as the names of the buttons, respectively. Add a &lt;code&gt;data for-tab=' '&lt;/code&gt; attribute to each of these buttons now. Add a tab number to the &lt;code&gt;data&lt;/code&gt; element to specify which &lt;code&gt;button&lt;/code&gt; corresponds to which tab. Tab 1, tab 2, and tab 3 are examples. In the JavaSript, the tab number is used to read the properties and select which tab to open.&lt;/p&gt;

&lt;p&gt;Create a parent &lt;code&gt;div&lt;/code&gt; underneath the sidebar and give it the class content to act as a wrapper for the tab contents. Create a new &lt;code&gt;div&lt;/code&gt; and give it the &lt;code&gt;tab-content&lt;/code&gt; class. Also, give the tab content &lt;code&gt;div&lt;/code&gt; a class called &lt;code&gt;tab-content-active&lt;/code&gt;. The active class will be used in CSS and JavaScript to indicate what happens to the tab when the tab &lt;code&gt;button&lt;/code&gt; is clicked.&lt;/p&gt;

&lt;p&gt;We'll map the &lt;code&gt;data-for-tab&lt;/code&gt; attribute within this &lt;code&gt;div&lt;/code&gt;, so add a &lt;code&gt;data-tab='1'&lt;/code&gt; property to it and give it a tab number of 1 to represent the first tab. You may now go ahead and fill the &lt;code&gt;div&lt;/code&gt; with some content. Do the same for tab two and three, but remove the &lt;code&gt;tab-content-active&lt;/code&gt; class and name their &lt;code&gt;data-tab&lt;/code&gt; attribute 2 and three respectively. Finally, add some bit of content.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/hfZyXNkY" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.postimg.cc%2F8zNq0StT%2F1.png" alt="1.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you're loading the page from the server, you might want to utilize loops or export the data so that the &lt;code&gt;data-tab&lt;/code&gt; values for tabs 1, 2, and 3 matches the &lt;code&gt;data-for-tab&lt;/code&gt; values. Make sure the &lt;code&gt;data-for-tab&lt;/code&gt; and &lt;code&gt;data-tab&lt;/code&gt; numbers match if you're not using any server-side code.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Styling the page
&lt;/h2&gt;

&lt;p&gt;We will first style the tab wrapper. Apply the following styles to the tab wrapper:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/JtPKF9zh" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.postimg.cc%2Fnct5Xx8q%2F2.png" alt="2.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thereafter apply the following styles to the sidebar and tab buttons:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/hX7rfvbJ" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.postimg.cc%2FQdfnYWFq%2F3.png" alt="3.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Afterwards, specify what will happen to the button once it gets clicked; that will be the &lt;code&gt;tab-btn-active&lt;/code&gt; class. When the button is clicked, it will apply the following styles to the &lt;code&gt;button&lt;/code&gt; element:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/478t8RQk" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.postimg.cc%2FwMzVj6tv%2F4.png" alt="4.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The following styles will be applied to the content, tab-content and tab-content classes:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/214ZsZ7x" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.postimg.cc%2FVkhWb9S2%2F5.png" alt="5.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;position absolute&lt;/code&gt; applied in the &lt;code&gt;tab-content&lt;/code&gt; class will stack the content the all the tabs. After that, &lt;code&gt;display none&lt;/code&gt; the contents of all the tabs.&lt;/p&gt;

&lt;p&gt;A &lt;code&gt;display block&lt;/code&gt; style is applied to the &lt;code&gt;tab-content-active&lt;/code&gt; class so as to display the content in the default tab, which is the first tab.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Add JavaScript
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Part 1:
&lt;/h3&gt;

&lt;p&gt;To begin the coding, create a method called &lt;code&gt;setupTabs&lt;/code&gt;. Then pick all the components with the &lt;code&gt;tab-btn&lt;/code&gt; class with a &lt;code&gt;querySelectorAll&lt;/code&gt;. When the &lt;code&gt;button&lt;/code&gt; is clicked, utilize the &lt;code&gt;forEach&lt;/code&gt; method on it to fire a &lt;code&gt;clickeventListener&lt;/code&gt; or a function. The content of the selected tab will be displayed using the &lt;code&gt;button function.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/N9P967QQ" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.postimg.cc%2FKjmPyJV3%2F6.png" alt="6.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Part 2:
&lt;/h3&gt;

&lt;p&gt;Define the following constants to represent the tabs wrapper, sidebar, tab number and tab content to activate:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/GHD8DyV1" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.postimg.cc%2FL6CzrkVh%2F7.png" alt="7.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;const sidebar = button.parentElement&lt;/code&gt; will start at the &lt;code&gt;button&lt;/code&gt;, then go to the parent element, the &lt;code&gt;sidebar&lt;/code&gt;. &lt;code&gt;const tabs = sidebar.parentElement&lt;/code&gt; selects the parent element of the sidebar, which is the tab wrapper. &lt;code&gt;const tabNumber = button.dataset.forTab&lt;/code&gt;, the &lt;code&gt;dataset&lt;/code&gt; refers to any attributes that start with a &lt;code&gt;data-&lt;/code&gt; attribute. The JavaScript will convert the snake-case format of the &lt;code&gt;dataset&lt;/code&gt; into camel-case. The forTab refers to the value in the &lt;code&gt;data-for-tab&lt;/code&gt; attribute. Now to get the actual tab content to activate, we use the &lt;code&gt;const tabActivate =tabs.querySelector()&lt;/code&gt; then inside the &lt;code&gt;querySelector&lt;/code&gt; we pass &lt;code&gt;.tab-content[data-tab="${tabNumber}"]&lt;/code&gt; to select the tab content element with data-tab equals to the number gotten  after clicking the tab.&lt;/p&gt;

&lt;h3&gt;
  
  
  Part 3:
&lt;/h3&gt;

&lt;p&gt;Add a DOMContetntLoaded eventListener and call the setupTabs function once the DOM content has been loaded.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/y3Zd0MfT" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.postimg.cc%2FL5y1FRLG%2F8.png" alt="8.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Part 4:
&lt;/h3&gt;

&lt;p&gt;First, you will set all the &lt;code&gt;buttons&lt;/code&gt; to be inactive, then set the active &lt;code&gt;button&lt;/code&gt;. You will do the same for the &lt;code&gt;tab content.&lt;/code&gt; Select all the &lt;code&gt;buttons&lt;/code&gt; and for each &lt;code&gt;button&lt;/code&gt;, remove the &lt;code&gt;tab-btn-active&lt;/code&gt; class, in doing this it will reset and no &lt;code&gt;button&lt;/code&gt; will have an active state, then set the clicked &lt;code&gt;button&lt;/code&gt; to have the &lt;code&gt;tab-btn-active&lt;/code&gt; class.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/tnN00D7j" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.postimg.cc%2FVv3zCV8d%2F9.png" alt="9.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After that, select all the &lt;code&gt;tab contents&lt;/code&gt; and for each tab, remove the &lt;code&gt;tab-content-active&lt;/code&gt; class, in doing this it will reset and no tab will have an active state, then set the active tab to have the &lt;code&gt;tab-content-active&lt;/code&gt; class.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/18f96hfV" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.postimg.cc%2FGmj9WbRK%2F10.png" alt="10.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now simply add the &lt;code&gt;tab-btn-active&lt;/code&gt; class so that whenever the &lt;code&gt;button&lt;/code&gt; is clicked, it becomes active.  We will do the same for the tab content, using the tabActivate constant add the &lt;code&gt;tab-content-active&lt;/code&gt; class.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/B8F4YT5q" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.postimg.cc%2FLsC5svnZ%2F11.png" alt="11.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And that's it!&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/brian-dot-hub/embed/eYvrzGr?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

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

&lt;p&gt;The purpose of this tutorial was to give you the most detailed instructions on how to make a horizontal switchable tabs panel using HTML, CSS, and JavaScript. I hope this tutorial guided you through the process of creating a horizontal switchable tab panel. To reach a larger audience, please like or share the article. In the comments section, feel free to make a comment or ask a question.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Guide to Serverless Contact Form Using Netlify Forms</title>
      <dc:creator>Brian Maina</dc:creator>
      <pubDate>Mon, 31 May 2021 18:35:18 +0000</pubDate>
      <link>https://dev.to/mainakibe/guide-to-serverless-contact-form-using-netlify-forms-2mi0</link>
      <guid>https://dev.to/mainakibe/guide-to-serverless-contact-form-using-netlify-forms-2mi0</guid>
      <description>&lt;h2&gt;
  
  
  What is a Serverless site?
&lt;/h2&gt;

&lt;p&gt;Serverless is a phrase that implies many of the difficulties you as the developer might face or have faced while managing and maintaining your sites server-side that have been largely removed. Serverless services facilitate developers with a huge spectrum of insanely amazing stuff and open up countless opportunities that would have been too expensive to deploy, manage, and sustain while using conventional server architectures. As a frontend developer with no backend or DevOps knowledge, how incredible is it to set up an API that manages all production traffic?&lt;/p&gt;

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

&lt;p&gt;Netlify is an intuitive Git-based workflow and powerful serverless platform to build, deploy, and collaborate on web apps.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is a form?
&lt;/h2&gt;

&lt;p&gt;A form is a standard requirement for any business or personal portfolio since it provides a way through which users can reach out to the business. In most cases, it is found on the contact page of the website. In this tutorial, I will guide you on how you can set up a form using Netlify Forms.&lt;/p&gt;

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

&lt;p&gt;Before getting started, ensure you have the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Basic understanding of HTML forms.&lt;/li&gt;
&lt;li&gt;A basic HTML form.&lt;/li&gt;
&lt;li&gt;Basic Knowledge on Git &amp;amp; GitHub.&lt;/li&gt;
&lt;li&gt;A starter Netlify account&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Netlify's Pricing
&lt;/h2&gt;

&lt;p&gt;It's definitely worth getting the pricing conversation out of the way before we get into the coding. Netlify offers a variety of plans to meet your needs. The plan you choose is by default determined by the size of your project. The starter Nelify plan is free to use, but the free plan only allows for 100 submissions per site each month. If you have a small website, whether if it is yours or a client's and they do not expect more than 100 submissions a month, this should be sufficient. Netlify also provides Pro, Business, and Enterprise plans. &lt;a href="https://www.netlify.com/pricing/"&gt;See the Pro, Business, and Enterprise plans pricing details.&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Building the Form.
&lt;/h2&gt;

&lt;p&gt;The ease with which Netlify forms can be implemented is a big part of their appeal. Consider a simple contact form that you may see on a standard website.&lt;/p&gt;

&lt;p&gt;You can be as creative as you want with it. It's entirely up to you, whether you utilize Bootstrap or CSS. A contact form usually contains three fields: name, email, and message. For my contact form, I utilized a free HTML5 template from &lt;a href="https://html5up.net/"&gt;HTML5 app.net&lt;/a&gt;. After that, I made a GitHub repository and uploaded the code to GitHub. Finally, I set up Netlify to host the site. Here's how mine looks:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/LqBS4g4z"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wuFbo23q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/fb1RKY6g/1.png" alt="1.png"&gt;&lt;/a&gt;&lt;br&gt;
To add some functionality to it, simply add a &lt;code&gt;data-netlify="true"&lt;/code&gt; attribute to the &lt;code&gt;form&lt;/code&gt; element to make it function with Netlify.&lt;br&gt;
&lt;a href="https://postimg.cc/47d0CYY4"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2FAndBw---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/Y9fBWgkF/3.png" alt="3.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That's it for now. If you fillout the form....&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/p900BPqw"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--X7tZMr-H--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/fLs6DLXR/4.png" alt="4.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;.....it will redirect you to Netlify's default thank you page...&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/sMr0j6MN"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tPbaY2Fx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/FHdtxwNN/4.png" alt="4.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;...and the form submission will be accessible from your Netlify dashboard.&lt;/p&gt;

&lt;h1&gt;
  
  
  Features of the advanced form
&lt;/h1&gt;

&lt;p&gt;That was simple, although it might not be precisely what you were looking for. For example, you might wish to create a custom confirmation page and prevent robots(bots) from submitting your form. You may even submit the form using JavaScript instead of a conventional HTML form post. Or perhaps you might want to be notified when the form is submitted to your personal email address instead of having to read the submissions from your Netlify project's dashboard.&lt;/p&gt;

&lt;p&gt;Each of these things are feasible, although I'll only go over a few of the options.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to create a custom confirmation page?
&lt;/h2&gt;

&lt;p&gt;Instead of using Netlify's standard confirmation page, you'll most likely want to create a customized one. To do so, simply add an action attribute to your &lt;code&gt;form&lt;/code&gt;. The &lt;code&gt;action&lt;/code&gt; must include the path to your site's form confirmation page in relation to the root. Please note that this is the route to the webpage, not the file path, whenever the website is generated.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/r0BNhsWP"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--v9aWF3cy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/D0Zpwbzn/5.png" alt="5.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You will then have to create a new &lt;code&gt;HTML&lt;/code&gt; page and use any name of your own choosing. Then add a thank you message.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/t1f3TJr4"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4OVAsQ_y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/tTR2BVWW/6.png" alt="6.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now after you submit the form...&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/2VwnW2HJ"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cElNSzh9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/YCcRJPQp/7.png" alt="7.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;...You can then add some &lt;code&gt;CSS&lt;/code&gt; styling to customize the page.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to configure your form for additional spam filtering?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://akismet.com/"&gt;Askimet&lt;/a&gt; already runs a spam filter with Netlify Forms, but for additional spam protection, you can modify them. A honeypot field is supported, which can be used to recognize bot submission of a &lt;code&gt;form&lt;/code&gt;. It's as simple as sipping margaritas on the beach! Simply include a field in your form that isn't accessible to the users and thereafter identifying the field's name in a &lt;code&gt;data-netlify-honeypot="bot-field"&lt;/code&gt; property to the &lt;code&gt;form&lt;/code&gt; tag.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/dZ9Z8V9d"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hM1UyeXw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/Kj67hKk9/8.png" alt="8.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The above action functions similar to adding a reCAPTCHA challenge protection to your form functions. To begin, add a &lt;code&gt;data-netlify-recaptcha="true"&lt;/code&gt; attribute to your &lt;code&gt;form&lt;/code&gt; element then a &lt;code&gt;data-netlify-recaptcha="true" div&lt;/code&gt; within the &lt;code&gt;form&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/64BfsSjr"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tk67SnTH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/tJxS6GFM/9.png" alt="9.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Below is the identical contact form after adding the reCAPTCHA challenge.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/PPrQ2g8h"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_u-TmEnM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/HsbvsHYJ/10.png" alt="10.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Configuring The Notification Settings.
&lt;/h2&gt;

&lt;p&gt;When a form is submitted, you'll almost certainly want to be notified or enter the message into some form of workflow to handle it. In your project's Netlify dashboard, go over to Settings &amp;gt; Forms &amp;gt; Form notifications to configure this.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/2b9hJ6WD"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GiV4w4yf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/T1f0K5Yp/12.png" alt="12.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And thats it!&lt;/p&gt;

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

&lt;p&gt;This article's goal was to provide you with the most comprehensive guide on creating serverless contact forms using Netlify. If you are intrigued to learn more about the subject check out Netlify's &lt;a href="https://docs.netlify.com/"&gt;documentation&lt;/a&gt;. Also, if you have any queries help through &lt;a href="https://answers.netlify.com/"&gt;Netlify support forums&lt;/a&gt;. I hope you found this article useful in creating a serverless contact form. Leave a like or share the article to reach a wider audience. Feel free to leave a remark or ask a question in the comment section.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Easy Guide To Dark Mode Toggle Using HTML, CSS and JavaScript.</title>
      <dc:creator>Brian Maina</dc:creator>
      <pubDate>Mon, 24 May 2021 08:36:22 +0000</pubDate>
      <link>https://dev.to/mainakibe/easy-guide-to-dark-mode-toggle-using-html-css-and-javascript-35ec</link>
      <guid>https://dev.to/mainakibe/easy-guide-to-dark-mode-toggle-using-html-css-and-javascript-35ec</guid>
      <description>&lt;p&gt;In this post, I'll show you how to use HTML, CSS, and a little JavaScript to add a light to dark mode toggle. I'll walk you through the entire coding process, including how I use a checkbox and a label tag to construct the layout of the elements in HTML. Then I write all of the functionality for monitoring when the input is tested, and its status in JavaScript. Finally, I use CSS to add styling transition effects and a::before pseudo-element to reflect the toggle.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1: HTML &amp;amp; CSS code&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I already have all of the website's code in place, as well as some styling. I declared all of the colour variables for the light mode under root in the CSS.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/xcpKhCGB"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ufjVQihv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/RZ4X3JWC/root.png" alt="root.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I then added a different class for the dark mode.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/gX4whSN1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HId8gL72--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/cCGfVPY1/dark-mode.png" alt="dark-mode.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Afterwards, I added a toggle to the page that, when it's clicked, applies the dark mode class to the body.&lt;/p&gt;

&lt;p&gt;To do that, first, go to the HTML code, and under the &lt;code&gt;div&lt;/code&gt; tag with the class of &lt;code&gt;toggle&lt;/code&gt;, add a new &lt;code&gt;div&lt;/code&gt; and set the class to &lt;code&gt;dark mode&lt;/code&gt;; basically, this is the dark and light mode container. Under that class, create an &lt;code&gt;input type checkbox&lt;/code&gt; and set the class and id to &lt;code&gt;checkbox&lt;/code&gt; to reference the &lt;code&gt;input&lt;/code&gt;. Then add a &lt;code&gt;label&lt;/code&gt;. The &lt;code&gt;label&lt;/code&gt; will be for the &lt;code&gt;input&lt;/code&gt;, so under the for, write the same name as the &lt;code&gt;id&lt;/code&gt; and &lt;code&gt;class&lt;/code&gt; for the &lt;code&gt;input&lt;/code&gt; so that when you click on the &lt;code&gt;checkbox&lt;/code&gt; to activate it, you can also click on the &lt;code&gt;label&lt;/code&gt; to activate it. This will be an added advantage in your code. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/wR7Bm6ts"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bGA0noJX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/C54n95SJ/tog.png" alt="tog.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Afterwards, you'll need to add some styling to this, but for now, get the functionality first then you can add some styling to it so that it looks a little bit better. So right now, you have an &lt;code&gt;input&lt;/code&gt; and a &lt;code&gt;label&lt;/code&gt; and your &lt;code&gt;dark-mode&lt;/code&gt; identified in the CSS as a different class.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2: The JavaScript Code&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The next step will be to change the colour of the website, for that, follow a few steps. In your JavaScript, you will monitor if the &lt;code&gt;checkbox&lt;/code&gt; is tapped, and if it is, you want to check which state the &lt;code&gt;checkbox&lt;/code&gt; is in. If the &lt;code&gt;checkbox&lt;/code&gt; is checked, the dark mode should turn on, and if it is not checked, the light mode should be visible.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Setting up JavaScript Variables&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;First create a variable that will reference this &lt;code&gt;input type of checkbox&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/GBdhjP8R"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--03BmT_LZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/mrFzB8TP/variable.png" alt="variable.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;JavaScript add EventListener&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Afterwards add a click &lt;code&gt;eventListener&lt;/code&gt; to the &lt;code&gt;input&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/3dG85f27"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4uu3W8Xy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/8PKjvq5F/listener.png" alt="listener.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When it is clicked, the &lt;code&gt;checkbox&lt;/code&gt; should basically check its own status to know if it's checked or unchecked, then create a function for that called &lt;code&gt;checkMode&lt;/code&gt;. The function will check which state the checkbox is in. If it is checked, the &lt;code&gt;dark-mode&lt;/code&gt; class will be enabled, and if it's unchecked, the &lt;code&gt;dark-mode&lt;/code&gt; class will be removed. For that, use a conditional statement.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/MM4Sg1Tv"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--J4JEXlIn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/prVLhZMY/checkmode.png" alt="checkmode.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Creating the dark mode on and off functions.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;First, you will create functions to add the &lt;code&gt;dark-mode&lt;/code&gt; class. If it is checked, create a function and call it &lt;code&gt;darkModeOn&lt;/code&gt;, and if it is unchecked, create a function and call it &lt;code&gt;darkModeOff&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/n98Wv2rY"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WoP5ZKqh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/Zn0hzDhg/dark.png" alt="dark.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If the &lt;code&gt;input&lt;/code&gt; is checked, assign the &lt;code&gt;dark-mode&lt;/code&gt; class to the &lt;code&gt;body&lt;/code&gt;, to overrule the root's light colour styles. This will &lt;code&gt;add&lt;/code&gt; a class to the &lt;code&gt;body&lt;/code&gt;, and the name of the class is &lt;code&gt;dark-mode&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/vcbqbcVB"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6ZNIKRkH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/bN2K0nYQ/on.png" alt="on.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The off function is almost similar. For the function of &lt;code&gt;darkModeOff&lt;/code&gt; again, you want to reference that body, but in this case, you want to &lt;code&gt;remove&lt;/code&gt; the &lt;code&gt;dark-mode&lt;/code&gt; class.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/YhRX9M6x"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PT8v1uZd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/XYStsvXt/off.png" alt="off.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If the &lt;code&gt;checkbox&lt;/code&gt; is checked, add the &lt;code&gt;darkModeOn&lt;/code&gt; function, and if it is unchecked, which is the else state, add the &lt;code&gt;darkModeOff&lt;/code&gt; function.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/Th6M52b8"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tFIi5ri2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/6679Sy5Q/if.png" alt="if.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The hardest part is over! All that's left is to add the CSS styling to the checkbox.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/l3q2Z6S6n38zjPswo/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/l3q2Z6S6n38zjPswo/giphy.gif" alt="giphy"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3: CSS styling&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;First, reference the &lt;code&gt;darkmode&lt;/code&gt; class which basically houses the entire checkbox.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Styling the darkmode container&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The first step will be to write the &lt;code&gt;display flex&lt;/code&gt;, then &lt;code&gt;align items&lt;/code&gt; to the &lt;code&gt;centre&lt;/code&gt;. Afterwards, apply a &lt;code&gt;font size&lt;/code&gt; of &lt;code&gt;16px&lt;/code&gt; and a &lt;code&gt;font-weight&lt;/code&gt; of &lt;code&gt;700&lt;/code&gt; for the dark mode text. Also, use one of the colour variables to set the dark mode text colour. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/WdKxNsVH"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6OVvF86k--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/nLcx1LPp/css1.png" alt="css1.png"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Creating the ball class in the HTML&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The next step will be to add some styling to the &lt;code&gt;label&lt;/code&gt;. In the &lt;code&gt;label&lt;/code&gt; tag, you want a toggle that looks like it is moving backwards and forwards. So create a &lt;code&gt;div&lt;/code&gt; and add a ball class; this will represent the actual toggle that will move backwards and forwards. For that &lt;code&gt;label&lt;/code&gt;, add a class of &lt;code&gt;label&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/68711FZL"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qcVjxjU7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/3x95WTJ6/label.png" alt="label.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Styling the label&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;First, reference the &lt;code&gt;label&lt;/code&gt; class. Set a particular &lt;code&gt;width&lt;/code&gt; and &lt;code&gt;height&lt;/code&gt;, next set a &lt;code&gt;border-radius&lt;/code&gt; of &lt;code&gt;30px&lt;/code&gt;, and use one of the colour variables to set the &lt;code&gt;background colour&lt;/code&gt;, then set the &lt;code&gt;position&lt;/code&gt; to &lt;code&gt;absolute&lt;/code&gt;. Finally, you'll want the &lt;code&gt;cursor&lt;/code&gt; to be a &lt;code&gt;pointer&lt;/code&gt; so that it looks interactive.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/Ppb7QZwg"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MQLnRDti--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/yd2zByY8/css2.png" alt="css2.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Styling the ball&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Add that toggle; you will reference the class of &lt;code&gt;ball&lt;/code&gt;. And again, set a particular &lt;code&gt;width&lt;/code&gt; and &lt;code&gt;height&lt;/code&gt; for this, set the &lt;code&gt;background colour&lt;/code&gt; using one of the colour variables, &lt;code&gt;position&lt;/code&gt; it to be &lt;code&gt;absolute&lt;/code&gt;, set a &lt;code&gt;border-radius&lt;/code&gt; of &lt;code&gt;50%&lt;/code&gt;, set a &lt;code&gt;margin-top&lt;/code&gt; and &lt;code&gt;left&lt;/code&gt; positioning. Also, add a &lt;code&gt;cursor&lt;/code&gt; &lt;code&gt;pointer&lt;/code&gt; to this. Finally, add a &lt;code&gt;transition&lt;/code&gt; because you will add an animation here as well.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/t72SR9tN"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ia7ASagH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/BQGdg6jk/ball.png" alt="ball.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Adding text before the toggle icon&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now add a before property to show the Dark mode text. So you will use the &lt;code&gt;label&lt;/code&gt; class then add a &lt;code&gt;before&lt;/code&gt; property. The content of it will be Dark mode. Set the &lt;code&gt;position&lt;/code&gt; to be &lt;code&gt;absolute&lt;/code&gt;, &lt;code&gt;display&lt;/code&gt; &lt;code&gt;inline-block&lt;/code&gt;, &lt;code&gt;width&lt;/code&gt; to &lt;code&gt;90px&lt;/code&gt;, and finally fix the &lt;code&gt;left&lt;/code&gt; and &lt;code&gt;top&lt;/code&gt; positioning.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/PLWygH5Z"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bp5ivgDC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/KYVWgvX9/before.png" alt="before.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Toggle animation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;So now you want to verify the state of the &lt;code&gt;checkbox&lt;/code&gt; and apply some styling to the toggle. Use the &lt;code&gt;checkbox id&lt;/code&gt; so that you can verify when it is checked. When it is checked, you want it to affect the sibling element, so use the tilde sign then reference the &lt;code&gt;ball&lt;/code&gt; class. You now want this element to &lt;code&gt;transform&lt;/code&gt;, therefore &lt;code&gt;translate&lt;/code&gt; it in the  &lt;code&gt;X&lt;/code&gt;direction by &lt;code&gt;3em&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/145BjLhn"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Caexbyfb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/FF0674TZ/checked.png" alt="checked.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Finally reference the &lt;code&gt;checkbox id&lt;/code&gt; and set it to &lt;code&gt;display none&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/dhdjCFdX"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VK_aqnG9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/qvDb9M7k/final.png" alt="final.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And that's it! You've created a light and dark mode switch that works perfectly. It's easy and fast. I hope you found this tutorial useful. Feel free to comment and explore what types of tutorials or examples you'd like to see more of.&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/brian-dot-hub/embed/dyvpbRE?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
    </item>
    <item>
      <title>JavaScript Journey</title>
      <dc:creator>Brian Maina</dc:creator>
      <pubDate>Fri, 30 Apr 2021 18:37:30 +0000</pubDate>
      <link>https://dev.to/mainakibe/javascript-journey-4b6f</link>
      <guid>https://dev.to/mainakibe/javascript-journey-4b6f</guid>
      <description>&lt;p&gt;For the past three months, I've been studying JavaScript and applying it to web applications to better practice and improve my skills. Formerly having learned HTML and CSS, the experience has been quite exciting with many good and bad times. With javascript, many things are simplified as a few lines of Js code could achieve what CSS couldn't in too many lines. What fascinates me are the quirks that come alongside coding using js and its functionality when added to HTML and CSS codes.&lt;/p&gt;

&lt;p&gt;My journey was full of exciting and frustrating times. I'm happy as I had an opportunity to learn a language with cool features. Secondly, the learning the basics experience was enjoyable because it was some sort of "honey moon"😅. Lastly, I can't express the pleasure i get after of solving bugs and errors.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/dDrUxDDGyQ4ICurV2b/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/dDrUxDDGyQ4ICurV2b/giphy.gif" alt="cigar guy"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The surprising part was that the frustrations made the journey fun. I will refer to the first project I did, as it had me working through challenges in Js and Github. my endurance was put to the test with sleepless nights and days where I almost smashed my machine.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--A6bFsW6G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://pbs.twimg.com/media/CzmNPZqWEAEoluA.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--A6bFsW6G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://pbs.twimg.com/media/CzmNPZqWEAEoluA.jpg" alt="sad kermit doll"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The 1st project was quite simple; therefore, it amuses me of how much I encountered Js errors. I'd get numerous bugs, and the worst part was that I didn't understand most error code messages. Luckily, with the end of my tutorial classes, I felt confident enough to begin personal projects.&lt;br&gt;
It's easier said than done since things got quite harder than I expected.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/yINIG6dejiqk7tcYJz/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/yINIG6dejiqk7tcYJz/giphy.gif" alt="stairs guy"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I got tempted to look for codes online to avoid a repetition of my first experience with Js. So I began to code with constant occurrences of bugs and error messages that had me thinking about researching source codes for previously done projects rather than going through my hustle.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--12T5kNg0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.kym-cdn.com/entries/icons/facebook/000/030/710/dd0.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--12T5kNg0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.kym-cdn.com/entries/icons/facebook/000/030/710/dd0.jpg" alt="bear doll"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Regardless, I reminded myself that I was on a learning streak, and I worked my way through the errors, late debugging nights, and consultations. The funniest parts of my journey were when I experienced bugs and decided to google solutions online on Stack overflow and youtube, but the result was negative. I would often work with solutions from more experienced developers. However, implementing the same technique on my code and still experiences poor workability made me disappointed. I mean, how is it that my code was irresponsive when I followed everything correctly? Or maybe there was a problem with my machine and IDE.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/gtDnXcTcVEXiE/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/gtDnXcTcVEXiE/giphy.gif" alt="github gif"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I realized my CSS code was holding me back, but the issue was still there after the transitions.&lt;/p&gt;

&lt;p&gt;So I decided to get help from one of my Js guru friends. I had to come up with a repo for my project, then add and commit it to push it to Github finally and include him as my collaborator. After inspection, he asked me to create branches separate from my primary branch, where he would have access to view the changes made to my code and edit it. It was at that moment where I realized I was not fully skilled in GitHub. Don't get me wrong, I mean, I could separate branches before and make changes on my master branch. So I set out to employ working with separate branches, which led to me deleting my repo and creating a new one.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/sjAbiKTsxXHYkDX0H9/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/sjAbiKTsxXHYkDX0H9/giphy.gif" alt="stone faced boy"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Js had me struggling with codes, and Github stressed me out but turned out to be very helpful for me. Most of the time, I was stuck in between making changes on my master branch and committing them so that I could switch them to a separate branch, only to find that I had not committed the changes. So I resorted to pushing the code to Github using a separate branch to experience the same error repeatedly. I repeated the process quite a lot, and though tedious, it was quite educative.&lt;/p&gt;

&lt;p&gt;Eventually, I understood how to work with Git land earned the git commands justifying my whole encounter.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/l3q2Z6S6n38zjPswo/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/l3q2Z6S6n38zjPswo/giphy.gif" alt="giphy"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I have learnt that it's normal to make mistakes and it is very okay to learn things slowly. I have made a lot of tiny mistakes that have made me end up starting a project all over again. I always take mistakes as a chance to learn. However if you make a mistake, don't keep it to yourself; first try to fix it on your own; if that doesn't work, Google the problem; and if that doesn't work, you can now seek assistance from someone more experienced than you.&lt;/p&gt;

&lt;p&gt;Lastly, don't be too hard on yourself. It's always good to take a break from the screen from time to time. I always take some time away from my screen to play football or just do some physical stuff since this really helps in clearing my mind.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>HTML &amp; CSS - My Journey</title>
      <dc:creator>Brian Maina</dc:creator>
      <pubDate>Sun, 28 Mar 2021 03:13:35 +0000</pubDate>
      <link>https://dev.to/mainakibe/html-css-my-journey-1c50</link>
      <guid>https://dev.to/mainakibe/html-css-my-journey-1c50</guid>
      <description>&lt;p&gt;I started my software development journey on 1st December 2020 as a student at Frond-End Masters an online Bootcamp. When I began this journey, I aspired to become a full-stack web developer. It has been two months since I embarked on this journey and although there have been some setbacks, I can say it has been fun and worth it. All the setbacks I have encountered have made me learn a lot of new stuff. I decided to document my journey since in the short time I have was learning have been seen a lot of success stories and I felt like I had to also share my journey. To do this I plan to be writing and posting an article in every two weeks covering what I have been learning and working on during this period. This article won’t just cover the stuff I build but the challenges I went through, how I overcame them and the experience I gained.&lt;br&gt;
&lt;a href="https://i.giphy.com/media/3NtY188QaxDdC/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/3NtY188QaxDdC/giphy.gif" alt="giphy"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When I set out to be a full-stack web developer, I did some research before starting my classes and discovered it is divided into two categories:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Front-end web development - A front-end web developer is responsible for implementing visual elements that users see and interact with within a web application.&lt;/li&gt;
&lt;li&gt;Back-end web development - They are responsible for server-side application logic and integration of the work front-end developers do.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To actualize my goal of becoming a full-stack web developer, I had to start by learning the front-end bit and becoming a front-end developer. Front-end development requires one to have a foundation in the following front-end skills:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;HTML: Hypertext Markup Language; creates the content of a webpage.&lt;/li&gt;
&lt;li&gt;CSS: Cascading Style Sheets; describes the style of a webpage.&lt;/li&gt;
&lt;li&gt;JavaScript: A programming language used to describe a web page's behavior.&lt;/li&gt;
&lt;li&gt;CodePen: An online code editor for HTML, CSS, and JavaScript where users can highlight their work and get it debugged.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It took me a week to learn practice and fully understand HTML. After that, I immediately started my CSS course where I spent a month and three weeks learning and practicing. I wanted to take time and care to learn and understand CSS properties and their uses. Using this approach made my learning process fun and enabled me to learn a lot of new things. So far, I have fully learned HTML and CSS and I’m currently learning JavaScript and I have built my portfolio as my first project.&lt;/p&gt;

&lt;p&gt;Throughout my journey of learning, I have encountered some challenges, but the major challenges encountered have been balancing my schoolwork and my Bootcamp work and maintaining consistency in my learning process. I overcame these challenges by creating my schedule where I would have time allocated for attending to my schoolwork and sometimes allocated to learn in my Bootcamp course. At first, it was hard, but once I got used to it keeping to a schedule became easy. The biggest thing I have learned out of it is that the pain of disciple lasts for a short time and with proper utilization of my time I can achieve everything I have set my mind towards. I also started documenting my daily progress of learning JavaScript on Twitter to ensure that I’m consistent in my learning process and so far, I can proudly say I have been consistent in my learning and that it has had a lot of benefits. If you made it to the end of the post thank you for reading it through. And I look forward to sharing my journey as I go along.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nyxbz4ub--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://media0.giphy.com/media/3oFzmiMu3v4LIXpJBK/200_d.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nyxbz4ub--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://media0.giphy.com/media/3oFzmiMu3v4LIXpJBK/200_d.gif" alt="ending video"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
