<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ronnie</title>
    <description>The latest articles on DEV Community by Ronnie (@arynnboniface).</description>
    <link>https://dev.to/arynnboniface</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%2F463104%2F4a3f2bde-33ca-4a70-a27b-0576e481076b.jpeg</url>
      <title>DEV Community: Ronnie</title>
      <link>https://dev.to/arynnboniface</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/arynnboniface"/>
    <language>en</language>
    <item>
      <title>The State of Taking Props to School</title>
      <dc:creator>Ronnie</dc:creator>
      <pubDate>Sat, 18 Sep 2021 11:41:03 +0000</pubDate>
      <link>https://dev.to/arynnboniface/the-state-of-taking-props-to-school-47j1</link>
      <guid>https://dev.to/arynnboniface/the-state-of-taking-props-to-school-47j1</guid>
      <description>&lt;p&gt;From my experience as an instructor state and props can really throw React beginners for a loop. The good news is that loop doesn't need to be endless (😅). &lt;/p&gt;

&lt;h3&gt;
  
  
  State &amp;amp; Props: What Are They?
&lt;/h3&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%2Fmedia.giphy.com%2Fmedia%2Fkaq6GnxDlJaBq%2Fgiphy.gif%3Fcid%3Decf05e47gs0a01ztemrj14vjzgarsrbjqj231vbvgg949xmp%26rid%3Dgiphy.gif%26ct%3Dg" 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%2Fmedia.giphy.com%2Fmedia%2Fkaq6GnxDlJaBq%2Fgiphy.gif%3Fcid%3Decf05e47gs0a01ztemrj14vjzgarsrbjqj231vbvgg949xmp%26rid%3Dgiphy.gif%26ct%3Dg" alt="Very Confused Little Girl"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;props&lt;/code&gt; (short for “properties”) and &lt;code&gt;state&lt;/code&gt; are both plain JavaScript objects. While both hold information that influences the output of render, they are different in one important way: &lt;code&gt;props&lt;/code&gt; get passed to the component (similar to function parameters) whereas &lt;code&gt;state&lt;/code&gt; is managed within the component (similar to variables declared within a function).&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://reactjs.org/docs/faq-state.html" rel="noopener noreferrer"&gt;Reactjs.com - Component State&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Uh, yeah, okay... but what does that mean? Well, let's take a look at a real world example. Think way back to your grade school days. Remember field trips? And permission slips?&lt;/p&gt;

