<?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: ABailey92</title>
    <description>The latest articles on Forem by ABailey92 (@abailey92).</description>
    <link>https://forem.com/abailey92</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%2F473023%2Fa11b161b-68e8-4103-9e80-ad5f64c4e0fc.jpeg</url>
      <title>Forem: ABailey92</title>
      <link>https://forem.com/abailey92</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/abailey92"/>
    <language>en</language>
    <item>
      <title>Recoil: a modern state management library.</title>
      <dc:creator>ABailey92</dc:creator>
      <pubDate>Mon, 11 Jan 2021 13:47:33 +0000</pubDate>
      <link>https://forem.com/abailey92/recoil-a-modern-state-management-library-jkd</link>
      <guid>https://forem.com/abailey92/recoil-a-modern-state-management-library-jkd</guid>
      <description>&lt;p&gt;When it comes to state management libraries, React has its fair share of them. With new ones popping up from time to time, how is a programmer to know what's best? Last year Facebook introduced a state management library called, you guessed it, Recoil. In this article you are going to discover what Recoil is and why you should use it in your next project.&lt;/p&gt;

&lt;h6&gt;
  
  
  &lt;em&gt;Disclaimer: As of now Recoil is still considered experimental so use at your own risk&lt;/em&gt;
&lt;/h6&gt;

&lt;p&gt;I think it's important to start with how Recoil stacks up against the current most popular state management libraries Redux and Context API. &lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Why I prefer Recoil over Redux&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;For one, Recoil is made specifically for React, Redux is not a React library and the store is something that is handled externally. This means that it doesn't have access to React's inner scheduler. Recoil uses react state under the hood, so when React releases concurrent mode Recoil will not be far behind. Also complexity comes into play. To set up even a basic store comes with alot of boilerplate and code. If you want to include async data or caching computed values those are not apart of the base library and will require even more libraries. The creator of Redux recently apologized on Twitter for making Redux so complicated. If that isn't a caution notice. I don't know what it is.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Okay so what's wrong with Context API?&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Though not complex, and it is native to React it still has its limitations. When used for recurring or complex updates it isn't very efficient. Sebastian Markbage, an engineer for Facebook, says &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Context is ready to be used for low frequency unlikely updates. It's also good to use for static values and then propagate updates through subscriptions. &lt;strong&gt;It's not ready to be used as a replacement for all flux-like-state propagation&lt;/strong&gt;.&lt;br&gt;
In layman's terms: Context API doesn't let you subscribe to a subset of the data it contains.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4&gt;
  
  
  Alright enough about the competition, what makes Recoil so great?
&lt;/h4&gt;

&lt;p&gt;To start, Recoil is very easy to learn. Its very simple and feels natural to people who are already accustomed to using React hooks. Getting started is a matter of wrapping your app with &lt;code&gt;RecoilRoot&lt;/code&gt;, declaring your data with a unit called atom and replacing &lt;code&gt;useState&lt;/code&gt; with Recoils &lt;code&gt;useRecoilState&lt;/code&gt;. Recoil also allows you to subscribe to the exact piece of data your component consumes, and has built in methods to handle async data flow.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;&lt;em&gt;Recoil- The Basics&lt;/em&gt;&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Atom&lt;/strong&gt; - atom is a piece of state in Recoil that any component can subscribe to. Changing the value of an atom will result in a re-render from all components subscribed to it. To create an atom we need to provide a key, which should be unique across the application and default value. The default value can be static or a function. This is how it will look.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;nameState&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;atom&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
&lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;nameState&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="na"&gt;default&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Aiesha Brown&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="p"&gt;)}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;useRecoilState&lt;/strong&gt; - a hook that lets you subscribe to an atoms value and update it&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;useRecoilValue&lt;/strong&gt; - returns just the value of the atom&lt;br&gt;
&lt;strong&gt;useSetRecoilState&lt;/strong&gt; - returns just the setter function&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;nameState&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./myFile&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;NameInput&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setName&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useRecoilState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;nameState&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useRecoilValue&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;nameState&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;setName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useSetRecoilState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;nameState&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;selector&lt;/strong&gt; - a selector represents a piece of derived state. It lets you build dynamic data that depends on other atoms.&lt;/p&gt;

&lt;h4&gt;
  
  
  In conclusion
&lt;/h4&gt;

&lt;p&gt;Having a state management library that is easy to learn and is intuitive is important. If you have liked what you've read so far I encourage you to use it in your next project. Stay tuned just to see how well Recoil scales in the future.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>react</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>Taking your project to the Next level with Next.js</title>
      <dc:creator>ABailey92</dc:creator>
      <pubDate>Sun, 03 Jan 2021 01:37:57 +0000</pubDate>
      <link>https://forem.com/abailey92/taking-your-project-to-the-next-level-with-next-js-1424</link>
      <guid>https://forem.com/abailey92/taking-your-project-to-the-next-level-with-next-js-1424</guid>
      <description>&lt;p&gt;In this article I am going to explain what Next.js is and why you should use. It is important to note that you should have some familiarity with React before diving into any of its frameworks, including Next.js. If you're already equipped with React knowledge then get ready for an amazing ride&lt;/p&gt;

