<?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: brianko1850</title>
    <description>The latest articles on DEV Community by brianko1850 (@brianko1850).</description>
    <link>https://dev.to/brianko1850</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%2F821228%2Fee92f6a4-690a-49d9-83d4-38a5881fcd6f.png</url>
      <title>DEV Community: brianko1850</title>
      <link>https://dev.to/brianko1850</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/brianko1850"/>
    <language>en</language>
    <item>
      <title>Understanding react Components as an electrician</title>
      <dc:creator>brianko1850</dc:creator>
      <pubDate>Tue, 11 Oct 2022 18:26:43 +0000</pubDate>
      <link>https://dev.to/brianko1850/understanding-react-components-as-an-electrician-51j3</link>
      <guid>https://dev.to/brianko1850/understanding-react-components-as-an-electrician-51j3</guid>
      <description>&lt;p&gt;Coming from electrical background, I have noticed that many elements of programming resembles electrical systems (which makes sense since at the fundamental level, all programming is a series of electrical signals). Functions that perform tasks on inputs to produce outputs, importance of sequence of operations, and tracing errors in order to troubleshoot were not totally foreign concepts to me as I was familiar with them in electrical field. &lt;br&gt;
Of course, as with all allegory, comparisons starts to break down if you dig too deep but I found thinking of coding as laying down a wiring schematics pretty helpful. &lt;br&gt;
Here are few examples about components that might help you if you're also coming from electrical background.&lt;/p&gt;
&lt;h3&gt;
  
  
  React Components
&lt;/h3&gt;

&lt;p&gt;Components in react acts as JavaScript functions but in isolation. It takes an input, performs a task or tasks and gives an output. It can be very simple as this example&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function Car() {
  return &amp;lt;h2&amp;gt;Hi, I am a Car!&amp;lt;/h2&amp;gt;;
}

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

&lt;/div&gt;


&lt;p&gt;from &lt;/p&gt;
&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;a href="https://www.w3schools.com/react/react_components.asp" rel="noopener noreferrer"&gt;
      w3schools.com
    &lt;/a&gt;
&lt;/div&gt;



