<?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: Nathan A. Hains</title>
    <description>The latest articles on Forem by Nathan A. Hains (@nathanhains).</description>
    <link>https://forem.com/nathanhains</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%2F571600%2Fc89a4435-7818-48eb-8e6f-97e525ac75b5.jpeg</url>
      <title>Forem: Nathan A. Hains</title>
      <link>https://forem.com/nathanhains</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/nathanhains"/>
    <language>en</language>
    <item>
      <title>How to change React boilerplate icon/text</title>
      <dc:creator>Nathan A. Hains</dc:creator>
      <pubDate>Tue, 13 Jul 2021 19:32:11 +0000</pubDate>
      <link>https://forem.com/nathanhains/how-to-change-react-boilerplate-icon-text-1l7p</link>
      <guid>https://forem.com/nathanhains/how-to-change-react-boilerplate-icon-text-1l7p</guid>
      <description>&lt;h2&gt;
  
  
  I'm gonna show you how we can go from this:
&lt;/h2&gt;

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

&lt;h2&gt;
  
  
  To &lt;em&gt;this&lt;/em&gt;:
&lt;/h2&gt;

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

&lt;h2&gt;
  
  
  In just a few simple steps
&lt;/h2&gt;




&lt;p&gt;So,&lt;/p&gt;

&lt;p&gt;After &lt;strong&gt;hours&lt;/strong&gt; of sweat, grind and code you've &lt;em&gt;finally&lt;/em&gt; deployed your project. You think it's all over, and that the game is won. &lt;/p&gt;

&lt;p&gt;That is, &lt;em&gt;until you look up and to the left and see "React app" plastered across your beautiful app.&lt;/em&gt; &lt;/p&gt;

&lt;p&gt;It's never &lt;em&gt;truly&lt;/em&gt; over now is it? Welcome to programming.&lt;/p&gt;

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

&lt;p&gt;In all honesty, recruiters &lt;em&gt;don't&lt;/em&gt; want to see that. It gives the impression that you don't refine all the edges, and may very well be the deciding factor in moving on to the next applicant. Good news is that if you're reading this, that isn't going to be you. &lt;/p&gt;




&lt;h3&gt;
  
  
  How to Change the boilerplate display
&lt;/h3&gt;

&lt;h4&gt;
  
  
  1. Do not deploy until the end of this blog
&lt;/h4&gt;

&lt;p&gt;There are some default mechanisms in place that, in the case of &lt;em&gt;deploying before finishing&lt;/em&gt;, will reset all the progress you've made. Heed my warning, you will be &lt;em&gt;very&lt;/em&gt; mad. &lt;/p&gt;

&lt;h4&gt;
  
  
  2. Take a look at the folders on the right.
&lt;/h4&gt;

&lt;p&gt;Chances are, if you're seeing boilerplate, you've ran create-react-app some way or another. You should see two folders. &lt;strong&gt;Public&lt;/strong&gt; and &lt;strong&gt;Build&lt;/strong&gt;. We will focus on 4 of the same files within each: &lt;em&gt;manifest.json&lt;/em&gt;, &lt;em&gt;index.html&lt;/em&gt;, &lt;em&gt;favicon.io&lt;/em&gt; and &lt;em&gt;logo192.png&lt;/em&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  3. Set up your replacement pictures
&lt;/h4&gt;

&lt;p&gt;You're gonna need two files. The first, a .io (favicon icon) file, and the second, a .png file. The first is gonna be for web browsers, the second for mobile devices like you saw in the beginning of this blog.&lt;/p&gt;

&lt;p&gt;I recommend using &lt;a href="https://favicon.io/favicon-converter/" rel="noopener noreferrer"&gt;https://favicon.io/favicon-converter/&lt;/a&gt; for your .io file. It is &lt;em&gt;free&lt;/em&gt; and easily accessible. Zero hassle. &lt;/p&gt;

&lt;p&gt;Once you've got them ready to use, load 'em up into build and public.&lt;/p&gt;

&lt;h4&gt;
  
  
  4. Replacement time
&lt;/h4&gt;

&lt;p&gt;Go ahead and delete favicon.io and logo192.png, we won't be needing them anymore. &lt;/p&gt;

&lt;p&gt;Next, next head into one of the manifest.json files. &lt;/p&gt;