&lt;h2&gt;
  
  
  First things first, what is Next.js
&lt;/h2&gt;

&lt;p&gt;Simply put, Next.js is a React framework for developing Single page applications, or SPAs. Next.js is inspired by PHP and benefits from a great system of javascript modules that allow us to perform individual tests for each component as well as download thousands of components or modules from npm. The benefits are plentiful, but the main two are speed and performance. We'll dive into the specifics now.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Server side rendering
&lt;/h2&gt;

&lt;p&gt;Components that make up the UI are initially rendered on the server side. This makes page loading times appear much faster to the user.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Automatic code splitting
&lt;/h2&gt;

&lt;p&gt;Next.js does code splitting automatically, so each page only loads what’s necessary for that page. That means when the homepage is rendered, the code for other pages is not served initially.&lt;/p&gt;

&lt;p&gt;This ensures that the homepage loads quickly even if you have hundreds of pages.&lt;/p&gt;

&lt;p&gt;Only loading the code for the page you request also means that pages become isolated. If a certain page throws an error, the rest of the application would still work.&lt;/p&gt;

&lt;p&gt;Furthermore, in a production build of Next.js, whenever Link components appear in the browser’s viewport, Next.js automatically prefetches the code for the linked page in the background. By the time you click the link, the code for the destination page will already be loaded in the background, and the page transition will be near-instant!&lt;/p&gt;

&lt;h5&gt;
  
  
  &lt;em&gt;Okay sounds good, how do I include this in my next project&lt;/em&gt;
&lt;/h5&gt;

&lt;ol&gt;
&lt;li&gt;create a next.js app
This step in pretty straight forward. Next.js only requires that you have node installed, after that it is as simple as typing
&lt;code&gt;npx create create-next-app yourappnamehere&lt;/code&gt;. If you'd like to use a template behind it simply put &lt;code&gt;--use-npm --example "link here"&lt;/code&gt;.
all that's left do after that is to change your scripts inside of your packagae.json file to look something like this
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;scripts&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;dev&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;next&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;build&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;next build&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;start&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;next start&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Run your development server&lt;br&gt;
From there you will cd into your app instances and run the npm run dev command. This will start your Next.js app's development server.&lt;br&gt;
After that you should see this&lt;br&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%2Fi%2F67g2688ewuhtmdl5s58z.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%2Fi%2F67g2688ewuhtmdl5s58z.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Next you will need to create new page using the integrated file system routing. You will use the Link components to enable client-side navigation between pages. You will also be using that built in support for code splitting and prefetching that I mentioned earlier. If you are familiar with react router it looks similiar to that&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;Link&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;next/link&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;FirstPost&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h1&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;First&lt;/span&gt; &lt;span class="nx"&gt;Post&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h1&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h2&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Link&lt;/span&gt; &lt;span class="nx"&gt;href&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Back&lt;/span&gt; &lt;span class="nx"&gt;to&lt;/span&gt; &lt;span class="nx"&gt;home&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/a&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/Link&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h2&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you'd like the full documentation on Next.js routing you can find that &lt;a href="https://nextjs.org/docs/routing/introduction" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  In conclusion
&lt;/h3&gt;

&lt;p&gt;Next.js automatically optimizes your application for the best performance by code splitting, client-side navigation, and prefetching in production. &lt;br&gt;
You can create routes as files under pages and use the built in Link components. No outside routing libraries required.&lt;/p&gt;

&lt;h5&gt;
  
  
  your turn to try it!
&lt;/h5&gt;

</description>
    </item>
    <item>
      <title>The Great Gatsby.js</title>
      <dc:creator>ABailey92</dc:creator>
      <pubDate>Sun, 20 Dec 2020 18:47:45 +0000</pubDate>
      <link>https://forem.com/abailey92/the-great-gatsby-js-41o2</link>
      <guid>https://forem.com/abailey92/the-great-gatsby-js-41o2</guid>
      <description>&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%2Fi%2F7ow145avvgsec4tqxm9q.jpg" 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%2Fi%2F7ow145avvgsec4tqxm9q.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When you first arrive to &lt;a href="https://www.gatsbyjs.com/" rel="noopener noreferrer"&gt;Gatby.js&lt;/a&gt;'s website you'll be greeted with the image above. You may be thinking: "Awfully bold statement for a react framework that is only 5 years old." In this article we'll discover how Gatsby.js does, indeed, live up to the hype.&lt;/p&gt;

&lt;h4&gt;
  
  
  First thing first
&lt;/h4&gt;

&lt;h2&gt;
  
  
  What is Gatsby.js?
&lt;/h2&gt;