&lt;p&gt;or more complex. This is an example of an component from my recent project.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function Pending({ pendings }) {

    const displayPending =  pendings.map(data =&amp;gt; {
      return (
        &amp;lt;&amp;gt;
          &amp;lt;ul&amp;gt;
            &amp;lt;h2&amp;gt;{data.name}&amp;lt;/h2&amp;gt;
            &amp;lt;h3&amp;gt;{data.city}&amp;lt;/h3&amp;gt;
            &amp;lt;li&amp;gt;{data.street}&amp;lt;/li&amp;gt;
            &amp;lt;li&amp;gt;{data.directions}&amp;lt;/li&amp;gt;
            &amp;lt;br/&amp;gt;
          &amp;lt;/ul&amp;gt;
        &amp;lt;/&amp;gt;
      )
    })

    return (
    &amp;lt;&amp;gt;    
      { displayPending }
    &amp;lt;/&amp;gt;    
    )
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, Pending component is taking the &lt;strong&gt;input&lt;/strong&gt; of &lt;code&gt;{ pendings }&lt;/code&gt; and picking out and organizing the values (name, city, street etc) that I want to display (&lt;strong&gt;TASK&lt;/strong&gt;) and displaying them on the page in easy to read fashion (&lt;strong&gt;OUTPUT&lt;/strong&gt;), which is definitely more extensive than the first example.&lt;/p&gt;

&lt;p&gt;I think of the first example &lt;code&gt;Car&lt;/code&gt; as equivalent to something like a light bulb in electrical system: simple device that performs binary task of on or off. There is no specific input it's looking for. If there is power, light bulb will light up, as will the &lt;code&gt;Car&lt;/code&gt; Component will render "Hi, I am a Car!" if it is invoked. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--m22LM77v--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b4fexpvn8uk6z3ci4qfv.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--m22LM77v--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b4fexpvn8uk6z3ci4qfv.jpg" alt="Image description" width="508" height="366"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;once the switch closes, light bulb gets power input and produces output.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Meanwhile, &lt;code&gt;Pending&lt;/code&gt; component example is more like a fan motor that can be set to specific speed: still pretty simple device but it expects a specific input of &lt;code&gt;{ pendings }&lt;/code&gt; prop object to produce output depending on the input. Just like how variable resistor gives motor specific input and motor outputs at the RPM corresponding to the input.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xxgpVWmM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ikixahpv0og1w1yh1bwj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xxgpVWmM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ikixahpv0og1w1yh1bwj.png" alt="Image description" width="750" height="531"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;variable resistor determines input to the motor which will run at corresponding speed. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Thinking of Components as electrical devices that perform specific tasks helped me tremendously. Think about it, in order for an electrical system to work, you have to have correct electrical devices in the system (what's it rated? what's the function?) and in specific way in the schematic so that the sequence of operation is correct. It's the same thing in react. Components have to work correctly on their own, but also work in correct order in order for it to work.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why isolation?
&lt;/h3&gt;

&lt;p&gt;One of the differences between react Component and Javascript function is that Components are isolated. So why isolate Components? isn't it just extra work? &lt;/p&gt;

&lt;p&gt;It is, but there are good reasons for doing it. &lt;br&gt;
One is organization. Organization is more than about just looking pretty (although that is nice). &lt;br&gt;
While I was an EM on the Navy ships, I came across multiple control panels that looked like this&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kvfd-fjG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3phjyjfi4fg6sok5b466.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kvfd-fjG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3phjyjfi4fg6sok5b466.jpg" alt="Image description" width="540" height="960"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Yes, most of them still worked, but once they didn't troubleshooting was a painful process because of the total chaos that you can see. Digging through all those cables made repairs twice as long as if they were organized.&lt;/p&gt;

&lt;p&gt;With Isolated components, we are avoiding large part of this problem all together. In the real world, we would run out of space if we were to make a panel for each device you see in there, but we don't have to worry about that in digital space as much and isolate them as much as we'd like. Organized Isolated components makes working on them much easier down the line, especially when there are multiple people working on the project.&lt;/p&gt;

&lt;p&gt;Second reason is maintainability. &lt;/p&gt;

&lt;p&gt;Think of a box fan, all the devices (motor, resistor etc) is all contained in the box, and it moves air. So in this analogy, why can't we just put all components together? they should still work the same right?&lt;/p&gt;

&lt;p&gt;Yes, but no. Because most react App is more like ventilation system for a building or a ship, it is a better idea to separate components like how ships will separate motor controller from ventilation motors. This practice makes things easier to maintain, troubleshoot and also aids in damage control. Let's say the motor caused a fired. In the box fan example, you'd have to get a whole new box fan, but in the case of shipboard ventilation system, you'd just need to replace the motor since the controller wasn't on fire.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wTmmoLlC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5878srhqs4mo9iuhd338.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wTmmoLlC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5878srhqs4mo9iuhd338.jpg" alt="Image description" width="225" height="225"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;think of box fan as a small lab in lessons&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DDK8d5vz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/asxve03xbodscqisdt1g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DDK8d5vz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/asxve03xbodscqisdt1g.png" alt="Image description" width="712" height="373"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Engine room ventilation system. controllers and fan motors are separated for maintainability purposes. &lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>blog</category>
    </item>
    <item>
      <title>Lessons from phase 2 project</title>
      <dc:creator>brianko1850</dc:creator>
      <pubDate>Fri, 09 Sep 2022 19:35:12 +0000</pubDate>
      <link>https://dev.to/brianko1850/lessons-from-phase-2-project-1ncn</link>
      <guid>https://dev.to/brianko1850/lessons-from-phase-2-project-1ncn</guid>
      <description>&lt;p&gt;&lt;strong&gt;As a beginner, consistent exposure is very important&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I started this project back in March intending to create weather app for ski resorts. I did make pretty good progress but a car accident in March caused me to take a pretty long hiatus. When I went back to work on this project, I realized things move fast in the tech world and that I might have been little too ambitious.&lt;/p&gt;

&lt;p&gt;React has been updated a few times and I couldn't even initiate &lt;code&gt;npm start&lt;/code&gt; . After spending days on stack overflow, I was able to find a workaround by utilizing &lt;code&gt;&amp;lt;React.StrictMode&amp;gt;&lt;/code&gt; , only for it to crash again a few days later (possibly due to update in NavLinks) while I was on work trip. I had enough at that point and decided to just start the project over.&lt;/p&gt;

&lt;p&gt;These series of events did teach me a pretty valuable lesson, though. In that as a beginner, I need to constantly be coding, even if it's staring at a screen for few hours on a given day because my brain just refuses to work that day. If I was able to just keep tabs on the project, I could've avoided the update and competency issues and also avoided spending another month just brushing up on materials I've already completed to re-learn REACT. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Don't use external API on these projects&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Since I used internal database on last project, I decided to use an external API for the phase 2 project. I found a manageable looking API &lt;a href="https://www.refugerestrooms.org/api/docs/#!/restrooms"&gt;https://www.refugerestrooms.org/api/docs/#!/restrooms&lt;/a&gt; and decided to use that. Presenting data was not that much of a problem. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--JUODE8Ba--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zyijvc88k4rmbv81ns5z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--JUODE8Ba--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zyijvc88k4rmbv81ns5z.png" alt="Image description" width="880" height="518"&gt;&lt;/a&gt;&lt;br&gt;
I looked through the API and found that search function is operated by query parameter. To easily organize the query, I decided to create a query context component&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { createContext, useState} from "react";

const QueryContext = createContext();


function QueryProvider({ children }) {
    const [ query, setQuery ] = useState("seattle")


  return &amp;lt;QueryContext.Provider value={{ query, setQuery }}&amp;gt;{children}&amp;lt;/QueryContext.Provider&amp;gt;;
}

export { QueryContext, QueryProvider };
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;...and pass in city names as query down in App component.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; const { query, setQuery } = useContext(QueryContext)

  useEffect(()=&amp;gt;{
      fetch(`https://www.refugerestrooms.org/api/v1/restrooms/search?page=1&amp;amp;per_page=10&amp;amp;offset=0&amp;amp;ada=true&amp;amp;unisex=true&amp;amp;query=${query}`)
      .then(res=&amp;gt;res.json())
      .then(data=&amp;gt;setBathrooms(data))
  },[ query ])

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

&lt;/div&gt;



&lt;p&gt;Default was not that important but since I'm based out of Seattle, I just set it to Seattle. With pretty basic display set up, I was able to confirm things were working. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ayo7dbVA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fp6nc7o0vwn51b0qhcba.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ayo7dbVA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fp6nc7o0vwn51b0qhcba.png" alt="Image description" width="880" height="408"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Problem was that I had to have 2 CRUD components per the requirement. This was when I found out that you can't POST to external API without proper authorization. &lt;/p&gt;

&lt;h2&gt;
  
  
  Workaround
&lt;/h2&gt;

&lt;p&gt;To work around this problem, I created an additional internal data base, db.json, where the posted data will be stored. My plan was to create 2 other components, Post and Pending, former of which will contain POST request and later will render posted data on the page. &lt;/p&gt;

&lt;p&gt;I passed down this code to Pending at first to render&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; const [ pendings, setPendings ] = useState([])

 useEffect(()=&amp;gt;{
      fetch(`http://localhost:8000/bathrooms`)
      .then(res=&amp;gt;res.json())
      .then(data=&amp;gt;setPendings(data))
  },[ Pendings ])
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and used&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;        fetch("http://localhost:8000/bathrooms", {
                method: "POST",
                headers: {
                    "Content-Type": "application/json"
                },
                body: JSON.stringify(newBathroom)
            })
            .then(r =&amp;gt; r.json())
             .then(data =&amp;gt; setPendings(data))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But Quickly I learned that this was causing an error because (I think) the POST request was throwing the codes in loop, causing the pending page to re-render over and over again. &lt;/p&gt;

&lt;p&gt;After a few days of trying different ways of restructuring the same code, I finally came up with a workaround of creating another state &lt;code&gt;newPendings&lt;/code&gt; that will separate two codes. In the end they looked like this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; const [ newPendings, setNewPendings ] = useState([])

useEffect(()=&amp;gt;{
      fetch(`http://localhost:8000/bathrooms`)
      .then(res=&amp;gt;res.json())
      .then(data=&amp;gt;setPendings(data))
  },[ newPendings ])
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   fetch("http://localhost:8000/bathrooms", {
                method: "POST",
                headers: {
                    "Content-Type": "application/json"
                },
                body: JSON.stringify(newBathroom)
            })
            .then(r =&amp;gt; r.json())
             .then(data =&amp;gt; setNewPendings(data))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Solved?
&lt;/h2&gt;

&lt;p&gt;After utilizing another state variable, code was working as intended. However I'm still not sure what actually caused an issue and would like to find that out. Also I'm almost sure that what I did was just a workaround and not the "right" solution. I'd like to find that out as well.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>phase 1 project</title>
      <dc:creator>brianko1850</dc:creator>
      <pubDate>Thu, 24 Feb 2022 15:36:02 +0000</pubDate>
      <link>https://dev.to/brianko1850/phase-1-project-lhc</link>
      <guid>https://dev.to/brianko1850/phase-1-project-lhc</guid>
      <description>&lt;p&gt;-Started the project by looking through the free API lists to see if anything would jump out at me. I wanted to pick something straightforward to make my project simple. I found &lt;a href="https://www.thecocktaildb.com"&gt;https://www.thecocktaildb.com&lt;/a&gt; which gave me an idea of single page application that lists cocktail cards.&lt;/p&gt;

&lt;p&gt;-Upon looking into API, I found that most of it was behind a paywall. I did not want to give up the idea though so I did some search on git hub and found &lt;a href="https://gist.github.com/renandanton/8d99dab65bf9fb5b4465ded7ab73a7df"&gt;https://gist.github.com/renandanton/8d99dab65bf9fb5b4465ded7ab73a7df&lt;/a&gt; which is json DB file that also lists cocktails. I copied part of it and made json file cocktails.json&lt;/p&gt;

&lt;p&gt;-To fetch JSON data, I made function getDrinks.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--A9lDS0jj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n2wgdcx5ewyuruu4iyty.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--A9lDS0jj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n2wgdcx5ewyuruu4iyty.png" alt="getDrinks function fetches data from json server" width="880" height="496"&gt;&lt;/a&gt;&lt;br&gt;
This function sends fetch request to JSON server, then when promise is fulfilled, takes the response and parses it as JSON file that JS can use. &lt;br&gt;
Once that is done, getDrinks function will take that array and calls back renderDrink function to iterate each item through renderDrink function to render cards.&lt;br&gt;
If the promise errors out, catch will console log error on the browser console.&lt;/p&gt;

&lt;p&gt;-renderDrink function is a callback function which will take the object and create and append card into main body.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DfUJlMZ3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/11w5u7byhtn7e3e5n6my.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DfUJlMZ3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/11w5u7byhtn7e3e5n6my.png" alt="renderDrink function creates and appends cards" width="880" height="573"&gt;&lt;/a&gt;&lt;br&gt;
It creates document element card, and it will input values from the object to link image, write name and short preparation.&lt;br&gt;
then It will append the card as child under drink-collection DIV &lt;/p&gt;

&lt;p&gt;-to have submit form hidden by default, and have it show up when an user clicks a button, I used&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SBGcyv_z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kpfecvxwabkfsmbwk7v3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SBGcyv_z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kpfecvxwabkfsmbwk7v3.png" alt="submit form will be hidden until add drink button is pressed" width="880" height="542"&gt;&lt;/a&gt;&lt;br&gt;
First, I made a variable called addDrink and declared it false, then I added an click event listener to a button that I ID'd as new-drink-btn. &lt;br&gt;
Each time the button is pressed, it will change the addDrink variable state from false to true and vice versa. &lt;br&gt;
I added conditional statement to display the form in block form if addDrink is true, and to not display if it is false. &lt;br&gt;
Since the default state is false, it will hide the form before the button is pressed.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;For my functionality of the SPA, I chose to go with creating and appending a new card when an user submits the previously hidden form.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1gKislX4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a90webhcid34om16t5fo.png" alt="handleSubmit takes user entries and creates a new card" width="880" height="561"&gt;
I made handleSubmit function, and declared a variable object drinkObj which contains the inputs of the user. then the function calls renderDrinks function to render and append new card from the inputs.
&lt;/li&gt;
&lt;/ul&gt;

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