&lt;p&gt;Your mom, dad or parental guardian had to sign a permission slip in order for you to go on a field trip. You brought that permission slip to your teacher and showed it to them to prove that you were allowed to go. This is a great way to think about state and props.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;I'm going to use hooks and functional components in these examples, but class components will work, too.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Starting out, the browser looks like 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%2Fuploads%2Farticles%2Fwkxxpiiesm16sqdq1s8q.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%2Fwkxxpiiesm16sqdq1s8q.png" alt="Browser with two divs, "&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;Parent&lt;/code&gt; component is rendered in &lt;code&gt;App.js&lt;/code&gt;. Here is the starting code for both &lt;code&gt;Parent&lt;/code&gt; and &lt;code&gt;Child&lt;/code&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="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;Child&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;./Child&lt;/span&gt;&lt;span class="dl"&gt;'&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;Parent&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="k"&gt;return &lt;/span&gt;&lt;span class="p"&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;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;container&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="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;parent&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;h2&lt;/span&gt;&lt;span class="o"&gt;&amp;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;the&lt;/span&gt; &lt;span class="nx"&gt;parent&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;/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;/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;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;child&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;Child&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="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;/div&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;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;Parent&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and here is the starting code for &lt;code&gt;Child&lt;/code&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;const&lt;/span&gt; &lt;span class="nx"&gt;Child&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="k"&gt;return &lt;/span&gt;&lt;span class="p"&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;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;child-component&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;h3&lt;/span&gt;&lt;span class="o"&gt;&amp;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;the&lt;/span&gt; &lt;span class="nx"&gt;child&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;/h3&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="p"&gt;);&lt;/span&gt;
&lt;span class="p"&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="nx"&gt;Child&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first thing we're going to do is set up &lt;code&gt;state&lt;/code&gt; in our &lt;code&gt;Parent&lt;/code&gt; component.&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="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;isSigned&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setIsSigned&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;false&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;location&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;the science museum&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;The permission slip for the science museum begins in an unsigned state. Now we need to set up some way for our &lt;code&gt;Parent&lt;/code&gt; to sign the permission slip for their child. We'll stick to a simple click event on a button. The button will also render conditionally, based on the value of our &lt;code&gt;isSigned&lt;/code&gt; state.&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;handleClick&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="nx"&gt;isSigned&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="nf"&gt;setIsSigned&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;setIsSigned&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="p"&gt;};&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;renderButton&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="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;isSigned&lt;/span&gt; &lt;span class="p"&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;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;handleClick&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Sign&lt;/span&gt; &lt;span class="nx"&gt;Permission&lt;/span&gt; &lt;span class="nx"&gt;Slip&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&amp;gt; : &amp;lt;button onClick={handleClick}&amp;gt;You're Grounded!&amp;lt;/&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We now want to invoke &lt;code&gt;renderButton&lt;/code&gt; right under our &lt;code&gt;h2&lt;/code&gt; tag in the &lt;code&gt;Parent&lt;/code&gt; component. This is what we see in the browser now:&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%2Fuploads%2Farticles%2Fw6hefq89rjadp33x0tpe.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%2Fw6hefq89rjadp33x0tpe.png" alt="Parent and Child component with button"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In order to make sure our button &lt;em&gt;actually works&lt;/em&gt;, we're going to add &lt;code&gt;{console.log(isSigned)}&lt;/code&gt; inside of our &lt;code&gt;Parent&lt;/code&gt; component. Our code should look something like 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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Parent&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;isSigned&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setIsSigned&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;false&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;location&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;the science museum&lt;/span&gt;&lt;span class="dl"&gt;"&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;handleClick&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="nx"&gt;isSigned&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="nf"&gt;setIsSigned&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;setIsSigned&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="p"&gt;};&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;renderButton&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="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;isSigned&lt;/span&gt; &lt;span class="p"&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;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;handleClick&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Sign&lt;/span&gt; &lt;span class="nx"&gt;Permission&lt;/span&gt; &lt;span class="nx"&gt;Slip&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&amp;gt; : &amp;lt;button onClick={handleClick}&amp;gt;You're Grounded!&amp;lt;/&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt;&lt;span class="o"&gt;&amp;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;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;container&lt;/span&gt;&lt;span class="dl"&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="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;isSigned&lt;/span&gt;&lt;span class="p"&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;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;parent&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;h2&lt;/span&gt;&lt;span class="o"&gt;&amp;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;the&lt;/span&gt; &lt;span class="nx"&gt;parent&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;/h2&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;        &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;renderButton&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;/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;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;child&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;Child&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="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;/div&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;This is what we should see after our first button click:&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%2Fuploads%2Farticles%2Fu0nd5yts0zohjqkse23n.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%2Fu0nd5yts0zohjqkse23n.png" alt="Signed Permission Slip"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;and if we click one more time:&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%2Fuploads%2Farticles%2Frh4g4jbpv9o0m27qwv1g.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%2Frh4g4jbpv9o0m27qwv1g.png" alt="Field trip permission: revoked!"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now that we know everything is working correctly in our &lt;code&gt;Parent&lt;/code&gt; component, we can start thinking about &lt;code&gt;props&lt;/code&gt;! Our &lt;code&gt;Child&lt;/code&gt; needs some way to tell their teacher whether they can or cannot go on the field trip. We need to pass this information down to our &lt;code&gt;Child&lt;/code&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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;child&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;Child&lt;/span&gt; &lt;span class="nx"&gt;location&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;location&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="nx"&gt;isSigned&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;isSigned&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="sr"&gt;/&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is how we pass information from parent to child. In our &lt;code&gt;Child&lt;/code&gt; component, we pass the &lt;code&gt;props&lt;/code&gt; in as an argument.&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;Child&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;props&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="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;props&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;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;child-component&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;h3&lt;/span&gt;&lt;span class="o"&gt;&amp;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;the&lt;/span&gt; &lt;span class="nx"&gt;child&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;/h3&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="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;With that &lt;code&gt;console.log&lt;/code&gt;, we'll see this in browser console:&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%2Fuploads%2Farticles%2Fl4zsi875771rlae43nnf.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%2Fl4zsi875771rlae43nnf.png" alt="Console log of props"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can make things a little cleaner here by using destructuring!&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;Child&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;location&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;isSigned&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="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;location&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;isSigned&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;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;child-component&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;h3&lt;/span&gt;&lt;span class="o"&gt;&amp;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;the&lt;/span&gt; &lt;span class="nx"&gt;child&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;/h3&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="p"&gt;);&lt;/span&gt;
&lt;span class="p"&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="nx"&gt;Child&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2Fiptmsfta37oto0egq7z4.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%2Fiptmsfta37oto0egq7z4.png" alt="Props with destructuring"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now that we have access to that data in our &lt;code&gt;Child&lt;/code&gt; component, we can display that data!&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%2F13626f3tp4rs4xy1bkar.gif" 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%2F13626f3tp4rs4xy1bkar.gif" alt="Functioning permission slip signing"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the &lt;code&gt;Child&lt;/code&gt; component, we now have a function called &lt;code&gt;renderPermission&lt;/code&gt;, which renders text conditionally based on the value of &lt;code&gt;isSigned&lt;/code&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;const&lt;/span&gt; &lt;span class="nx"&gt;Child&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;location&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;isSigned&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="nx"&gt;renderPermission&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="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;isSigned&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;`I can go on the field trip to the &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;location&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;!`&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&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;`I'm not allowed to go on the field trip to the &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;location&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&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;return &lt;/span&gt;&lt;span class="p"&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;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;child-component&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;h3&lt;/span&gt;&lt;span class="o"&gt;&amp;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;the&lt;/span&gt; &lt;span class="nx"&gt;child&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;/h3&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;renderPermission&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;/div&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;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;Child&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Remember that we can't change props! A kid can't forge their parent/guardians signature! Let's try it out.&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;forgePermission&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="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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Clicked&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nx"&gt;isSigned&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&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;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;child-component&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;h3&lt;/span&gt;&lt;span class="o"&gt;&amp;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;the&lt;/span&gt; &lt;span class="nx"&gt;child&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;/h3&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;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;forgePermission&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Forge&lt;/span&gt; &lt;span class="nx"&gt;Signature&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&amp;gt; &amp;lt;br /&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;

      &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;renderPermission&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;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We're including a &lt;code&gt;console.log&lt;/code&gt; so that we can be sure that our event listener is working.&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%2Ft07tw5bwkm73jegb0j4z.gif" 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%2Ft07tw5bwkm73jegb0j4z.gif" alt="A child can't change props"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can't do it! They're not changing! Our &lt;code&gt;Child&lt;/code&gt; component is not re-rendering. Our parent component is in charge of the data and changing it (with state!) and our child component only has the ability to display that data (they're props!).&lt;/p&gt;

&lt;p&gt;Here is a look at our finished code:&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;useState&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;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;Child&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;./Child&lt;/span&gt;&lt;span class="dl"&gt;'&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;Parent&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;isSigned&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setIsSigned&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;false&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;location&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;the science museum&lt;/span&gt;&lt;span class="dl"&gt;"&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;handleClick&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="nx"&gt;isSigned&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="nf"&gt;setIsSigned&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;setIsSigned&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="p"&gt;};&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;renderButton&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="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;isSigned&lt;/span&gt; &lt;span class="p"&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;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;handleClick&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Sign&lt;/span&gt; &lt;span class="nx"&gt;Permission&lt;/span&gt; &lt;span class="nx"&gt;Slip&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&amp;gt; : &amp;lt;button onClick={handleClick}&amp;gt;You're Grounded!&amp;lt;/&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt;&lt;span class="o"&gt;&amp;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;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;container&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="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;parent&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;h2&lt;/span&gt;&lt;span class="o"&gt;&amp;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;the&lt;/span&gt; &lt;span class="nx"&gt;parent&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;/h2&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;        &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;renderButton&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;/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;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;child&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;Child&lt;/span&gt; &lt;span class="nx"&gt;location&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;location&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="nx"&gt;isSigned&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;isSigned&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="sr"&gt;/&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;/div&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;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;Parent&lt;/span&gt;&lt;span class="p"&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 javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Child&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;location&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;isSigned&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="nx"&gt;renderPermission&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="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;isSigned&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;`I can go on the field trip to the &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;location&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;!`&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&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;`I'm not allowed to go on the field trip to the &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;location&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;.`&lt;/span&gt;
    &lt;span class="p"&gt;};&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;forgePermission&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="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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Clicked&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nx"&gt;isSigned&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&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;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;child-component&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;h3&lt;/span&gt;&lt;span class="o"&gt;&amp;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;the&lt;/span&gt; &lt;span class="nx"&gt;child&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;/h3&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;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;forgePermission&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Forge&lt;/span&gt; &lt;span class="nx"&gt;Signature&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&amp;gt; &amp;lt;br /&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;

      &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;renderPermission&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;/div&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;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;Child&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it! That's &lt;code&gt;state&lt;/code&gt; and &lt;code&gt;props&lt;/code&gt; in React. It's as simple as that.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Cover image from &lt;a href="https://unsplash.com/photos/uZkgI3opcvE?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditShareLink" rel="noopener noreferrer"&gt;Austin Pacheco&lt;/a&gt; on &lt;a href="https://unsplash.com" rel="noopener noreferrer"&gt;Unsplash&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>beginners</category>
    </item>
    <item>
      <title>To the VSCode Extensions I Love the Most</title>
      <dc:creator>Ronnie</dc:creator>
      <pubDate>Sun, 12 Sep 2021 15:29:13 +0000</pubDate>
      <link>https://dev.to/arynnboniface/to-the-vscode-extensions-i-love-the-most-pce</link>
      <guid>https://dev.to/arynnboniface/to-the-vscode-extensions-i-love-the-most-pce</guid>
      <description>&lt;p&gt;This certainly isn't the first time someone's made a list of their favorite VSCode extensions and it won't be the last, but these are mine! I'll start with some of my favorite JS related extensions and then we'll jump into HTML/CSS helpers.&lt;/p&gt;