&lt;p&gt;According to their website Gatsby.js is &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;a blazingly fast modern site generator for React.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Put more simply, Gatsby is a static website generator.&lt;/p&gt;

&lt;h5&gt;
  
  
  Well wait, what does that mean?
&lt;/h5&gt;

&lt;p&gt;All that means is that Gatsby will produce static HTML files that we load up on to a server. Gatsby take information and preconfigures it ahead of time and serves that up.&lt;/p&gt;

&lt;h3&gt;
  
  
  So why should you use Gatsby?
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Three reasons: speed, security, and improved developer experience.
&lt;/h4&gt;

&lt;p&gt;&lt;em&gt;Let's dive a little bit deeper into each of these reasons shall we?&lt;/em&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  1. Speed
&lt;/h1&gt;

&lt;p&gt;Gatby.js is amazingly fast, because it it generating a static site, and creating Html files for each page your website has, the speed will be much faster than any other framework you can use. Unlike other other technologies that produce static websites react will not require a load of HTML files. According to their website&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“Gatsby generates your site’s HTML pages, but also creates a JavaScript runtime that takes over in the browser once the initial HTML has loaded” — gatsbyjs.org&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h5&gt;
  
  
  &lt;em&gt;That means every page is a React app. Nice!&lt;/em&gt;
&lt;/h5&gt;

&lt;h1&gt;
  
  
  2. Security
&lt;/h1&gt;

&lt;p&gt;Since there isn't a live database to access, there isn't any user data that is going to be stored on the server with a Gatsby site. All this means is that even if anyone were able to have the server they would still only get access to HTML files and will be able to do far less damage than they could if they were getting access to a framework that supplied user data or sensitive information. In short you'll have pretty substantial security gains if you decide to use Gatsby for your project.&lt;/p&gt;

&lt;h1&gt;
  
  
  3. Improved developer experience
&lt;/h1&gt;

&lt;h4&gt;
  
  
  Gatsby has a couple of things that help improve developer experience.
&lt;/h4&gt;

&lt;h6&gt;
  
  
  &lt;em&gt;so here is, you guessed it, another list!&lt;/em&gt;
&lt;/h6&gt;

&lt;ul&gt;
&lt;li&gt;The Plugins.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Gatsby has some amazingly useful plugins that are available at the official website. According to their website there are over 2000 plugins available. Some of the most used are:&lt;br&gt;
    1. &lt;strong&gt;gatsby-plugin-manifest:&lt;/strong&gt; this makes your site an installable and also a PWA (progressive web app).&lt;br&gt;
    2. &lt;strong&gt;gatsby-plugin-offline:&lt;/strong&gt; this will allow your site to run offline&lt;br&gt;
    3. &lt;strong&gt;gatsby-plugin-google-analytics:&lt;/strong&gt; allows you to use google analytics in your website&lt;br&gt;
    4. &lt;strong&gt;gatsby-remark-embed-youtube:&lt;/strong&gt; allows you to to embed YouTube videos in your website.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;em&gt;For a complete list visit&lt;/em&gt; &lt;a href="https://www.gatsbyjs.com/plugins" rel="noopener noreferrer"&gt;Gatsby Plugins&lt;/a&gt;.
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Starters and templates&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There are plenty of Gatsby starter repos and templates that are simple as cloning and changing the content to your specifications. This makes developing websites super quick and efficient. Gatsby also has excellent documentation and even tutorials based on your skill level. If you're interested in checking that out you can visit &lt;a href="https://www.gatsbyjs.com/docs/tutorial/" rel="noopener noreferrer"&gt;Gatsby Tutorial&lt;/a&gt; to get started. &lt;/p&gt;

&lt;h4&gt;
  
  
  Have I convinced you to try GatsbyJs yet?
&lt;/h4&gt;

&lt;p&gt;If I have, here's how to include it in your next project.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;em&gt;(optional)&lt;/em&gt; Use the Gatsby CLI tool to clone a starter repo
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;gatsby&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;site_directory&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;url_of_starter_git_repo&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Open gatsby-config.js and configure it to your liking
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;siteMetadata&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;your&lt;/span&gt; &lt;span class="nx"&gt;title&lt;/span&gt; &lt;span class="nx"&gt;here&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
      &lt;span class="p"&gt;},&lt;/span&gt;
      &lt;span class="na"&gt;plugins&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="p"&gt;...&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="na"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;gatsby-source-dev&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="na"&gt;options&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="na"&gt;username&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;your&lt;/span&gt; &lt;span class="nx"&gt;username&lt;/span&gt; &lt;span class="nx"&gt;here&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
          &lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="p"&gt;...&lt;/span&gt;
      &lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;npm install and npm start and that's it!&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  It's your turn to try it!
&lt;/h4&gt;