&lt;p&gt;They are the exact same and should look a little like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&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;short_name&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;React App&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;name&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;Create React App Sample&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;icons&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="p"&gt;{&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;src&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;favicon.ico&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;sizes&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;64x64 32x32 24x24 16x16&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;type&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;image/x-icon&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;src&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;logo192.png&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;type&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;image/png&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;sizes&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;192x192&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;src&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;logo512.png&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;type&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;image/png&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;sizes&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;512x512&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;start_url&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;.&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;display&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;standalone&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;theme_color&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;#000000&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;background_color&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;#ffffff&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;Edit your short_name, name and src lines to your respective file names.&lt;/p&gt;

&lt;p&gt;Finally, head into index.html and find/replace these lines:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;link&lt;/span&gt; &lt;span class="na"&gt;rel&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"icon"&lt;/span&gt; &lt;span class="na"&gt;href&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"%PUBLIC_URL%/favicon.ico"&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;link&lt;/span&gt; &lt;span class="na"&gt;rel&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"apple-touch-icon"&lt;/span&gt; &lt;span class="na"&gt;href&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"%PUBLIC_URL%/logo192.png"&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;title&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;React App&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;title&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;Run deploy and there you have it!&lt;/p&gt;

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

&lt;p&gt;Look how nice. Go ahead and pat yourself on the back, you're now a more robust programmer 😄&lt;/p&gt;




&lt;p&gt;If you liked the article, consider giving me a follow! &lt;br&gt;
I'm always updating the webiverse with more how-to content. &lt;/p&gt;

&lt;p&gt;Also, connect with me on Linkedin! &lt;a href="https://www.linkedin.com/in/nathanhains/" rel="noopener noreferrer"&gt;https://www.linkedin.com/in/nathanhains/&lt;/a&gt;&lt;br&gt;
Always up to meet new people.&lt;/p&gt;

&lt;p&gt;Aside from that, I hope you have an excellent day!!!&lt;/p&gt;

</description>
      <category>react</category>
      <category>beginners</category>
      <category>html</category>
    </item>
    <item>
      <title>Animate in style with Framer Motion</title>
      <dc:creator>Nathan A. Hains</dc:creator>
      <pubDate>Tue, 06 Jul 2021 20:47:44 +0000</pubDate>
      <link>https://forem.com/nathanhains/animate-in-style-with-framer-motion-14c1</link>
      <guid>https://forem.com/nathanhains/animate-in-style-with-framer-motion-14c1</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--F3xKwaHH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iuansriqlzzjane7eiix.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--F3xKwaHH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iuansriqlzzjane7eiix.gif" alt="Alt text of image"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  If you're thinking:
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;h5&gt;
  
  
  &lt;em&gt;"Wow,&lt;/em&gt; &lt;strong&gt;that&lt;/strong&gt; &lt;em&gt;looks complicated!"&lt;/em&gt;
&lt;/h5&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  or
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;h5&gt;
  
  
  &lt;em&gt;"Wow,&lt;/em&gt; &lt;strong&gt;you've&lt;/strong&gt; &lt;em&gt;got time on your hands."&lt;/em&gt;
&lt;/h5&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Then allow me to introduce &lt;strong&gt;Framer-Motion&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;As per &lt;a href="https://www.framer.com"&gt;https://www.framer.com&lt;/a&gt;,&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A production-ready motion library for React. Utilize the power behind Framer, the best prototyping tool for teams. Proudly open source.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;To put it simply, &lt;/p&gt;

&lt;p&gt;&lt;em&gt;you can use framer-motion to create elegant animations like the one listed above in as little no time&lt;/em&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  To start
&lt;/h2&gt;

&lt;p&gt;run the following command within your React application:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="nx"&gt;npm&lt;/span&gt; &lt;span class="nx"&gt;install&lt;/span&gt; &lt;span class="nx"&gt;framer&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;motion&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once you've got that set up you're good to go.&lt;/p&gt;

&lt;p&gt;What specifically you want to animate is up to your choice. Here I will show you an example that's easy to understand. &lt;/p&gt;

&lt;p&gt;Regardless of what you choose to animate, the options are endless.&lt;/p&gt;

&lt;h2&gt;
  
  
  Let's begin with a &lt;em&gt;simple example.&lt;/em&gt;
&lt;/h2&gt;

&lt;p&gt;Let's say you have a div within a component like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
   &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;h2&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Header!&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;h2&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And you want to animate that header to &lt;em&gt;come from the right&lt;/em&gt; and to &lt;em&gt;fade in&lt;/em&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  First
&lt;/h3&gt;

&lt;p&gt;Import both AnimatePresence and motion from framer-motion&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&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;AnimatePresence&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;motion&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="s2"&gt;framer-motion&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will allow you to add "motion." to whatever element you choose give animated capabilities. &lt;/p&gt;

&lt;h3&gt;
  
  
  Then
&lt;/h3&gt;

&lt;p&gt;Add the code to your render&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;AnimatedPresence&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
   &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;motion&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;h2&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Header!&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;h2&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
   &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;motion&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;AnimatedPresence&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Finally
&lt;/h3&gt;

&lt;p&gt;Framer-motion gives &lt;em&gt;a ton&lt;/em&gt; of options to fiddle around with. In this examples, we will only be using &lt;em&gt;opacity&lt;/em&gt; and &lt;em&gt;x-coordinates&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;AnimatedPresence&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
   &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;motion&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt; 
       &lt;span class="na"&gt;initial&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="na"&gt;x&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;opacity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; 
       &lt;span class="na"&gt;animate&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="na"&gt;x&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;opacity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; 
       &lt;span class="na"&gt;exit&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="na"&gt;opacity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
       &lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;h2&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Header!&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;h2&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
   &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;motion&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;AnimatedPresence&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Voila
&lt;/h3&gt;

&lt;p&gt;You now have a basic understanding of how to implement framer-motion into your application with smooth animations!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_IGv4DCe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tqarqa5v3wscrcskknme.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_IGv4DCe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tqarqa5v3wscrcskknme.gif" alt="Alt text of image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  For details on the transition from the beginning
&lt;/h2&gt;

&lt;p&gt;Check out this how-to guide by &lt;strong&gt;CoderOne&lt;/strong&gt;!&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/-bll7l-BKQI"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>react</category>
      <category>npm</category>
      <category>animation</category>
      <category>style</category>
    </item>
    <item>
      <title>Reducer, Store, ACTION!</title>
      <dc:creator>Nathan A. Hains</dc:creator>
      <pubDate>Sat, 26 Jun 2021 03:35:16 +0000</pubDate>
      <link>https://forem.com/nathanhains/reducer-store-action-3h69</link>
      <guid>https://forem.com/nathanhains/reducer-store-action-3h69</guid>
      <description>&lt;h2&gt;
  
  
  React
&lt;/h2&gt;

&lt;p&gt;can be a confusing, yet amazing learning experience for the willing. It's all too easy to fall victim to the interwoven tunnels of passing down state from component to component. But what if I told you there was something that could help shed some light through those code-ful tunnels?&lt;/p&gt;

&lt;p&gt;Enter Redux. An open-source JavaScript library created by Dan Abramov and Andrew Clark centered around managing state. But you aren't here for the back story, right? &lt;strong&gt;Right&lt;/strong&gt;. Let's get into the &lt;em&gt;why&lt;/em&gt; aspect.&lt;/p&gt;

&lt;p&gt;Let's say you're like me. Or, &lt;em&gt;me a month ago&lt;/em&gt;. You want to create a new React application to post up some workouts for your bootcamp finale. Pretty simple sounding right? Until you map out the schematics of passing down state 101 times &lt;em&gt;without the Dalmatians&lt;/em&gt;. Pretty tedious if you ask me. The way &lt;strong&gt;redux&lt;/strong&gt; saves the day in this scenario is by holding state in &lt;strong&gt;one&lt;/strong&gt; place. That's right, &lt;strong&gt;one&lt;/strong&gt;. In bold so you &lt;em&gt;know&lt;/em&gt; that's a game-changer. &lt;/p&gt;

&lt;p&gt;To put this into perspective, take a look at how we'd begin this process of introducing redux. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8cfaz4nkae6zbt2z3g21.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8cfaz4nkae6zbt2z3g21.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The first thing you're gonna have to think about, is what your future self will be thinking about. Not to get too &lt;em&gt;inception-y&lt;/em&gt;, but you'll need to be able to call upon something to get what you want. This will be that something. This is what's called the &lt;strong&gt;reducer&lt;/strong&gt;. Here is where you'll &lt;em&gt;dispatch&lt;/em&gt;(keyword) specific tasks &amp;amp; items. So, in this example I'm imagining that I'll be dispatching an &lt;em&gt;action&lt;/em&gt;(another keyword) of adding a workout. Take a moment and let that big-brain wonder where we'd go next. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqon656oc9w8swtn8d1ax.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqon656oc9w8swtn8d1ax.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you guessed &lt;em&gt;back to the future&lt;/em&gt;, you'd be right! Now you're in the future and you've got your &lt;strong&gt;reducer&lt;/strong&gt; with no &lt;em&gt;action&lt;/em&gt; to dispatch. As you might &lt;em&gt;and should&lt;/em&gt; have guessed by now, this item is your &lt;strong&gt;action&lt;/strong&gt;. This establishes a &lt;em&gt;communication line&lt;/em&gt; between your reducer and wherever or whatever you wish to call upon your action to dispatch. But what's the point in all of this build up? Where's the climax?&lt;br&gt;
Will the big bad &lt;em&gt;React-patience-snapping-Gauntlet&lt;/em&gt; ever be defeated?&lt;/p&gt;

&lt;p&gt;Well,&lt;/p&gt;

&lt;h1&gt;
  
  
  TUNE IN NEXT TI--
&lt;/h1&gt;

&lt;p&gt;Just kidding.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwpoj4pbx0rux6wckr4v9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwpoj4pbx0rux6wckr4v9.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Introducing &lt;strong&gt;Store!&lt;/strong&gt; The &lt;em&gt;one and only&lt;/em&gt;, &lt;em&gt;all-encompassing&lt;/em&gt;, &lt;strong&gt;holy grail&lt;/strong&gt; of state management! That is, if you can look beyond the distracting left in cursor-highlighting. Nevertheless, you'll see we've called our &lt;strong&gt;reducer&lt;/strong&gt; for a nice family reunion. This is great because now we can use all sorts of goodies such as &lt;strong&gt;connect&lt;/strong&gt; to manipulate wherever we please! To an extent. Let's take a look at two examples in this project.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F05be6aavq5m5axadpgw4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F05be6aavq5m5axadpgw4.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you take a look at the top and bottom there, you might be reminiscing of an abandoned Xbox device from long ago. Using &lt;strong&gt;Connect&lt;/strong&gt;, we can directly access stored state &lt;em&gt;without&lt;/em&gt; having to pass down from component to component. In this example, we are using mapStateToProps. As the name implies... --On second thought, I don't even think I have to finish the sentence. But I will anyway.-- ...this &lt;em&gt;maps&lt;/em&gt; the &lt;strong&gt;State&lt;/strong&gt; to your &lt;em&gt;props&lt;/em&gt; which you can then use however you please! What a load off the hunched programming back, am I right?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4n3zo1e8xxbr15hmi6mx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4n3zo1e8xxbr15hmi6mx.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this second example, we see a familiar connect being the good sport it is. Instead of mapping the state to our props since it's unneeded here, we set null and use the second argument to call over a reduxified version of one of our actions! Here we're essentially saying "hey &lt;strong&gt;redux&lt;/strong&gt;, do what you do best and send this workout to my &lt;strong&gt;action&lt;/strong&gt;, to send this workout to my &lt;strong&gt;reducer&lt;/strong&gt;, to &lt;strong&gt;store&lt;/strong&gt; this workout in my &lt;strong&gt;store&lt;/strong&gt;." &lt;/p&gt;

&lt;p&gt;Thanks, redux.&lt;/p&gt;

&lt;p&gt;Well, if that distracting highlighting-cursor didn't scare you away by now, you've made it to the end! Congrats! You may now be a little bit more prepared than you were 5 minutes ago!! But in all seriousness redux can be a life saver depending on the type of programmer you are. I may seem a little bit biased here, but there are tons of different ways to get to &lt;em&gt;your&lt;/em&gt; finish line. Redux can be a great tool for a certain path, but passing state along down the rabbit hole may have it's own benefits. Who really knows? My advice: play around and see what works best for you. With all that being said, I hope you enjoyed the read and have yourself a happy rest of your day.&lt;/p&gt;

&lt;p&gt;-Nathan&lt;/p&gt;

</description>
      <category>react</category>
      <category>redux</category>
      <category>programming</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>Phase 4</title>
      <dc:creator>Nathan A. Hains</dc:creator>
      <pubDate>Thu, 27 May 2021 04:40:18 +0000</pubDate>
      <link>https://forem.com/nathanhains/phase-4-2d6m</link>
      <guid>https://forem.com/nathanhains/phase-4-2d6m</guid>
      <description>&lt;p&gt;Phase 4 has come to an end and with it, a new project week begins!! Or has begun.. &amp;amp; finished. But nonetheless new insights have come my way through this journey and I would love nothing better than to share my newfound knowledge with my cherished readers! &lt;/p&gt;

&lt;p&gt;Javascript is tough. There's no real way around it, unless maybe you started with javascript but even then the language is a real mind bender!! The biggest obstacle for me in designing my phase 4 project was where to go, what do do &amp;amp; most importantly HOW TO MANAGE JAVASCRIPT'S SYNCHRONOUS EMBODIMENT. &lt;/p&gt;

&lt;p&gt;Before that, I'd love to share this beautiful mantra I learned from a wonderful Flatiron instructor named Ayana Cotton. "When some event happens, I want to make what kind of fetch and then manipulate the Dom in what way?" This helped center my brain onto a one way track from start to finish. Simply add an event listener to the element you wish to expand on, use fetch to manipulate the backend once that event is listened to, and finally, change the dom to reflect that change in the frontend. Easy to remember right?&lt;/p&gt;

&lt;p&gt;Now back to synchronous. What this means is that Javascript performs one operation one at a time. But some things take a while.. such as manipulating a backend server. Since you'd rather not have the rest of your application wait one or many specific operations, we use these things called promises. Promises are just like they are in day to day life where you basically tell javascript that we promise to perform the task so everything else can load without a worry. Even in the event that a promise fails, we use catches to catch that failure and do something with it.&lt;/p&gt;

&lt;p&gt;Fetch requests make this process a lot easier where the promise syntax is combined into a simple word "fetch" that takes in the url you wish to make the fetch request to. What you wish to do with that returned information only once it is returned is chained on through ".then"s. &lt;/p&gt;

&lt;p&gt;To visualize this, here is a fetch request from my application called "iRemind."&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; getLists(){
        fetch(this.baseListURL)
        .then(response =&amp;gt; response.json())
        .then(lists =&amp;gt; {
            lists.data.forEach(list =&amp;gt; {
                let newList = new List(list, list.attributes)
                document.querySelector("#list-container").innerHTML += newList.renderList()
            })
            reminderForm.addCreateReminderForm()
        })
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, I wanted to get all the lists that are stored within my rails api backend.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;fetch(this.baseListURL)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;this is the fetch request being made where baseListURL is the url to my backend stored in a global constant elsewhere.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.then(response =&amp;gt; response.json())
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here is the chained on task once that fetch completed where I tell my program to turn that response to json!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.then(lists =&amp;gt; {
            lists.data.forEach(list =&amp;gt; {
                let newList = new List(list, list.attributes)
                document.querySelector("#list-container").innerHTML += newList.renderList()
            })
            reminderForm.addCreateReminderForm()
        })
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The rest of the code within the final then simply names the jsonified data as lists, which is what I wanted to then manipulate the data as I pleased. &lt;/p&gt;

&lt;p&gt;Fetch requests along with the mantra "When some event happens, I want to make what kind of fetch and then manipulate the Dom in what way?" were INTEGRAL to my understanding &amp;amp; really made connecting the dots a lot easier than they would have otherwise. Hopefully this cleared some of the gaps for you too! Until next time. &lt;/p&gt;

</description>
      <category>javascript</category>
      <category>rails</category>
      <category>ruby</category>
      <category>programming</category>
    </item>
    <item>
      <title>Phase 3 Finale</title>
      <dc:creator>Nathan A. Hains</dc:creator>
      <pubDate>Fri, 30 Apr 2021 22:18:22 +0000</pubDate>
      <link>https://forem.com/nathanhains/phase-3-finale-1hd8</link>
      <guid>https://forem.com/nathanhains/phase-3-finale-1hd8</guid>
      <description>&lt;p&gt;Today marks the final day to Flatiron's Phase 3. The main topic for Phase 3 was the introduction of Ruby on Rails. This was the most challenging Phase thus far but not without its rewards. One such reward came disguised as a valuable piece of knowledge. This was on how to create groups for an application, dividing a single model into two different usages. &lt;/p&gt;

&lt;p&gt;I wanted my users to be able to create a group(faction) that other users could join. Leader vs Joiner. The problem that stumped me was on how to implement leaders &amp;amp; joiners into a single model, Users in my case. To put this into perspective: a faction belongs to a leader, while also having many joiners. Both leaders and joiners can have many factions. theodinproject.com was a wonderful resource on how to implement this idea. &lt;/p&gt;

&lt;p&gt;You will have three tables set up like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class CivilianFactionRequest &amp;lt; ApplicationRecord
    belongs_to :requestor, class_name: "Civilian"
    belongs_to :faction_request, class_name: "CivilianFaction"
end
&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;class CivilianFaction &amp;lt; ApplicationRecord
    belongs_to :owner, :class_name =&amp;gt; "Civilian"
    has_many :civilian_faction_requests, foreign_key: :faction_request_id
    has_many :requestors, through: :civilian_faction_requests, source: :requestor
end
&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;class Civilian &amp;lt; ApplicationRecord
    has_many :civilian_faction_requests, foreign_key: :requestor_id
    has_many :civilian_factions, :class_name =&amp;gt; "CivilianFaction", :foreign_key =&amp;gt; "owner_id"
    has_many :faction_requests, through: :civilian_faction_requests
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now to break this down. The CivilianFactionRequest is the join table that will hold the information from the other two tables. This belongs to the specific faction that a user is requesting to join, as well as the user themself. &lt;/p&gt;

&lt;p&gt;The lone Faction model is where things start to get tricky. The first line sets the owner upon creation. The second is saying it will have many requests under the specific faction request id. The third is saying the faction will have many requestors(joiners). &lt;/p&gt;

&lt;p&gt;The first line describes that the Civilian model(user) will have many faction requests, through the join table, under the requestors id(once they send their request). The second line tells us that the user will have many factions under the owner id. The third tells us that we will have many faction requests as the owner through the join table. &lt;/p&gt;

&lt;p&gt;To match these relationships, the migrations will also have a part to play. The civilian migration will be whatever you determine. The important tables are the factions, and the faction_requests(join table)&lt;/p&gt;

&lt;p&gt;Civilian_factions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;create_table "civilian_factions", force: :cascade do |t|
    t.string "name"
    t.integer "owner_id"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Civilian Faction Requests:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;create_table "civilian_faction_requests", force: :cascade do |t|
    t.integer "faction_request_id"
    t.integer "requestor_id"
    t.boolean "accepted", default: false
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As mentioned previously, the faction will belong to the owner. Through the join table, the faction will have many joiners. To do this, the join table has to take in the faction id as well as the joiner id. &lt;/p&gt;

&lt;p&gt;Once this is set up, active record gives you full capabilities to call on chained methods such as&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CivilianFaction.first.requestors
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Which will query the faction table for the first faction's requestors. Not to mention the ability to create groups as a leader, and join them as joiners! A tough concept to tackle but super useful in the long run. &lt;/p&gt;

&lt;p&gt;Thank you for taking the time to read!&lt;/p&gt;

</description>
      <category>ruby</category>
      <category>rails</category>
      <category>programming</category>
    </item>
    <item>
      <title>Phase 2</title>
      <dc:creator>Nathan A. Hains</dc:creator>
      <pubDate>Thu, 25 Mar 2021 17:51:45 +0000</pubDate>
      <link>https://forem.com/nathanhains/phase-2-3ie5</link>
      <guid>https://forem.com/nathanhains/phase-2-3ie5</guid>
      <description>&lt;p&gt;Today marks the 4th day into Project Week for Phase 2 at Flatiron's Software Engineering Bootcamp. &lt;/p&gt;

&lt;p&gt;Throughout the second phase, we were tasked with learning loads of new information. Of the many, we had learned both the basics &amp;amp; the depths of sql, active record, Sinatra, css, and html. This was definitely a step up from the last phase where we had learned strictly ruby object orientation principles. There were plenty of challenges for sure on my end but not without their eventual completion. &lt;/p&gt;

&lt;p&gt;The major challenge for this phase was learning how to implement CRUD and RESTful Routing. Basically what CRUD stands for is Create, Read, Update, and Delete and is used for persisting storage. If I were to plan out a website with a database that users can react with, I would implement CRUD to manipulate the data. Now as for the routes that allow users to access these CRUD methods is through RESTful routing. What it means to be RESTful is to follow the naming pattern of consistency across route name and paths that reflect what they are doing. &lt;/p&gt;

&lt;p&gt;Now, as a beginner, that is difficult to read in and of its own. Implementing this into a full on project is another story. But this is where the real fun is. For me, diving into this project was like diving into a pool without knowing HOW to swim. Sure I know the mechanics of swimming, and I've seen people swim before plenty of times. But as for the actual SWIMMING aspect, I'm dead weight. Same went for this project. Although it was a real struggle, removing the training wheels that come with labs is where I really cement the knowledge I've been collecting throughout the phase. &lt;/p&gt;

&lt;p&gt;To better demonstrate this, I'd like to show a little bit of my code. A feature I had wanted to implement is for user's to log in. To do this we start with a GET request to '/login' which will be in the form of a link on the home page. That looks a little 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; get '/login' do
        erb :'/users/login'
    end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, what this is doing is saying, hey, show me the login page which my program is designed to read this and provide the that login page through an erb file. Within that erb file I had to figure out how to display to the user sections for a user to input their credentials that is both productive and nice looking. In comes bootstrap. Bootstrap is basically a seamless way to add features to your website while doing all the work for you. This may sound lazy to some but an ocean of possibilities for beginners. Bootstrap not only allows you to get predesigned features but to manipulate your own. How I designed my login page is through the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; &amp;lt;div class="text-center"&amp;gt;
    &amp;lt;form style="max-width:480px;margin:auto" action="/login" method="post"&amp;gt;

        &amp;lt;img class="mt-4 mb-4" src="images/this.jpeg" height="100" alt="logo"&amp;gt;
        &amp;lt;h1 class="h3 mb-3 font weight normal"&amp;gt;Please sign in&amp;lt;/h1&amp;gt;

    &amp;lt;input type="text" name="username" class="form-control" placeholder="Username" required autofocus&amp;gt;
    &amp;lt;input type="password" name="password" placeholder="Password" class="form-control"&amp;gt;
    &amp;lt;div class="mt-3"&amp;gt;
    &amp;lt;button class="btn btn-lg btn-secondary"&amp;gt;Sign In&amp;lt;/button&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
    &amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Which greatly benefits the user experience when put into action. From there the user's information is sent to the '/login' action through the method post which identifies the user and brings them to their profile page. Pretty cool, right? &lt;/p&gt;

&lt;p&gt;By the end of yesterday, which is when I had completed the first set of features I had hoped to create for this project, I can finally say I AM a Software Engineer. The fact that I was set out on my own and came back with a fully-functioning website, albeit still in its early stages, is indescribable. With 3 more phases to go, I am becoming more and more confident with my abilities to adapt to and implement any obstacle/knowledge that comes my way. &lt;/p&gt;

&lt;p&gt;Here's to another successful phase and to the ever-approaching finish line. Cheers. &lt;/p&gt;

</description>
      <category>ruby</category>
      <category>sinatra</category>
      <category>activerecord</category>
      <category>project</category>
    </item>
    <item>
      <title>Week 4</title>
      <dc:creator>Nathan A. Hains</dc:creator>
      <pubDate>Wed, 24 Feb 2021 04:02:12 +0000</pubDate>
      <link>https://forem.com/nathanhains/week-4-371m</link>
      <guid>https://forem.com/nathanhains/week-4-371m</guid>
      <description>&lt;p&gt;Alright!&lt;/p&gt;

&lt;p&gt;So, as the title suggests I, along with my fellow cohort-mates, have successfully completed week 3 and pushing into week 4. This is the end of our first phase where we push our knowledge over the course of the phase to our absolute limits! This has been a challenge for sure but a rewarding one at that. As much as I've stared at the screen, lost for thoughts on where to go next, I've equally felt the rush of conquering my hurdles. &lt;/p&gt;

&lt;p&gt;Week 4 is where it all comes together. We were presented with the task of creating our own command line interface gem! At first read, my nerves jumped for sure. At second read, it was grind time. &lt;/p&gt;

&lt;p&gt;I heard that project week was going to be tough. Many times. So much, that I wasted no time and began doing my research so that I could be as prepared as possible when it came time. Suffice to say, when it came time, I was confident in my abilities to get all the requirements settled. &lt;/p&gt;

&lt;p&gt;My project idea was centered around the aid of my fellow cohort-mates. I wanted to create something that could help relieve some of the stress &amp;amp; anxieties that people were facing as they stamped through the lines of code. Thus, "Inspirational Stress Reliever" was born! The user is greeted, asked if they're feeling stressed, and provided as many inspirational quotes as they want! One of the requirements was to make sure the program went one level deep. My idea for this was at the end of attaining their quotes, the user is read a list of their quotes and provided an option of selecting from their list, the author of any provided quote. That's just about my program's cli in a nutshell. Sounds simple enough. Until you check under the hood. &lt;/p&gt;

&lt;p&gt;My project went through many, many changes. This is due to both the creative freedom Flatiron offers for this project, and the requirements. The overlaying goal is to make your program object oriented. This means you are CREATING OBJECTS and working WITH OBJECTS!!!!!! Note, this is not me screaming at you, dear reader, but to my past self. The first version of my program had grabbed information from my api(which grabs the random quotes as hashes containing the attributes of the quote) straight from the cli. Big no-no. The idea of object oriented programs is to separate your concerns, which means you don't have just one class doing everything but separate that do, separate things. Excuse the layman terminology. After I got that down though, was where the real fun began. &lt;/p&gt;

&lt;p&gt;One change I want to mention was centered around user interactivity. At first, the user was presented with choices like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="nb"&gt;print&lt;/span&gt; &lt;span class="s2"&gt;"Enter 1 for 'yes', 2 for 'no'
input.gets.strip
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Yikes. &lt;/p&gt;

&lt;p&gt;Although not the worst way to present text for user input, it is definitely not the prettiest. My solution for this came from my wonderful cohort leader, Laura Berge. She had suggested I look into the ttyprompt gem to make my cli more user friendly. Looking through, I had agreed and proceeded to download the gem and work through implementing that gem. And so, my program went from that super robotic formation into:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;prompt_1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;TTY&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;Prompt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;
            &lt;span class="nb"&gt;puts&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;
            &lt;span class="n"&gt;prompt_1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;yes?&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"&amp;gt; Would you like to know any of the authors?"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Although you may not be able to tell, this makes a world of difference. Now instead of entering 1 or 2, from which I would have went into 2 other methods for wrong input and to return usable options, the user can enter y/n (which is displayed next to any question) or yes/no. On top of that, if the user inputs anything else it automatically produces an output for invalid input AND turns the user choice green. This was a game changer. My program is a lot nicer to look at and I'm a lot more confident in presenting to others. &lt;/p&gt;

&lt;p&gt;This is just another stepping stone in the field of becoming a Software Engineer. I've learned a lot in so little time and I couldn't be more grateful. Words can't describe how excited I am to see where the next hurdle takes me. &lt;/p&gt;

&lt;p&gt;Until then,&lt;/p&gt;

&lt;p&gt;Nathan Hains&lt;/p&gt;

</description>
      <category>ruby</category>
      <category>bootcamp</category>
      <category>journey</category>
      <category>coding</category>
    </item>
    <item>
      <title>First Mile at Flatiron School for Software Engineering</title>
      <dc:creator>Nathan A. Hains</dc:creator>
      <pubDate>Mon, 01 Feb 2021 17:33:50 +0000</pubDate>
      <link>https://forem.com/nathanhains/first-mile-at-flatiron-school-for-software-engineering-2gbb</link>
      <guid>https://forem.com/nathanhains/first-mile-at-flatiron-school-for-software-engineering-2gbb</guid>
      <description>&lt;p&gt;Hi! &lt;/p&gt;

&lt;p&gt;My name is Nathan Hains. I am currently 22 years old looking to further progress my journey as a Software Engineer at Flatiron School. I began this journey at Suffolk County Community College through an Intro to Java Class. I will admit my introduction into the programming world was difficult. That challenge, however, is what really pushed me to further my knowledge. I looked up to my professor and his skillset. I wanted to learn what it took to get to where they were. From there I was decided on where to focus my attention for the years to come. &lt;/p&gt;

&lt;p&gt;After graduating from SCCC I had gotten accepted into Farmingdale State College with a major in Computer Programming/ Information Systems for my BA. I had completed 2 semesters when I heard about the world of Coding Bootcamps. I was/am still very much in full force for attaining my bachelors at Farmingdale. But I decided to first focus my efforts on completing a Coding Bootcamp. I had heard great reviews from various bootcamp alumni. Flatiron in specific had caught my eye from the start. The passion I saw in these Flatiron graduates was inspiring. Regular people, like me, had changed their lives for the better! I saw how rewarding the challenge of completion can be and focused my efforts on how I could be one of these people. &lt;/p&gt;

&lt;p&gt;Now, on February 1st, 2021, I can proudly say I am beginning my First Mile with Flatiron School as a Software Engineer. I have met with my Cohorts and saw the happy faces of my fellow students. It is super exciting to see where the next 5 month will take us all. I am ready for this challenge. I will update my journey in hopes to serve as a source of inspiration as others have been for me. See everyone in the next milestone! Wish me luck!&lt;/p&gt;

&lt;p&gt;Nathan Hains,&lt;br&gt;
Future Software Engineer&lt;/p&gt;

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