&lt;p&gt;I'm starting with the holy grail of all extensions. This one, I swear, has saved my life.&lt;/p&gt;

&lt;h2&gt;
  
  
  JS &amp;amp; Friends
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=CoenraadS.bracket-pair-colorizer-2" rel="noopener noreferrer"&gt;Bracket Pair Colorizer&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This extension does exactly what it's name says. It might not seem like anything life changing, but think about working with some deeply nested code, or a huge file.&lt;/p&gt;

&lt;p&gt;Life WITHOUT Bracket Pair Colorizer:&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%2Fmm6kqryhx9wshwg75xc4.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%2Fmm6kqryhx9wshwg75xc4.png" alt="Code without Bracket Pair Colorizer"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Life WITH Bracket Pair Colorizer: &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%2Fgufofgzg87pljj16j1gf.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%2Fgufofgzg87pljj16j1gf.png" alt="Code with Bracket Pair Colorizer"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Each pair of brackets, curly brackets and parentheses has its own color, which makes it very easy to identify where you might have an 'oops'. &lt;/p&gt;

&lt;p&gt;Wow, this already seems AWESOME, but WAIT-- there's more. Moving your cursor to the inside of the first bracket draws a line (in the same color) to its partner. &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%2F4sk2s3m6ecjlq3sngg8s.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%2F4sk2s3m6ecjlq3sngg8s.png" alt="Bracket Line Match"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=burkeholland.simple-react-snippets" rel="noopener noreferrer"&gt;Simple React Snippets&lt;/a&gt; / &lt;a href="https://marketplace.visualstudio.com/items?itemName=PulkitGangwar.nextjs-snippets" rel="noopener noreferrer"&gt;Next.js Snippets&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Writing boilerplate code takes FOREVER. It's ANNOYING. Simple React Snippets and Next.js Snippets ease that boilerplate pain.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Functional Components &amp;amp; Hooks with Simple React Snippets&lt;/strong&gt;&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%2Fwzrd8j4y6453aptvemr9.gif" 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%2Fwzrd8j4y6453aptvemr9.gif" alt="Simple React Snippets - Functional Components  &amp;amp; Hooks"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Next.js Snippets&lt;/strong&gt;&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%2F27a0n3w08x56jytb325x.gif" 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%2F27a0n3w08x56jytb325x.gif" alt="Next.js Snippets"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Both of these extensions have a ton of snippets, but I don't have the time to make that many gifs!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=xabikos.JavaScriptSnippets" rel="noopener noreferrer"&gt;JavaScript (ES6) Code Snippets&lt;/a&gt;&lt;/strong&gt;&lt;br&gt;
This one is very similar to Simple React Snippets, but applies to plain 'ole, vanilla JavaScript. &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%2Ftmiys8biprl18lecmn6n.gif" 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%2Ftmiys8biprl18lecmn6n.gif" alt="JavaScript Code Snippets"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;These are the ones I use most often, but there are a ton more. Notable mentions include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;sti&lt;/code&gt; for a &lt;code&gt;setInterval&lt;/code&gt; setup&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;thenc&lt;/code&gt; to add &lt;code&gt;.then()&lt;/code&gt; and &lt;code&gt;.catch()&lt;/code&gt; to a promise.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;clg&lt;/code&gt; for a &lt;code&gt;console.log()&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=meganrogge.template-string-converter" rel="noopener noreferrer"&gt;Template String Converter&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This one is small but mighty (helpful). Anytime you type &lt;code&gt;${}&lt;/code&gt; within a set of single or double quotes, this extension automatically converts them to backticks.&lt;/p&gt;

&lt;h2&gt;
  
  
  HTML &amp;amp; CSS
&lt;/h2&gt;