&lt;p&gt;If you like what you've read try it out in your next project.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>All about Vue.js</title>
      <dc:creator>ABailey92</dc:creator>
      <pubDate>Mon, 14 Dec 2020 14:13:38 +0000</pubDate>
      <link>https://forem.com/abailey92/all-about-vue-js-2a35</link>
      <guid>https://forem.com/abailey92/all-about-vue-js-2a35</guid>
      <description>&lt;p&gt;If you've been studying JavaScript, chances are you've come across a few frameworks. Most people are familiar with Angular and React, in this blog I will tell you about the pros and cons of Vue.js&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;&lt;em&gt;Okay, first thing first: What is Vue.js?&lt;/em&gt;&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;According to vuejs.org&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Vue.js is a progressive framework for JavaScript used to build web interfaces and single page applications&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Vue was created by Evan You and uses "high decoupling", which allows developers to progressively create user interfaces. Vue is often called the "combination of React and Angular" because it uses concepts such as directives and components to control and show UIs. Once small advantage that Vue has over React is that Vue has the ability to control HTML that has already been rendered by the server. Anyway, I promised pros and cons so here are pros and cons.&lt;/p&gt;

&lt;h4&gt;
  
  
  The Pros
&lt;/h4&gt;

&lt;p&gt;In 2019 Vue became the second most loved framework. The main reasons for this are: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Size, because it is so small Vue is very fast to download and also positively impact your SEO and UX.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Flexibility, Vue is flexible and scalable. This means that it can be used for a huge SPA as well as used for a smaller component that will be integrated using a different technology such as React or Angular. Since the backend is build with JavaScript it can be added to existing applications with no problem.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Useful conventions, Vue helps developers avoid writing a lot of boilerplate code by enforcing effort-saving conventions. These include native support for things like animations, state management, and composing components. It's important to note that even things like classnames are essentially built into Vue.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Easy to learn, most developers say that the learning curve for Vue is not very steep, and for most developers it will be the easiest framework to learn. Vue has excellent documentation to fit every developer's needs.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  The Cons
&lt;/h4&gt;

&lt;p&gt;Like all good things in life, there are some cons to consider, especially some to consider if, like myself, you learned React first. &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Templates, The biggest feature of Vue.js is by the template syntax to write interfaces. A lot of developers state that the template syntax adds a layer of abstraction between what is written and what is displayed in the browser. Having to keep in mind that Vue.js templates are not simply JavaScript does add a layer of complexity.
This is an example of templating
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;a &amp;amp;&amp;amp; b&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="kd"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;{a: true, b:false}&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt; &lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;click&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;trigger('hello')&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;hello&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Custom Events, In Vue children must use events as a way to communicate to parent components. If you are used to react it's a lot different then just passing props down from the parent component to children.&lt;/p&gt;

&lt;p&gt;Events in Vue look a little this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;template&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;app&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt; &lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;on&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nx"&gt;click&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;greet('hi')&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Greet&lt;/span&gt; &lt;span class="nx"&gt;hi&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt; &lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;on&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nx"&gt;click&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;greet('what')&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Ask&lt;/span&gt; &lt;span class="nx"&gt;what&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/template&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;script&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;app&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;

  &lt;span class="na"&gt;methods&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;alert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/script&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Smaller community, Because Vue is still relatively new and still evolving it's not as popular as React or angular. Since it is evolving so fast many tutorials you find online may be outdated and if you find yourself stuck on a problem it may take quite some time to find a solution. For smaller projects this isn't as much of an issue, but this problem rears its ugly head when working on larger projects.&lt;/p&gt;

&lt;h3&gt;
  
  
  So should I try it?
&lt;/h3&gt;

&lt;p&gt;Vue is pretty popular when it comes to creating beautiful SPA's. There are plenty of other frameworks that can accomplish this as well. I would definitely suggest using Vue for smaller scale projects and since you can probably learn it in a weekend I would suggest that you look into it after reading this blog.&lt;/p&gt;

&lt;p&gt;Check it out here  &lt;a href="https://vuejs.org/"&gt;Vue.js&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>More ES6 magic: Async/Await</title>
      <dc:creator>ABailey92</dc:creator>
      <pubDate>Mon, 09 Nov 2020 12:22:24 +0000</pubDate>
      <link>https://forem.com/abailey92/more-es6-magic-async-await-17eh</link>
      <guid>https://forem.com/abailey92/more-es6-magic-async-await-17eh</guid>
      <description>&lt;p&gt;If you thought &lt;code&gt;promises&lt;/code&gt; were the best thing since sliced bread after dealing with &lt;strong&gt;callback hell&lt;/strong&gt;, wait until you discover the JS magic of &lt;code&gt;async&lt;/code&gt; and &lt;code&gt;await&lt;/code&gt;. It's important to note that you must have a general understanding of how promises work in order to truly understand how to use async and await, since they are just &lt;em&gt;syntactical sugar&lt;/em&gt;. So I'll start with giving a brief overview&lt;br&gt;
of promises to get you up to speed if you've never heard of them, or give you a refresher if you already know what they are.&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;em&gt;Promises Explained&lt;/em&gt;
&lt;/h2&gt;



&lt;br&gt;
In the words of MDN

&lt;blockquote&gt;
&lt;p&gt;A promise is an object which can be returned synchronously from an asynchronous function. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A Promise constructor takes in a function that takes in  two parameters: &lt;code&gt;Reject&lt;/code&gt; and &lt;code&gt;Resolve&lt;/code&gt;. It will be in one of 3 possible states:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Resolved: A Promise was successful in retrieving data or getting a value&lt;/li&gt;
&lt;li&gt;Rejected: A Promise could not retrieve data due to an error or issue&lt;/li&gt;
&lt;li&gt;Pending: not yet Resolved or rejected&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A &lt;code&gt;.then&lt;/code&gt; is then chained to run a function upon success and a &lt;code&gt;.catch&lt;/code&gt; is added to provide error handling.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;save&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;handleErrors&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A promise is settled if it’s not pending (it has been resolved or rejected). &lt;/p&gt;

&lt;h2&gt;
  
  
  How does it get any better than that?
&lt;/h2&gt;

&lt;p&gt;Two words: Async &amp;amp; Await. Well, that's actually three, but I digress. &lt;br&gt;
Let's start with &lt;code&gt;async&lt;/code&gt;. The async keyword can be placed before a function like &lt;code&gt;async function test()&lt;/code&gt; or &lt;code&gt;const test = async() =&amp;gt;{}&lt;/code&gt;. Using the word async before a function means that that function will return a promise. The values returned from that function are automatically wrapped in a resolved promise.&lt;br&gt;
Now onto &lt;code&gt;await&lt;/code&gt;! Await can &lt;strong&gt;only&lt;/strong&gt; be used inside of an async function. You can use async without await but you cannot use await without async. Got it? Good. Await tells javascript to wait, to stop what its doing until the promise returned from the async function is rejected or resolved. Let's take a look at difference.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;noAwait&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;axios&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// undefined&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This results in undefined being logged to the console. But why? This is because getting requests take time. As you know javascript is synchronus, so it will continue to move along before that promise is resolved and data is provided a value.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;withAwait&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;axios&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// json object&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This results in json being logged to the console. This is because the &lt;code&gt;await&lt;/code&gt; keyword has been added and tells javascript to wait for the promise to be resolved before it moves on.&lt;/p&gt;

&lt;p&gt;You may be thinking: how does error handling work with this syntax? It's very common to use a &lt;code&gt;try and catch&lt;/code&gt; block for error handling with async and await.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;f&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

  &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;axios&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;http://no-such-url&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;alert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// TypeError: failed to fetch&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;f&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Since async function do return promises you can also just chain a &lt;code&gt;.catch&lt;/code&gt; and that will handle a rejected promise as well.&lt;/p&gt;

&lt;p&gt;So rather than using promise chaining or the dreaded callback hell nesting, try using async &amp;amp; and await. Together they provide a great framework to write asynchronus code that is easy to read and write.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>All about REST</title>
      <dc:creator>ABailey92</dc:creator>
      <pubDate>Sun, 25 Oct 2020 14:04:29 +0000</pubDate>
      <link>https://forem.com/abailey92/all-about-rest-2ce6</link>
      <guid>https://forem.com/abailey92/all-about-rest-2ce6</guid>
      <description>&lt;p&gt;When you are browsing a web page, have you ever wondered: where does this page get all of this information from? The short answer is: &lt;strong&gt;a server&lt;/strong&gt;. In this article we are going to explore what an API is, more specifically a &lt;em&gt;RESTful API&lt;/em&gt;, and dive a bit deeper to see how exactly a &lt;strong&gt;client&lt;/strong&gt; communicates with a &lt;strong&gt;server&lt;/strong&gt; to get information.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;&lt;em&gt;Okay, first thing first: the lingo&lt;/em&gt;&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Knowing the following terms will help you understand &lt;br&gt;
exactly what REST is and what it means to make an API RESTful.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Client&lt;/li&gt;
&lt;li&gt;Server&lt;/li&gt;
&lt;li&gt;API&lt;/li&gt;
&lt;/ol&gt;
&lt;h4&gt;
  
  
  So what's a client? A server?
&lt;/h4&gt;

&lt;p&gt;A client is the browser that &lt;strong&gt;makes&lt;/strong&gt; the request for data.&lt;br&gt;
This is typically done through a HTTP request: &lt;br&gt;
If you've never seen a HTTP request here is an example&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;get&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;){})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The server is, as Wikipedia puts it: &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;a piece of computer hardware or software (computer program) that provides functionality for other programs or devices, called "clients"&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In short: servers provide the information that the client requests so as long as the information is something the server can provide.&lt;/p&gt;

&lt;p&gt;A real world example of how the client - server relationship works is a night out at a restaurant. You, as a paying customer, are the client. You read the menu, and request the food you may like. Your waiter or waitress is the server. They listen to your request and check to see if it is something they can fulfill. If you ask for pizza at a burger place, you've made a bad request, and it won't get fulfilled.&lt;/p&gt;