&lt;p&gt;VSCode is pretty great with HTML &amp;amp; CSS all on its own. * You can use &lt;code&gt;html:5&lt;/code&gt; to get some solid HTML boilerplate. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Typing &lt;code&gt;a&lt;/code&gt; will give you opening and closing link tags.&lt;/li&gt;
&lt;li&gt;Typing &lt;code&gt;div&lt;/code&gt; will give you opening and closing link tags.&lt;/li&gt;
&lt;li&gt;VSCode auto-completes CSS attributes for you.&lt;/li&gt;
&lt;li&gt;The newest VSCode update allows you to edit an opening and closing tag at the same time (😍).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There are a few good helpers out there though!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=hwencc.html-tag-wrapper" rel="noopener noreferrer"&gt;HTML Tag Wrapper&lt;/a&gt;&lt;/strong&gt;&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%2Fuploads%2Farticles%2Fml9myoqg1a09qxsm3b5c.gif" 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%2Fml9myoqg1a09qxsm3b5c.gif" alt="HTML Tag Wrapper"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Wrapping already written code in a new tag has been driving me insane for as long as I can remember, but now there's an answer. Highlight, ctrl + i and the nightmare is over. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=joy-yu.css-snippets" rel="noopener noreferrer"&gt;CSS Snippets&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Yes, yes, more snippets! What developer doesn't love writing less code?&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%2Fgjymj04294u6e0lqyggb.gif" 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%2Fgjymj04294u6e0lqyggb.gif" alt="CSS Snippets"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The length of this list of snippets is rivaled only by a Game of Thrones book.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=glenn2223.live-sass" rel="noopener noreferrer"&gt;Live Sass Compiler&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Last but not least, Live Sass Compiler! Sure, sure, you can just get this up and running in your terminal with a command or two, OR you could just click 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%2Fuploads%2Farticles%2Fmizkjkhdfqlslcqc3vrh.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%2Fmizkjkhdfqlslcqc3vrh.png" alt="Watch Sass"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Totally up to you, but I know what I'd rather do. &lt;/p&gt;

&lt;p&gt;That's it for my favorite extensions list (for now). Feel free to drop your favorites in the comments! I'm always looking for new gems in my extension treasure collection.&lt;/p&gt;

</description>
      <category>vscode</category>
      <category>javascript</category>
      <category>html</category>
      <category>css</category>
    </item>
    <item>
      <title>JavaScript and Hoisting</title>
      <dc:creator>Ronnie</dc:creator>
      <pubDate>Wed, 13 Jan 2021 16:56:39 +0000</pubDate>
      <link>https://dev.to/arynnboniface/javascript-and-hoisting-495</link>
      <guid>https://dev.to/arynnboniface/javascript-and-hoisting-495</guid>
      <description>&lt;p&gt;Hoisting can be a difficult concept for people just starting out with JavaScript. Before we get into the how's and why's of hoisting, let's go over what hoisting actually is. In the simplest terms:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Hoisting is JavaScript's default behavior of moving all declarations to the top of their scope before the code is executed.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Hoisting was originally written into JavaScript to allow functions to be used before declaration and the hoisting of variables was simply a byproduct of that feature. &lt;/p&gt;

&lt;p&gt;Why would we even need to use functions before they are declared?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It's necessary for things like mutual recursion, which is a subject for another day.&lt;/li&gt;
&lt;li&gt;Some people think code looks cleaner when written this way. (I agree!)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A lot of people think that hoisting actually moves your code around, but JavaScript just reads your code before executing. This step is called compilation. JavaScript takes into account every declaration in your code and is then aware of those declarations prior to execution.&lt;/p&gt;

&lt;h3&gt;
  
  
  var
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;var&lt;/code&gt; is &lt;strong&gt;function scoped&lt;/strong&gt; When we define variables using &lt;code&gt;var&lt;/code&gt;, they are lifted to the top of their scope during compilation, no matter where the variable has been declared. When we talk about the scope of &lt;code&gt;var&lt;/code&gt; it's important to mention that the scope is either global or the top of the function in which they were defined. Even if that variable is declared inside of a conditional or a loop. However this applies only to the declaration, not the assignment. Here's an example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;console.log(yearBorn)
var yearBorn = 1990
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What do you think this code would log to the console? &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%2F16b7cvbdg4l8mf9nxahz.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%2F16b7cvbdg4l8mf9nxahz.jpg" alt="Hoisting a horse"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you guessed &lt;code&gt;undefined&lt;/code&gt;, you'd be correct! This is because JavaScript only hoists the declaration, not the assignment. This isn't a helpful error. It can make bugs difficult to find and remedy. &lt;/p&gt;

&lt;p&gt;Thankfully, JavaScript gave us &lt;code&gt;let&lt;/code&gt; and &lt;code&gt;const&lt;/code&gt; with ES6! The errors we get using &lt;code&gt;let&lt;/code&gt; and &lt;code&gt;const&lt;/code&gt; are significantly more helpful than just a plain ole &lt;code&gt;undefined&lt;/code&gt;.&lt;/p&gt;
&lt;h3&gt;
  
  
  const
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;const&lt;/code&gt; means that the identifier can't be reassigned. They keep constant values that cannot be updated or re-declared. As an example, let's say you planned on making a really nice dinner when you get home from work. It turns out you had to stay late today and don't really have the time or energy to make your special dinner.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const dinner = "Beef Wellington"
dinner = "Frozen Pizza"
console.log(dinner)
// Uncaught TypeError: Assignment to constant variable.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Doing something like this will cause us problems as well:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const dinner = "Beef Wellington"
const dinner = "Frozen Pizza"
console.log(dinner)
// Uncaught SyntaxError: Identifier 'dinner' has already been declared
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This doesn't mean &lt;code&gt;const&lt;/code&gt; is a bad thing! We may have important values in our that we want to make sure can't be re-assigned or re-declared. Specific formulas or numbers as just a couple examples. Something else of note about &lt;code&gt;const&lt;/code&gt;: If the value of our variable declared with &lt;code&gt;const&lt;/code&gt; is an array or object, the properties within them can be updated. It's best practice to use &lt;code&gt;const&lt;/code&gt; unless you know the declared variable will be re-defined at some point. That brings us to &lt;code&gt;let&lt;/code&gt;!&lt;/p&gt;

&lt;h3&gt;
  
  
  let
&lt;/h3&gt;