&lt;h4&gt;
  
  
  On to APIs!
&lt;/h4&gt;

&lt;p&gt;The acronym API stands for &lt;strong&gt;Application Programming Interfaces&lt;/strong&gt;. Now what exactly does that mean? And why are APIs useful? &lt;br&gt;
According to MDN an API  is&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;a set of commands, functions, protocols, and objects that programmers can use to create software or interact with an external system.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Have you ever used a weather app? More than likely they are using a weather API to update the weather conditions on their app dynamically. &lt;/p&gt;

&lt;p&gt;Have you used tinder? This is another great example of API usage as they use a Facebook API to show shared friends and shared interests among potential matches.&lt;/p&gt;

&lt;p&gt;If you've ever used &lt;code&gt;JQuery&lt;/code&gt;, you guessed it, you've used an API. &lt;code&gt;JQuery&lt;/code&gt; gives us access to a lot of functions and objects that helps us create software. If you look back at MDN's definition of what an API is, this fits perfectly!&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Finally! Lets talk about&lt;/strong&gt; &lt;em&gt;REST&lt;/em&gt;
&lt;/h3&gt;

&lt;p&gt;REST stands for &lt;strong&gt;RE&lt;/strong&gt;presentational &lt;strong&gt;S&lt;/strong&gt;tate &lt;strong&gt;T&lt;/strong&gt;ransfer&lt;br&gt;
REST is essentially just an architectural style for designing APIs. Roy fielding began REST as apart of his PHD dissertation where he developed a set of rules that web developers could follow when building their APIs. He brought about the idea that all websites should use the same structure for building their APIs. This made it much easier for clients and servers to work together and use different APIs to work quickly, efficiently, and easily.&lt;/p&gt;

&lt;h5&gt;
  
  
  so what exactly makes an API RESTful?
&lt;/h5&gt;

&lt;p&gt;There are a few rules that an API has to follow in order to be considered RESTful. The two main rules are:&lt;/p&gt;

&lt;blockquote&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Must use HTTP request verbs. Those verbs include:&lt;/strong&gt;

&lt;ol&gt;
&lt;li&gt;GET - gets the request from the server&lt;/li&gt;
&lt;li&gt;POST - posts the request to the server&lt;/li&gt;
&lt;li&gt;PUT &amp;amp; PATCH - updates information on the database&lt;/li&gt;
&lt;li&gt;DELETE - deletes a specific piece of information in the database&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Must use a specific pattern of routes/endpoint URLS&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/blockquote&gt;

&lt;p&gt;An API must follow the following routing patterns to be considered RESTful&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--sSXPgvW6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/iipt59glzsttljuj2ew3.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sSXPgvW6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/iipt59glzsttljuj2ew3.jpg" alt="RESTful routing"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  Looking for a challenge?
&lt;/h5&gt;

&lt;p&gt;After reading this article see if you can build your own RESTful API. &lt;/p&gt;

&lt;h5&gt;
  
  
  Good Luck!
&lt;/h5&gt;

</description>
      <category>javascript</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>Intro to ES6 Classes</title>
      <dc:creator>ABailey92</dc:creator>
      <pubDate>Sun, 18 Oct 2020 12:39:26 +0000</pubDate>
      <link>https://forem.com/abailey92/intro-to-es6-classes-2hfe</link>
      <guid>https://forem.com/abailey92/intro-to-es6-classes-2hfe</guid>
      <description>&lt;p&gt;One of my favorite new features from ES6 is the new way of implementing classes. To understand the new way to instantiate classes you must first understand how &lt;strong&gt;constructors&lt;/strong&gt; and &lt;strong&gt;prototypes&lt;/strong&gt; work. This is because ES6 classes are &lt;em&gt;syntactical sugar&lt;/em&gt;. You may be thinking: what exactly is syntactical sugar? &lt;/p&gt;

&lt;p&gt;Well, Techopedia defines syntactical sugar as: &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"a term for syntax changes in computer programming which make it easier for humans to code." &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In other words, it makes our code easier to read and easier to understand. &lt;/p&gt;

&lt;p&gt;Sounds good to me, sign me up for some &lt;strong&gt;&lt;em&gt;candygrammar&lt;/em&gt;&lt;/strong&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%2Fi%2Futcyjf46ox89ghe8icqr.jpg" 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%2Fi%2Futcyjf46ox89ghe8icqr.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;&lt;em&gt;Prototypes and constructors explained&lt;/em&gt;&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;So what's a prototype? Simply put, &lt;em&gt;a prototype is an object that allows other objects to use shared properties&lt;/em&gt;. Most objects are instances of Object. That may sound confusing, so here is an example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;student&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;A name&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="na"&gt;lastName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;A last name&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="na"&gt;coder&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;student&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;valueOf&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt; &lt;span class="c1"&gt;// {name: 'A name', lastName: 'A last name', coder: true}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Wait, how did we call a method of &lt;code&gt;.valueOf&lt;/code&gt; if it doesn't exist on the student object? This is where &lt;strong&gt;&lt;em&gt;prototype chains&lt;/em&gt;&lt;/strong&gt; come into play. The browser will initially check to see if the student object has a method called &lt;code&gt;valueOf&lt;/code&gt; available. If it doesn't it looks to the parent prototype and in this case it is the Object class. If Object did not have a &lt;code&gt;valueOf&lt;/code&gt; method the console would print &lt;code&gt;undefined&lt;/code&gt; &lt;/p&gt;

&lt;h3&gt;
  
  
  Well what about constructors?
&lt;/h3&gt;

&lt;p&gt;A constructor is &lt;em&gt;a function that creates an instance of a class&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;User&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;email&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;
&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;email&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;email&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;UserA&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Sally&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;SallyJ@gmail.com&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;UserA&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// User {name: 'Sally', email: 'SallyJ@gmail.com'}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  When a constructor is invoked:
&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;an empty object is created&lt;/li&gt;
&lt;li&gt;the created object is returned as the constructor's value implicitly, notice no &lt;code&gt;return&lt;/code&gt; keyword being used.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;this&lt;/code&gt; keyword will refer to the newly created object.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you are new to the concepts of inheritance, prototypes, and constructors and still find yourself confused after my examples above; I suggest using &lt;a href="http://www.Udemy.com" rel="noopener noreferrer"&gt;Udemy&lt;/a&gt; or &lt;a href="http://www.coderwall.com" rel="noopener noreferrer"&gt;coderwall&lt;/a&gt; to get better acquainted, since these two are &lt;strong&gt;crucial&lt;/strong&gt; to understanding how ES6 classes work.&lt;/p&gt;

&lt;h6&gt;
  
  
  &lt;em&gt;Okay enough about what's happening under the hood.&lt;/em&gt;
&lt;/h6&gt;

&lt;p&gt;Here's why I think ES6 Classes are so great:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The &lt;code&gt;class&lt;/code&gt; keyword

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;class&lt;/code&gt; keyword creates a new class with our name of choice. It's best practice to use a capital letter when declaring a class e.g.: &lt;code&gt;class Student{}&lt;/code&gt;. I like this feature because it explicitly states that we are creating a new class. No guesswork, or second thought required.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Static&lt;/code&gt; methods

&lt;ul&gt;
&lt;li&gt;MDN defines a static method as a method that is &lt;em&gt;"called without instantiating their class and are also not callable when the class is instantiated. Static methods are often used to create utility functions for an application."&lt;/em&gt; In layman's terms static methods have no access to data stored in specific objects. With ES6 we now have the ability to declare a static method on a parent class and have it available to their subclasses as well.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Super&lt;/code&gt; &amp;amp; &lt;code&gt;Extends&lt;/code&gt; keywords

&lt;ul&gt;
&lt;li&gt;The super keyword can be used in 2 ways: 

&lt;ol&gt;
&lt;li&gt;As a function: &lt;code&gt;super&lt;/code&gt; can be used as a function that calls upon the parent class with the parameters passed to the sub or child class. This ensures that the sub class is in fact an &lt;code&gt;instanceof&lt;/code&gt; the parent class.&lt;/li&gt;
&lt;li&gt;As an object: The &lt;code&gt;super&lt;/code&gt; keyword can also be used as an object so that the child class can call the methods of the parent class explicitly.&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;/li&gt;

&lt;/ol&gt;

&lt;h4&gt;
  
  
  &lt;em&gt;How it started&lt;/em&gt;
&lt;/h4&gt;

&lt;p&gt;This is how a class would be declared and modified prior to ES6&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;Person&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;age&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;
&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;grade&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;grade&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;Person&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;prototype&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;greeting&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Hi, my name is&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;nice to meet you.&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;Person&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;prototype&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;extraInfo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;I am&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;age&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;and my favorite thing to do is...&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If we wanted to extend these properties to a subclass, it would look like&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;Child&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;age&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
   &lt;span class="nx"&gt;Person&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;call&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;age&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;Child&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;prototype&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;Person&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;protoype&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nx"&gt;Child&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;prototype&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;constructor&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Child&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nx"&gt;Child&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;prototype&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;chores&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;My name is&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;I am&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;age&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;and I have to mop the floor, wash the dishes, and do the laundry&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;  
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;em&gt;How it's going&lt;/em&gt;
&lt;/h4&gt;

&lt;p&gt;This is how class instantion and inheritance looks now&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Person&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="nf"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;age&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
   &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;
   &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;age&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;age&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nf"&gt;greeting&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;`Hi my name is &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;, nice to meet you!
}