&lt;p&gt;Let's go back to our dinner example.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let dinner = "Beef Wellington"
dinner = "Frozen Pizza"
console.log(dinner)
// Frozen Pizza
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  let, const and Hoisting
&lt;/h3&gt;

&lt;p&gt;Now that we know what &lt;code&gt;let&lt;/code&gt; and &lt;code&gt;const&lt;/code&gt; are and what they do, we can talk about them in the context of scope and hoisting. &lt;code&gt;let&lt;/code&gt; and &lt;code&gt;const&lt;/code&gt; are both &lt;strong&gt;block&lt;/strong&gt; scoped, mean they exist only in the block where they were declared. This differs from &lt;code&gt;var&lt;/code&gt; in that if a variable is declared with &lt;code&gt;let&lt;/code&gt; or &lt;code&gt;const&lt;/code&gt; it is hoisted to the top of its scope which could be global, a function or inside of a code block like a conditional or loop.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let ingredients = ["Spaghetti", "Meatballs", "Garlic Bread"]

function makeDinner(ingredients) {
  let firstIngredient = ingredients[0]
   if (firstIngredient.length &amp;gt; 5) {
     let longIngredient = true
   } 
   return longIngredient;
}

console.log(makeDinner(ingredients))
// Uncaught ReferenceError: longIngredient is not defined

console.log(firstIngredient)
// Uncaught ReferenceError: firstIngredient is not defined
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's forget about the code we've written up above and say we forget to gather our ingredients before making dinner.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function makeDinner(ingredients) {
  var firstIngredient = ingredients[0]
   if (firstIngredient.length &amp;gt; 5) {
     var longIngredient = true
   } 
   return longIngredient;
}

console.log(makeDinner(ingredients))
let ingredients = ["Spaghetti", "Meatballs", "Garlic Bread"]
// Uncaught ReferenceError: Cannot access 'ingredients'
 before initialization
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And with &lt;code&gt;var&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;...
console.log(makeDinner(ingredients))
var ingredients = ["Spaghetti", "Meatballs", "Garlic Bread"]
// Uncaught TypeError: Cannot read property '0' of undefined
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In short, forget about &lt;code&gt;var&lt;/code&gt; and welcome &lt;code&gt;let&lt;/code&gt; and &lt;code&gt;const&lt;/code&gt; into your code with open arms.&lt;/p&gt;

&lt;p&gt;Here is a little hoisting cheat sheet:&lt;/p&gt;

&lt;h4&gt;
  
  
  var
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Hoisted? &lt;strong&gt;yes&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Initial Value: &lt;strong&gt;undefined&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Scope: &lt;strong&gt;function&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  let &amp;amp; const
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Hoisted? &lt;strong&gt;no&lt;/strong&gt; (technically yes, but not in practice)&lt;/li&gt;
&lt;li&gt;Initial Value: ** &lt;/li&gt;
&lt;li&gt;Scope: &lt;strong&gt;block&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Function Declarations
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Hoisted? &lt;strong&gt;yes&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Initial Value: &lt;strong&gt;the actual function&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Scope: &lt;strong&gt;block&lt;/strong&gt; (this is only true when using &lt;code&gt;'strict'&lt;/code&gt; mode, which you should be!)&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Function Expressions and Arrow Functions
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;In this case, it depends on whether they were declared using &lt;code&gt;var&lt;/code&gt;, &lt;code&gt;let&lt;/code&gt; or &lt;code&gt;const&lt;/code&gt;. They will behave the same way variables do with those declarations.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That's a pretty broad and simple explanation of hoisting. I hope it helps!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Get Some REST: Server Responses</title>
      <dc:creator>Ronnie</dc:creator>
      <pubDate>Thu, 07 Jan 2021 01:26:32 +0000</pubDate>
      <link>https://dev.to/arynnboniface/get-some-rest-server-responses-41dm</link>
      <guid>https://dev.to/arynnboniface/get-some-rest-server-responses-41dm</guid>
      <description>&lt;p&gt;Last week I covered the basics of RESTful architecture on the client side. This week I'll be talking about the server side. &lt;/p&gt;

&lt;p&gt;When a client sends a request to the server, content types are included in the request header. When the server is returning a data payload, it needs to include a content type in the header of its response. &lt;/p&gt;