extraInfo() {
  return `&lt;/span&gt;&lt;span class="nx"&gt;I&lt;/span&gt; &lt;span class="nx"&gt;am&lt;/span&gt; &lt;span class="nx"&gt;$&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;age&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="nx"&gt;and&lt;/span&gt; &lt;span class="nx"&gt;my&lt;/span&gt; &lt;span class="nx"&gt;favorite&lt;/span&gt; &lt;span class="nx"&gt;thing&lt;/span&gt; &lt;span class="nx"&gt;to&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; &lt;span class="nx"&gt;is&lt;/span&gt;&lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="s2"&gt;`
}
}

class Child extends Person {
 constructor(name, age){
    super(name, age)
}

chores() {
  return `&lt;/span&gt;&lt;span class="nx"&gt;My&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="nx"&gt;is&lt;/span&gt; &lt;span class="nx"&gt;$&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="nx"&gt;I&lt;/span&gt; &lt;span class="nx"&gt;am&lt;/span&gt; &lt;span class="nx"&gt;$&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;age&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; 
&lt;span class="nx"&gt;and&lt;/span&gt; &lt;span class="nx"&gt;I&lt;/span&gt; &lt;span class="nx"&gt;have&lt;/span&gt; &lt;span class="nx"&gt;to&lt;/span&gt; &lt;span class="nx"&gt;mop&lt;/span&gt; &lt;span class="nx"&gt;the&lt;/span&gt; &lt;span class="nx"&gt;floor&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;wash&lt;/span&gt; &lt;span class="nx"&gt;the&lt;/span&gt; &lt;span class="nx"&gt;dishes&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;and&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; &lt;span class="nx"&gt;the&lt;/span&gt; &lt;span class="nx"&gt;laundry&lt;/span&gt;&lt;span class="s2"&gt;`
}
}

const Mary = new Child('Mary', '7')
console.log(Amelia.greeting()) // Hi my name is Mary, nice to meet you
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  &lt;em&gt;see how much easier the ES6 version is to read and understand?&lt;/em&gt;
&lt;/h5&gt;

&lt;blockquote&gt;
&lt;p&gt;It's important to note that the underlying functionality hasn't changed, but the new syntax provides a nice style to classes that make it much more readable and developer friendly.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4&gt;
  
  
  Now it's your turn
&lt;/h4&gt;

&lt;p&gt;Try out the ES6 class instantiation pattern and features. &lt;br&gt;
&lt;em&gt;I promise you'll never turn back.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>Intro to Bootstrap</title>
      <dc:creator>ABailey92</dc:creator>
      <pubDate>Tue, 22 Sep 2020 16:42:38 +0000</pubDate>
      <link>https://forem.com/abailey92/intro-to-bootstrap-43nn</link>
      <guid>https://forem.com/abailey92/intro-to-bootstrap-43nn</guid>
      <description>&lt;p&gt;In order to become a bootstrap expert you will need to first grasp the fundamentals of HTML and CSS. Without this, you will not understand how to implement bootstrap and will find yourself becoming frustrated with a program designed to make your life easier.&lt;br&gt;
&lt;b&gt;&lt;h3&gt;Brushed up on your HTML &amp;amp; CSS?&lt;/h3&gt;&lt;/b&gt;&lt;br&gt;
Great now you're ready to dive into bootstrap! First, I bet you're wondering, "what exactly is bootstrap?". Well, bootstrap is a library that, in short, makes web development shorter and easier. It also makes pages more responsive. Getting started is as easy as copying and pasting the CDN located at &lt;a href="https://getbootstrap.com"&gt;get boostrap here&lt;/a&gt;. From there the documentation is very user friendly and most elements can be styled by simply adding bootstrap specified classes to them.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UNQj1ERw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ebbi54rf62nanu8wmtpg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UNQj1ERw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ebbi54rf62nanu8wmtpg.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the example above changing your alert button is as simple as adding the class of "alert alert-primary", "alert alert-dark" and so on. The first class of "alert" tells bootstrap to make the div rounded and thin, essentially making it into an alert bar. The second class will tell bootstrap the color you would like your alert bar. Primary is blue, secondary is gray, and danger is red. There are many other colors too, and all it takes is a few minutes to read the documentation on how to specify which color you want. &lt;/p&gt;

&lt;p&gt;&lt;b&gt;&lt;h3&gt;The only thing left to do is try it out!&lt;/h3&gt;&lt;/b&gt;&lt;br&gt;
I suggest looking at examples &lt;a href="https://getbootstrap.com/docs/4.5/examples/"&gt;here&lt;/a&gt; and playing around with it until you feel more comfortable implementing this into your own personal project. &lt;/p&gt;

&lt;h5&gt;&lt;i&gt;Here is to consistent, responsive, and beautiful websites in a fraction of the time.&lt;/i&gt;&lt;/h5&gt; 

</description>
      <category>beginners</category>
      <category>css</category>
      <category>webdev</category>
      <category>typescript</category>
    </item>
  </channel>
</rss>