&lt;p&gt;A client trying to access a resource could look 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 /posts/19 HTTP/1.1
Accept: application/json, text/html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And the server response might look something 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;HTTP/1.1 200 (OK)
Content-Type: application/json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That brings us to response codes! When a server returns a response it includes a status code that lets the client know whether or not the request was successful. There are a lot of different status codes, too many to remember but here are the most common ones:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;200 (OK) - Response to a successful HTTP request
201 (CREATED) - Response to an HTTP that successfully created an item.
204 (NO CONTENT) - Response to a successful HTTP request where nothing is being returned in the response.
400 (BAD REQUEST) - Response failed due to improper syntax, excessive size or some other error coming from the client side.
403 (FORBIDDEN) - The client doesn't have permission to access the resource.
404 (NOT FOUND) - The one most people see most frequently. This response says that the server wasn't able to find this resource.
500 (INTERNAL SERVER ERROR) - Blanket error for unexpected failures when more information isn't available.  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;All HTTP verbs have an expected status code when the request is carried out successfully:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;GET - 200 (OK)
POST - 201 (CREATED)
PATCH - 200 (OK)
DELETE - 204 (NO CONTENT)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and that concludes our high-level overview of REST!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Get Some REST: Client Side</title>
      <dc:creator>Ronnie</dc:creator>
      <pubDate>Sat, 02 Jan 2021 18:06:47 +0000</pubDate>
      <link>https://dev.to/arynnboniface/-m60</link>
      <guid>https://dev.to/arynnboniface/-m60</guid>
      <description>&lt;p&gt;REST, or REpresentational State Transfer, is an architectural design system thought up by Roy Thomas Fielding in 2000 after being frustrated with the lack of standardization in structuring URLs. RESTful systems are (stateless)[&lt;a href="https://restfulapi.net/statelessness/"&gt;https://restfulapi.net/statelessness/&lt;/a&gt;] and separate the concerns of the client and server. &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Santa's Regex to Town</title>
      <dc:creator>Ronnie</dc:creator>
      <pubDate>Sat, 02 Jan 2021 18:06:40 +0000</pubDate>
      <link>https://dev.to/arynnboniface/santa-s-regex-to-town-1m0m</link>
      <guid>https://dev.to/arynnboniface/santa-s-regex-to-town-1m0m</guid>
      <description>&lt;p&gt;To the bewilderment of my friends and co-workers, regex (or regular expression)is one of my favorite things in the world. Not only is writing them fun (think ciphers!), but they can be extremely useful as well! Today we're going to see how we can use it to help out our pal Santa Clause. &lt;/p&gt;

&lt;p&gt;Here is a brief rundown on regular expressions before we get started:&lt;br&gt;&lt;br&gt;
 -- What is it?: &lt;a href="https://en.wikipedia.org/wiki/Regular_expression"&gt;a sequence of characters that define a search pattern&lt;/a&gt;.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Santa's Regex to Town</title>
      <dc:creator>Ronnie</dc:creator>
      <pubDate>Sat, 26 Dec 2020 00:54:59 +0000</pubDate>
      <link>https://dev.to/arynnboniface/santa-s-regex-to-town-l49</link>
      <guid>https://dev.to/arynnboniface/santa-s-regex-to-town-l49</guid>
      <description>&lt;p&gt;To the bewilderment of my friends and co-workers, regex (or regular expression)is one of my favorite things in the world. Not only is writing them fun (think ciphers!), but they can be extremely useful as well! Today we're going to see how we can use it to help out our pal Santa Clause. &lt;/p&gt;

&lt;p&gt;Before we get started... What is regex?: &lt;a href="https://en.wikipedia.org/wiki/Regular_expression"&gt;a sequence of characters that define a search pattern&lt;/a&gt;. A lot of programming languages either have regex built in or usable through libraries. Today we're going to use Ruby!&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Why is it useful?: When we use regex to define a search pattern, we can save ourselves a ton of time. It's efficient to write and efficient to run. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We all know that Santa Clause is an incredibly busy man. His eyesight isn't what it used to be though. (He still knows who has been behaving though!) This year the elves forgot to split the list into two, one for nice children and one for naughty. Santa needs our help to see who all of the good children are before he heads out to deliver toys.&lt;/p&gt;

&lt;p&gt;Let's say this is our list of children: &lt;br&gt;
&lt;code&gt;all_kids = "Ronnie - Nice, Candice - Nice, Michael - Naughty, Elsa - Naughty, Blake - Nice, Jer - Nice, Helen - Naughty, Anthony - Nice, Nicholas - Naughty, Joseph - Naughty"&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Santa would like to know how many nice children are on the list this year so he can make sure that he's got enough time to get to everyone.&lt;/p&gt;

&lt;p&gt;We can use Ruby's &lt;code&gt;.scan&lt;/code&gt; method for this one. It will return an array of each occurrence of our search pattern.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def nice_length(kids) 
  kids.scan(/\b(nice)/i).length
end 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;nice_length(all_kids)&lt;/code&gt; would return &lt;code&gt;5&lt;/code&gt;. Neat! &lt;/p&gt;

&lt;p&gt;Santa asks us to give him a list of only the nice children so that he can make sure all of the gift tags are correct.&lt;br&gt;
&lt;code&gt;all_kids = ["Ronnie - Nice", "Candice - Nice", "Michael - Naughty", "Elsa - Naughty", "Blake - Nice", "Jer - Nice", "Helen - Naughty", "Anthony - Nice", "Nicholas - Naughty", "Joseph - Naughty"]&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def nice_list(kids)
  kids.map{|kid| kid if kid.match(/\b(nice)/i)}
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Running this method returns this array: &lt;code&gt;["Ronnie - Nice", "Candice - Nice", "Blake - Nice", "Jer - Nice", "Anthony - Nice"]&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Awesome! We just made Santa's job way easier. Hopefully this keeps us on the nice list for next year!&lt;/p&gt;

&lt;p&gt;Here are two great resources for practicing regex: &lt;a href="https://rubular.com/"&gt;Rubular.com&lt;/a&gt; and &lt;a href="https://www.regular-expressions.info/"&gt;Regular-Expressions.info&lt;/a&gt;.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>bind(), apply() and call() me maybe: Pt. 3</title>
      <dc:creator>Ronnie</dc:creator>
      <pubDate>Fri, 18 Dec 2020 21:03:31 +0000</pubDate>
      <link>https://dev.to/arynnboniface/bind-apply-and-call-me-maybe-pt-3-19b7</link>
      <guid>https://dev.to/arynnboniface/bind-apply-and-call-me-maybe-pt-3-19b7</guid>
      <description>&lt;p&gt;This is the third and final post of my three part series on JavaScript's &lt;a href="https://dev.to/arynnboniface/-12bk"&gt;bind()&lt;/a&gt;, &lt;a href="https://dev.to/arynnboniface/bind-apply-and-call-me-maybe-pt-2-2jhd"&gt;apply()&lt;/a&gt; and &lt;code&gt;call()&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;Here is the &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/call"&gt;JavaScript MDN&lt;/a&gt; explanation of &lt;code&gt;call()&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;The call() method calls a function with 
a given this value and arguments provided individually.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;apply()&lt;/code&gt; and &lt;code&gt;call()&lt;/code&gt; are relatively similar. Both immediately invoke a function (with a specified context for &lt;code&gt;this&lt;/code&gt;), where &lt;code&gt;bind()&lt;/code&gt; does not. The difference lies in the arguments. &lt;code&gt;apply()&lt;/code&gt; allows for arguments to be passed in as an array and &lt;code&gt;call()&lt;/code&gt; needs arguments to be passed in one by one. &lt;/p&gt;

&lt;p&gt;As we learned in the previous parts of this series and by brushing up on &lt;code&gt;this&lt;/code&gt;, using the &lt;code&gt;this&lt;/code&gt; keyword without context results in &lt;code&gt;undefined&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const snowPerson = {
  top: "small snowball",
  middle: "medium snowball",
  bottom: "large snowball",
  accessories: "sticks, coal, scarf, hat and a carrot"
}

function buildSnowPerson() {
  return `Stack ${this.middle} on top of ${this.bottom} 
and stack ${this.top} on ${this.middle}. 
Use ${this. accessories} to finish your snow person!`
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If we invoke &lt;code&gt;buildSnowPerson()&lt;/code&gt;, it will return:&lt;br&gt;
&lt;code&gt;Stack undefined on top of undefined and stack undefined on undefined. Use undefined to finish your snow person!&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Yikes. Looks more like a government document than it does instructions to build a snow person! &lt;/p&gt;

&lt;p&gt;But, if we use &lt;code&gt;call()&lt;/code&gt;, &lt;code&gt;buildSnowPerson.call(snowPerson)&lt;/code&gt; we'll get some pretty good directions to build a snow person!&lt;br&gt;
&lt;code&gt;Stack medium snowball on top of big snowball and stack small snowball on medium snowball. Use sticks, coal, scarf, hat and a carrot to finish your snow person!&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;When we're using &lt;code&gt;call()&lt;/code&gt;, the &lt;code&gt;snowPerson&lt;/code&gt; object used as the argument becomes our &lt;code&gt;this&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Here's an example of using additional arguments with &lt;code&gt;call()&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function snowPersonSeason(hot, cold) {
  return `If it's ${cold}, you can build a snow person like this: 
Stack ${this.middle} on top of ${this.bottom} 
and stack ${this.top} on ${this.middle}. 
Use ${this. accessories} to finish your snow person! 
This won't work if it's ${hot} time! `
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Can you guess what &lt;code&gt;snowPersonSeason.call('Summer', 'Winter')&lt;/code&gt; will return?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;If it's Winter, you can build a snow person like this: 
Stack medium snowball on top of big snowball 
and stack small snowball on medium snowball. 
Use sticks, coal, scarf, hat and a carrot to 
finish your snow person!

This won't work if it's Summer time!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Those are the basics of &lt;code&gt;call()&lt;/code&gt;!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>bind(), apply() and call() me maybe: Pt. 2</title>
      <dc:creator>Ronnie</dc:creator>
      <pubDate>Mon, 07 Dec 2020 19:50:55 +0000</pubDate>
      <link>https://dev.to/arynnboniface/bind-apply-and-call-me-maybe-pt-2-2jhd</link>
      <guid>https://dev.to/arynnboniface/bind-apply-and-call-me-maybe-pt-2-2jhd</guid>
      <description>&lt;p&gt;Last week, I covered &lt;a href="https://dev.to/arynnboniface/-12bk"&gt;bind()&lt;/a&gt; and this week I'll be going over &lt;code&gt;apply()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;First thing, this is how &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/apply"&gt;JavaScript's MDN&lt;/a&gt; describes &lt;code&gt;apply()&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;The apply() method calls a function with a given this value, and arguments provided as an array (or an array-like object).
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's say you just got a new job. There are a lot of new people to meet, so let's write some code that will make introducing yourself to everyone a little bit easier:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let aboutMe = {
  firstName: "Joe",
  lastName: "Coder",
  job: "web developer"
}

function sayHello(greeting, message) {
  return `${greeting}. I'm ${this.firstName} and I'm a 
  ${this.job}. ${message}`
}

let introduction = sayHello.apply(aboutMe, ["Hello!", "It's nice to meet you!"])

console.log(introduction)
// returns "Hello! I'm Joe and I'm a web developer. It's nice to meet you!"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Can you guess what happens without apply?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let introduction = sayHello(aboutMe, ["Hello!", "It's nice to meet you!"])

console.log(introduction)

// returns [object Object]. I'm undefined and I'm a undefined. Hello!,It's nice to meet you!

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

&lt;/div&gt;



&lt;p&gt;It's a good thing we remembered to use &lt;code&gt;apply()&lt;/code&gt; or that would have been embarrassing.&lt;/p&gt;

&lt;p&gt;That sounds pretty similar to &lt;code&gt;bind()&lt;/code&gt;, but remember: &lt;code&gt;bind()&lt;/code&gt; creates a new function and &lt;code&gt;apply()&lt;/code&gt; does not. If we were to try: &lt;code&gt;console.log(introduction())&lt;/code&gt; we would get an error that looks something like this: &lt;code&gt;TypeError: introduction is not a function&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;apply()&lt;/code&gt; is similar to &lt;code&gt;call()&lt;/code&gt;, which we'll be covering next week!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>bind(), apply() and call() me maybe: Pt. 1 </title>
      <dc:creator>Ronnie</dc:creator>
      <pubDate>Fri, 04 Dec 2020 20:24:07 +0000</pubDate>
      <link>https://dev.to/arynnboniface/-12bk</link>
      <guid>https://dev.to/arynnboniface/-12bk</guid>
      <description>&lt;p&gt;This is part one of a three part series on JavaScript's &lt;code&gt;bind()&lt;/code&gt;, &lt;code&gt;apply()&lt;/code&gt; and &lt;code&gt;call()&lt;/code&gt;. These three methods are pretty closely related, but I think that each one deserves its own post! These concepts can be a little difficult to grasp, at least they were for me, so focusing on one at a time will be helpful!&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;this&lt;/code&gt; keyword:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;This &lt;a href="https://www.javascripttutorial.net/javascript-this/"&gt;tutorial&lt;/a&gt; covers just about everything you need to know about &lt;code&gt;this&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;First, let's take a look at the docs on &lt;code&gt;bind()&lt;/code&gt; from &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_objects/Function/bind"&gt;JavaScript MDN&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;The bind() method creates a new function that, when called, has its this keyword set to the provided value, with a given sequence of arguments preceding any provided when the new function is called.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That explanation is a little rough, especially if you're new to JavaScript. Let's break it down!&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;bind()&lt;/code&gt; returns a new function that has a specific value of &lt;code&gt;this&lt;/code&gt; bound to it when invoked.&lt;/li&gt;
&lt;li&gt;The parameter passed into &lt;code&gt;bind()&lt;/code&gt; will become &lt;code&gt;this&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;You can add extra parameters to &lt;code&gt;bind()&lt;/code&gt; after this initial &lt;code&gt;this&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;bind()&lt;/code&gt; when you want to call a function later on and with a specific context.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here's an example without &lt;code&gt;bind()&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let meal = {
  snack: "apple"
}

let eat = function(){
  console.log(this.snack)
} 

eat();
// will return undefined
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here is where &lt;code&gt;bind()&lt;/code&gt; comes in to save the day!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let boundEat = eat.bind(meal)

boundEat();
// returns "apple"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, let's see how we can add in those extra arguments!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let meal = {
  type: "dinner",
  consistsOf: "spaghetti and meatballs"
  chef: function(name) {
    return `Chef ${name} says: "We're having 
    ${this.consistsOf} for ${this.meal}."`
  }
}

let chefSays = meal.chef.bind(meal, "Remy")

// returns Chef Remy says: "We're having spaghetti and meatballs for dinner."
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's &lt;code&gt;bind()&lt;/code&gt; simplified!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Taking a Load Off with ActiveRecord</title>
      <dc:creator>Ronnie</dc:creator>
      <pubDate>Sat, 28 Nov 2020 01:49:49 +0000</pubDate>
      <link>https://dev.to/arynnboniface/-2dld</link>
      <guid>https://dev.to/arynnboniface/-2dld</guid>
      <description>&lt;p&gt;ActiveRecord is the ORM layer Ruby on Rails supplies to an application. Most simply put, ActiveRecord is the 'M' in MVC. Models are the system responsible for representing the application's logic. ActiveRecord saves us a lot of time that could be spent writing database query commands, think SQLite, Postgres, MySQL...&lt;/p&gt;

&lt;p&gt;ActiveRecord maps a table to a database making each row of data and instance of a class and makes all of our database queries simple, neat and quick (ORM).&lt;/p&gt;

&lt;p&gt;Let's see the difference between adding a row to a database table and finding that row or instance in the table with an SQL query:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;INSERT INTO Users (name)
VALUES ("Joe Everyone")

SELECT * FROM Users
WHERE name="Joe Everyone"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and with ActiveRecord:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User.create(name: "Joe Everyone")
User.find_by(name: "Joe Everyone")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This isn't saving us TOO much time, but what happens when we have a lot more parameters for an instance of the User class, name, DOB, location, do they have a premium account?...&lt;/p&gt;

&lt;p&gt;The real magic happens when we get into the relationships and associations between models.&lt;/p&gt;

&lt;p&gt;User model and migration table:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class User &amp;lt; ActiveRecord::Base
  has_many :posts
end

class CreateUsers &amp;lt; ActiveRecord::Migration[5.2]
  def change
    create_table :users do |t|
      t.string :name
      t.string :email
      t.string :avatar_url
      t.integer :post_ids
    end
  end
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's say these users are blogging, so we'll create a Post class and migration table as well:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Post &amp;lt; ActiveRecord::Base
  belongs_to :user
end

class CreatePosts &amp;lt; ActiveRecord::Migration[5.2]
  def change
    create_table :posts do |t|
      t.string :title
      t.text :content
      t.date :post_date
      t.integer :user_id
    end
  end
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's see what writing these tables would look like as SQL queries:&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 User
(
Pk_User_Id INT PRIMARY KEY,
Name VARCHAR(20),
Email VARCHAR(20),
Avatar_Url VARCHAR(20)
);

CREATE TABLE Post
(
Pk_Post_Id INT PRIMARY KEY
Title VARCHAR(50),
Content TEXT,
Post_date DATE,
Fk_User_Id INT FOREIGN KEY REFERENCES User(Pk_User_Id)
);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Starting to look like some heavy lifting on the SQL side. Now, let's say we want to see all of the posts from a certain User&lt;/p&gt;

&lt;p&gt;With SQL, we'll need write an Inner Join:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT *
FROM Users
INNER JOIN Posts
WHERE User.Pk_User_Id = Post.Fk_User_id
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With ActiveRecord we can very simply write:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;user = User.find_by(id: params[:id])
user.posts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This gets increasingly more complicated as we start adding more models and relationships. &lt;/p&gt;

&lt;p&gt;Additionally, ActiveRecord automatically creates methods to make using CRUD verbs simple and intuitive. We can also use ActiveRecord to validate a model before an instance is persisted to the database. We wouldn't want two users to have the same email address, or a post to have no content!&lt;/p&gt;

&lt;p&gt;ActiveRecord is not only a powerful tool, but pretty fun to use! Happy persisting!&lt;/p&gt;

&lt;p&gt;&lt;span&gt;Photo by &lt;a href="https://unsplash.com/@alesme?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Ales Me&lt;/a&gt; on &lt;a href="https://unsplash.com/s/photos/relax?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Unsplash&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>MVC - What is it?</title>
      <dc:creator>Ronnie</dc:creator>
      <pubDate>Sat, 21 Nov 2020 01:29:38 +0000</pubDate>
      <link>https://dev.to/arynnboniface/-2387</link>
      <guid>https://dev.to/arynnboniface/-2387</guid>
      <description>&lt;p&gt;Model. View. Controller. &lt;br&gt;
What are those?&lt;/p&gt;

&lt;p&gt;Model: They represent the data. That's it! They don't depend on controllers, but they can communicate with them.&lt;/p&gt;

&lt;p&gt;View: They display the models data, by way of the controller and send user actions back to the controller.&lt;/p&gt;

&lt;p&gt;Controller: They send model data to the view and interpret user actions. &lt;/p&gt;

&lt;p&gt;What's the big deal?&lt;br&gt;
MVC helps keep our concerns separated. We have three moving parts: data, display of data and communication between the two. Keeping these jobs separate makes creating simple and less buggy code a lot easier. If we had all that code in one file, we'd be pulling all of our hair out pretty quickly.&lt;/p&gt;

&lt;p&gt;Real Life Example:&lt;br&gt;
Let's think about it like we're going out to eat. You (a user) sit down at your table and take a look at a menu (sounds like a view to me). After a few minutes, you decide what you'd like to eat (a user request). Your server (controller) takes that order back to the kitchen (the model). After your server brings your order to the kitchen, the cooks start preparing it. If all goes according to plan, your server should be bringing the food you ordered back to your table in a reasonable amount of time. There is now a nice looking plate of food sitting in front of you, which may be the best kind of updated view there is!&lt;/p&gt;

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