<?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: Shaundai Person</title>
    <description>The latest articles on DEV Community by Shaundai Person (@shaundai).</description>
    <link>https://dev.to/shaundai</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%2F255076%2F7a546ba7-5009-4e54-b579-50fcb28851a9.jpeg</url>
      <title>DEV Community: Shaundai Person</title>
      <link>https://dev.to/shaundai</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shaundai"/>
    <language>en</language>
    <item>
      <title>How to switch to using new version of node using nvm</title>
      <dc:creator>Shaundai Person</dc:creator>
      <pubDate>Thu, 13 Feb 2025 17:02:11 +0000</pubDate>
      <link>https://dev.to/shaundai/how-to-switch-to-using-new-version-of-node-using-nvm-2pfi</link>
      <guid>https://dev.to/shaundai/how-to-switch-to-using-new-version-of-node-using-nvm-2pfi</guid>
      <description>&lt;p&gt;&lt;strong&gt;SWITCH TO A NEW VERSION (TEMPORARY)&lt;/strong&gt;&lt;br&gt;
If you want to switch to a new version of node temporarily, use the command&lt;br&gt;
&lt;code&gt;nvm use [version]&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;where &lt;code&gt;version&lt;/code&gt; is the version number.  For example, to switch to node 18.20.0, your command will be&lt;br&gt;
&lt;code&gt;nvm use 18.20.0&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This will switch the node version until you close your IDE, and then it will restore the default version.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SWITCH TO A NEW VERSION (CHANGE DEFAULT)&lt;/strong&gt;&lt;br&gt;
If you'd like to change the default node version you're using so that you don't have to continue to change versions every time you re-open your IDE, use the keywords &lt;code&gt;alias default&lt;/code&gt; with &lt;code&gt;nvm&lt;/code&gt; like this:&lt;br&gt;
&lt;code&gt;nvm alias default [version]&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;where &lt;code&gt;version&lt;/code&gt; is the version number.  For example, to switch to node 18.20.0, your command will be&lt;br&gt;
&lt;code&gt;nvm alias default 18.20.0&lt;/code&gt;&lt;/p&gt;

</description>
      <category>programming</category>
      <category>node</category>
      <category>howto</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>How to install a new version of node using nvm</title>
      <dc:creator>Shaundai Person</dc:creator>
      <pubDate>Wed, 12 Feb 2025 14:41:33 +0000</pubDate>
      <link>https://dev.to/shaundai/how-to-install-a-new-version-of-node-using-nvm-4eda</link>
      <guid>https://dev.to/shaundai/how-to-install-a-new-version-of-node-using-nvm-4eda</guid>
      <description>&lt;p&gt;Just use &lt;code&gt;nvm install [version]&lt;/code&gt; where &lt;code&gt;version&lt;/code&gt; is the version number.  For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nvm install 18.20.4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>webdev</category>
      <category>programming</category>
      <category>node</category>
      <category>nvm</category>
    </item>
    <item>
      <title>Making Styles Repeatable: Dynamic Styling in React using Styled Components</title>
      <dc:creator>Shaundai Person</dc:creator>
      <pubDate>Fri, 18 Jun 2021 23:20:28 +0000</pubDate>
      <link>https://dev.to/shaundai/making-styles-repeatable-dynamic-styling-in-react-using-styled-components-5afl</link>
      <guid>https://dev.to/shaundai/making-styles-repeatable-dynamic-styling-in-react-using-styled-components-5afl</guid>
      <description>&lt;p&gt;The &lt;a href="https://styled-components.com/" rel="noopener noreferrer"&gt;styled-components library&lt;/a&gt; makes it easy to create dynamic styles.  At the most fundamental level, Styled Components are just React components with CSS styles attached.  Thus, they can be used the same way we'd use any React component.  Styled Components also come with out-of-the-box constructors that allow you to pass props and functions into your styles, which is what gives them their dynamic abilities.&lt;/p&gt;

&lt;p&gt;Before we get into the &lt;em&gt;how&lt;/em&gt; though, let’s talk about the &lt;em&gt;why&lt;/em&gt;.  Why would we want to use dynamic styles in our React apps?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;DRY and Maintainable:&lt;/strong&gt; Instead of declaring the same styles again and again each time you need them, dynamic styles are declared once and exported as needed.  This means that any future changes to styles only need to be made in one place.  When you Don’t Repeat Yourself (DRY), maintaining and updating your codebase is simpler.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Less Error Prone:&lt;/strong&gt; Now that we only need to make our changes in one place, it's also less likely we’ll accidentally miss a change somewhere.  For this reason, DRY code (via dynamic styling) is more trustworthy.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Clean and Easy to Read:&lt;/strong&gt; Dynamic styling allows us to change up our styles without injecting or removing class names, making our stylesheets shorter and cleaner.  Styles can even be declared &lt;em&gt;within&lt;/em&gt; the &lt;code&gt;.js&lt;/code&gt; file using the styles, making them really easy to find later!&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Starting with a Basic Button
&lt;/h3&gt;

&lt;p&gt;Start by declaring a variable with a descriptive name (like &lt;code&gt;PrimaryButton&lt;/code&gt; below) and setting it equal to &lt;code&gt;styled.[HTML-element-we-want-to-use]&lt;/code&gt;.  The styles are declared between two backticks at the end of the Styled Component declaration.&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;styled&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;styled-components&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;PrimaryButton&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;styled&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt;&lt;span class="s2"&gt;`
  background-color: darkcyan;
  color: white;

  border-radius: 8px;
  border-color: transparent;
  width: 250px;
  padding: 14px;
  font: 20px Georgia;
  &amp;amp;&amp;amp;:hover {
    background-color: rgb(0,139,139,0.5);
  } 
`&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;PrimaryButton&lt;/code&gt; contains a lot of styles that we'll be using frequently in our app.  Luckily - since &lt;code&gt;PrimaryButton&lt;/code&gt; is fundamentally a React Component - we don't need to retype these styles each time we need to use them.  We also don't need to worry about adding class names to link our styles to a separate stylesheet.  To use &lt;code&gt;PrimaryButton&lt;/code&gt; styles, all we do is swap the old HTML element &lt;code&gt;&amp;lt;button&amp;gt;&lt;/code&gt;...&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Before&lt;/strong&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;button&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;a&lt;/span&gt; &lt;span class="nx"&gt;button&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="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;...with our new &lt;code&gt;PrimaryButton&lt;/code&gt; Styled Component.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;After&lt;/strong&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;PrimaryButton&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;a&lt;/span&gt; &lt;span class="nx"&gt;button&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/PrimaryButton&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;If our marketing team later decides to change our app’s theme colors from &lt;code&gt;darkcyan&lt;/code&gt; to &lt;code&gt;green&lt;/code&gt;, all we need to do is make a one-line change to &lt;code&gt;PrimaryButton&lt;/code&gt; to change &lt;em&gt;all&lt;/em&gt; instances of &lt;code&gt;PrimaryButton&lt;/code&gt; to &lt;code&gt;green&lt;/code&gt; at once.&lt;/p&gt;

&lt;h3&gt;
  
  
  Extending Custom Styles
&lt;/h3&gt;

&lt;p&gt;What if we want two different-but-fairly-similar types of buttons in our app?  For instance, what if our primary buttons are &lt;code&gt;darkcyan&lt;/code&gt;, but we also want some buttons with a &lt;code&gt;red&lt;/code&gt; background to indicate to users that an action is permanent?  Other than the color, these red “destructive buttons” will be identical to the &lt;code&gt;PrimaryButtons&lt;/code&gt; we built in the previous example.&lt;/p&gt;

&lt;p&gt;Rather than creating a new class for our destructive style, we &lt;em&gt;extend&lt;/em&gt; the &lt;code&gt;PrimaryButton&lt;/code&gt; styles that we want to use and override the styles we don’t need.  This is all the code we need to tell Styled Components “&lt;code&gt;PrimaryButton&lt;/code&gt;, but red.”:&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;DestructiveButton&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;styled&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;PrimaryButton&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;`
  color: ‘red’;
`&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can use our new &lt;code&gt;DestructiveButton&lt;/code&gt; in place of &lt;code&gt;PrimaryButton&lt;/code&gt; wherever we'd like the &lt;code&gt;red&lt;/code&gt; buttons to appear. Our code is much cleaner and easier to maintain.  If our marketing team comes back and wants to change the padding for all buttons to &lt;code&gt;12px&lt;/code&gt; instead of &lt;code&gt;14px&lt;/code&gt;, we only need to change the single padding declaration in &lt;code&gt;PrimaryButton&lt;/code&gt; to update the padding for &lt;em&gt;all&lt;/em&gt; buttons, Primary and Destructive alike.&lt;/p&gt;

&lt;h3&gt;
  
  
  Making Styles Dynamic
&lt;/h3&gt;

&lt;p&gt;Now let’s get into the dynamic styling.  In this example, we want a button to be &lt;code&gt;darkcyan&lt;/code&gt; some of the time and &lt;code&gt;red&lt;/code&gt; some of the time (for example, the submit button on a form that only turns red when the user has entered invalid information).&lt;/p&gt;

&lt;p&gt;How can we make our styles change based on the current status of elements in our UI?  If we were using just CSS, we'd need to add or remove a class when the input is empty.  If we were using React, we might use a function that accepts props.  Based on the value in those props, our function could set the color equal to either &lt;code&gt;red&lt;/code&gt; or &lt;code&gt;darkcyan&lt;/code&gt;.  Since Styled Components is just React, we have an easy way of doing the latter.&lt;/p&gt;

&lt;p&gt;Styled Components comes with an Attributes constructor (&lt;code&gt;attrs&lt;/code&gt;) that accepts static props or dynamic props.  We're going to use dynamic props for this example.&lt;/p&gt;

&lt;p&gt;We start from scratch with a styled button component - &lt;code&gt;MainButton&lt;/code&gt; - which can dynamically render three variants: &lt;code&gt;primary&lt;/code&gt;, &lt;code&gt;destructive&lt;/code&gt;, and &lt;code&gt;line&lt;/code&gt; (inverted &lt;code&gt;primary&lt;/code&gt; colors).  We'll use the &lt;code&gt;attrs&lt;/code&gt; constructor to make the &lt;code&gt;background-color&lt;/code&gt;, &lt;code&gt;border-color&lt;/code&gt; colors, and &lt;code&gt;hover&lt;/code&gt; colors change dynamically.&lt;/p&gt;

&lt;p&gt;Below, we start with three objects each defining the colors by variant.&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;ButtonBackgroundColors&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;primary&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;darkcyan&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;destructive&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;red&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;line&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;white&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;ButtonBorderColors&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;primary&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;transparent&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;destructive&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;transparent&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;line&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;darkcyan&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;ButtonHoverColors&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;primary&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;rgb(0,139,139,0.5)&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;destructive&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;rgb(255,0,0,0.5)&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;line&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;rgb(0,139,139,0.5)&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;To use &lt;code&gt;attrs&lt;/code&gt;, we add it onto the end of the template literal declaration.  &lt;code&gt;attrs&lt;/code&gt; accepts a function that takes in the &lt;code&gt;props&lt;/code&gt; from our instance of &lt;code&gt;&amp;lt;MainButton&amp;gt;&lt;/code&gt;. The &lt;code&gt;attrs&lt;/code&gt; function returns an object, and we've set those &lt;code&gt;props&lt;/code&gt; equal to the object's keys.  In other words, to use &lt;code&gt;colorVariant&lt;/code&gt; in an instance of &lt;code&gt;MainButton&lt;/code&gt;, all we need to do is add colorVariant as a prop like this: &lt;code&gt;&amp;lt;MainButton colorVariant="primary"&amp;gt;&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;It is good practice to also include a fallback or default option in case the developer does not add any &lt;code&gt;colorVariant&lt;/code&gt; props to &lt;code&gt;MainButton&lt;/code&gt;.  Setting &lt;code&gt;colorVariant&lt;/code&gt; equal to either &lt;code&gt;props.colorVariant&lt;/code&gt; or &lt;code&gt;'primary'&lt;/code&gt; means that if &lt;code&gt;colorVariant&lt;/code&gt; is not present, we will always use &lt;code&gt;primary&lt;/code&gt; as our variant.&lt;/p&gt;

&lt;p&gt;In this example we're only changing colors using a &lt;code&gt;colorVariant&lt;/code&gt; prop, but the variant possibilities are endless!  In the future, if we wanted to add, say, a &lt;code&gt;sizeVariant&lt;/code&gt; that manipulates the height, width, and padding of the button based on variants of &lt;code&gt;small&lt;/code&gt;, &lt;code&gt;medium&lt;/code&gt;, and &lt;code&gt;large&lt;/code&gt;, we could add that to our object as well.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;MainButton&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;styled&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;attrs&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="na"&gt;colorVariant&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="nx"&gt;colorVariant&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;primary&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="s2"&gt;`
  background-color: darkcyan;
  color: white;

  border-radius: 8px;
  border-color: transparent;
  width: 250px;
  padding: 14px;
  font: 20px Georgia;
  &amp;amp;&amp;amp;:hover {
    background-color: rgb(0,139,139,0.5);
    }
`&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So far, we've told &lt;code&gt;MainButton&lt;/code&gt; to look out for the &lt;code&gt;colorVariant&lt;/code&gt; prop, but we haven't yet provided it our colors.  Let's start with &lt;code&gt;background-color&lt;/code&gt;.  Below, we set it equal to a function that accepts the &lt;code&gt;props&lt;/code&gt; from &lt;code&gt;attrs&lt;/code&gt;.  We return the property in &lt;code&gt;ButtonBackgroundColors&lt;/code&gt; that has the color variant we used (in this case, &lt;code&gt;primary&lt;/code&gt;) as a key.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;PrimaryButton&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;styled&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;attrs&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="na"&gt;colorVariant&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="nx"&gt;colorVariant&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}))&lt;/span&gt;&lt;span class="s2"&gt;`
  background-color: &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="nx"&gt;ButtonBackgroundColors&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="nx"&gt;colorVariant&lt;/span&gt;&lt;span class="p"&gt;]}&lt;/span&gt;&lt;span class="s2"&gt;;
  color: white;

  border-radius: 8px;
  border-color: transparent;
  width: 250px;
  padding: 14px;
  font: 20px Georgia;
  &amp;amp;&amp;amp;:hover {
    background-color: rgb(0,139,139,0.5);
    }
`&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Alternatively, we can make our color function a bit cleaner using object destructuring.  Below, we destructure &lt;code&gt;props&lt;/code&gt; in our declaration function for &lt;code&gt;background-color&lt;/code&gt;.  (Note, the code in &lt;code&gt;background-color&lt;/code&gt; below does exactly the same thing as the &lt;code&gt;background-color&lt;/code&gt; above.  Destructuring as we've done below is a matter of personal preference).&lt;/p&gt;

&lt;p&gt;We also use our &lt;code&gt;ButtonBorderColors&lt;/code&gt; and &lt;code&gt;ButtonHoverColors&lt;/code&gt; objects to give dynamic styling to &lt;code&gt;border-color&lt;/code&gt; and &lt;code&gt;hover&lt;/code&gt; &lt;code&gt;background-color&lt;/code&gt;.  &lt;code&gt;props&lt;/code&gt; has been destructured in their declaration as well.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;PrimaryButton&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;styled&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;attrs&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="na"&gt;colorVariant&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="nx"&gt;colorVariant&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}))&lt;/span&gt;&lt;span class="s2"&gt;`
  background-color: &lt;/span&gt;&lt;span class="p"&gt;${({&lt;/span&gt;&lt;span class="nx"&gt;colorVariant&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;ButtonBackgroundColors&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;colorVariant&lt;/span&gt;&lt;span class="p"&gt;]}&lt;/span&gt;&lt;span class="s2"&gt;;
  color: &lt;/span&gt;&lt;span class="p"&gt;${({&lt;/span&gt;&lt;span class="nx"&gt;colorVariant&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;ButtonTextColors&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;colorVariant&lt;/span&gt;&lt;span class="p"&gt;]}&lt;/span&gt;&lt;span class="s2"&gt;;

  border-radius: 8px;
  border-color: transparent;
  width: 250px;
  padding: 14px;
  font: 20px Georgia;
  &amp;amp;&amp;amp;:hover {
    background-color: &lt;/span&gt;&lt;span class="p"&gt;${({&lt;/span&gt;&lt;span class="nx"&gt;colorVariant&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;ButtonHoverColors&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;colorVariant&lt;/span&gt;&lt;span class="p"&gt;]}&lt;/span&gt;&lt;span class="s2"&gt;;
    }
`&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we're ready to use our dynamic styles!  We can provide props to our button 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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;MainButton&lt;/span&gt; &lt;span class="nx"&gt;colorVariant&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;destructive&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Press&lt;/span&gt; &lt;span class="nx"&gt;Me&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/MainButton&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;or we have the option of using a function that passes in the correct color based on props or events:&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;MainButton&lt;/span&gt; &lt;span class="nx"&gt;colorVariant&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;getColorVariantFunction&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;Press&lt;/span&gt; &lt;span class="nx"&gt;Me&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/MainButton&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;Dynamic styling gives us clean, DRY code that can be easily reused.  Our codebase is more trustworthy and easier to maintain; any future changes only need to be made in one place.  Best of all, we have a way to change styles without the messiness of adding class names, eliminating the chances of making silly errors that cause bugs in production.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;I'm building a TypeScript course - TypeScript for JavaScript Developers&lt;/em&gt;!  &lt;b&gt;Sign up for updates &lt;a href="https://www.tsforjs.com" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;...or find me on &lt;a href="https://twitter.com/shaundai" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;&lt;/p&gt;

</description>
      <category>codenewbie</category>
      <category>react</category>
      <category>tutorial</category>
      <category>javascript</category>
    </item>
    <item>
      <title>How Potty Training Shaped My Tech Teaching Style</title>
      <dc:creator>Shaundai Person</dc:creator>
      <pubDate>Sat, 05 Jun 2021 17:56:07 +0000</pubDate>
      <link>https://dev.to/shaundai/how-potty-training-shaped-my-tech-teaching-style-29e2</link>
      <guid>https://dev.to/shaundai/how-potty-training-shaped-my-tech-teaching-style-29e2</guid>
      <description>&lt;p&gt;&lt;em&gt; This post was inspired by my interview on &lt;a href="https://www.hanselminutes.com/792/learning-to-teach-with-shaundai-person" rel="noopener noreferrer"&gt;Hanselminutes podcast&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;For the first few days, my son and I were both pretty frustrated with the idea of potty training.  After Lysoling and mopping the floor for the billionth time, I remember trying to explain to him once again that he needed to stay seated until he “went.”  He wanted to go play.  He stood up again.  I could tell from the tired look in his round eyes he just wanted things to go back to the way they were before.  I did too.&lt;/p&gt;

&lt;p&gt;“Forget it,” I sighed.  I exhaustedly put down the empty paper towel roll in my hand, turned up the sound on the TV, and quietly walked into my closet and shut the door behind me - jaw clenched the whole way.  Confident that my baby wouldn’t hear me, I screamed at the top of my lungs until I ran out of breath.&lt;/p&gt;




&lt;p&gt;I used a potty training method from a book that promised to have him trained in 3 days. It came highly recommended from parents I trusted.  They swore the method worked like magic.  Instead, I was emotionally drained and ready to quit on day 2.&lt;/p&gt;

&lt;p&gt;Feeling defeated, I called my mom for advice.  “I’m following these instructions &lt;em&gt;exactly&lt;/em&gt; and there’s &lt;em&gt;absolutely&lt;/em&gt; no way he’ll be potty trained by tomorrow.  Maybe it’s just too early to be trying this.  We’ll try again in 6 months.”&lt;/p&gt;

&lt;p&gt;I could almost hear her shaking her head through the phone.  “No. He’s ready now,” she said.  “Remember, all of this is completely new for him.  Think about what you’re doing.  You’re giving him a tool he’s &lt;em&gt;&lt;strong&gt;never seen before&lt;/strong&gt;&lt;/em&gt;, language he’s &lt;em&gt;&lt;strong&gt;never heard before&lt;/strong&gt;&lt;/em&gt;, and expecting him to just put it together to ‘instinctively’ do something he’s &lt;em&gt;&lt;strong&gt;never done before&lt;/strong&gt;&lt;/em&gt;.  &lt;em&gt;You&lt;/em&gt; need to rethink the way you’re trying to teach him.” &lt;/p&gt;

&lt;p&gt;As usual, my mother was right.  With small changes to my teaching style, my kiddo was potty trained in a day.&lt;/p&gt;

&lt;p&gt;When it came to teaching programming, I wanted to avoid the mistakes I’d made when I first started to potty train my toddler.  Often, I hear stories from students whose learning starts out the same way.  They’re given:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;tools they’ve &lt;strong&gt;never seen before&lt;/strong&gt; (ex. VS Code, new libraries)&lt;/li&gt;
&lt;li&gt;language they’ve &lt;strong&gt;never used before&lt;/strong&gt; (new technical terminology),&lt;/li&gt;
&lt;li&gt;...and an unfair expectation to ‘instinctively’ put these together to do something they’ve &lt;strong&gt;never done before&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In the end, both the teacher and student end up frustrated or just giving up because the concepts just aren’t clicking for the student.  Though the teacher means well, there’s a huge piece missing here - the part where the teacher closes the gap in understanding by providing &lt;b&gt;context&lt;/b&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Giving Context
&lt;/h2&gt;

&lt;p&gt;Initially as a potty training teacher &lt;em&gt;(potty trainer?? Potty coach?? Potty sherpa.)&lt;/em&gt;, I let the &lt;a href="https://en.wikipedia.org/wiki/Curse_of_knowledge" rel="noopener noreferrer"&gt;curse of knowledge&lt;/a&gt;] get in the way of my ability to be effective.  I’d forgotten what it was like to be an absolute beginner at this.  After empathy, context is the most important resource I could provide to my little student.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Context is the language before and after a statement that helps you to understand its meaning.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;When it comes to teaching, providing context involves relating the new concept to something they’re familiar with.  Making the connection between difficult and already-familiar topics helps the student to&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Understand concepts quickly &lt;em&gt;and&lt;/em&gt; thoroughly&lt;/li&gt;
&lt;li&gt;Retain information for longer periods of time&lt;/li&gt;
&lt;li&gt;Apply learning effectively and accurately (because they have a deep understand)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For me, this translates to using a lot of analogies and storytelling.  Here’s an example of using analogies to &lt;a href="https://dev.to/shaundai/state-and-setstate-explained-with-emotion-110k"&gt;explain React state and setState&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Analogies don’t have to be an elaborate 1-to-1 metaphor.  Stories can be silly.  In fact, I’d argue that if silliness is what captures your students’ attention and makes a difficult topic more approachable, silly content is &lt;strong&gt;that&lt;/strong&gt; much better.  Just because it’s technical doesn’t mean it needs to be complicated!&lt;/p&gt;

&lt;p&gt;When building educational content for a large demographic, providing context also involves setting upfront expectations with people who consume your content to make sure that you are meeting them at their current level of understanding (well, getting them to meet you at the right starting point).&lt;/p&gt;

&lt;p&gt;Here are some examples of how to set expectations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;“This course requires a fundamental knowledge of JavaScript”&lt;/li&gt;
&lt;li&gt;“This is a course about CSS for JavaScript developers”&lt;/li&gt;
&lt;li&gt;“This post assumes the reader has a working knowledge of AWS”&lt;/li&gt;
&lt;li&gt;“If you don’t yet know what recursion is, here’s a link to a blog post that explains more.  Read this first!”&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Saving the Jargon
&lt;/h2&gt;

&lt;p&gt;Potty training also helped me to realize that simply “spewing a bunch of technical jargon” is not the same thing as teaching.  Words are, after all, just symbols we use to represent thoughts and actions.  Without the actual concepts behind the words, words are meaningless.&lt;/p&gt;

&lt;p&gt;With my 2-year-old, a mistake I made was trying to use too much vocabulary (ex: “you need to tell me when you need to use the potty”) when he hadn’t gotten the actual concept (connecting a feeling to an action) down yet.   Once I instead focused on limiting my use of vocabulary and SHOWING him what I wanted him to do, I saw a night-and-day difference in his understanding.&lt;/p&gt;

&lt;p&gt;This doesn’t mean technical terms aren’t important.  It &lt;strong&gt;does&lt;/strong&gt; mean that the technical jargon shouldn’t be the only thing we’re teaching.  I’d argue that in most cases, technical terms shouldn’t even be the first thing we teach.  If we effectively teach the &lt;em&gt;how&lt;/em&gt;, the &lt;em&gt;what&lt;/em&gt; can come so much more easily afterward.  &lt;/p&gt;

&lt;p&gt;&lt;em&gt; But Shaundai - how can I teach technical concepts without starting with the technical terminology?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Here's an example explaining how heat is transferred from one object to another:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Jargon Last&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Let’s say you’re cooking food on the stove in a big pot.  A metal spoon is sitting inside the pot.  When you touch the spoon, you realize that it’s hot.  The pot is warmed by the fire on the stove, but how did the spoon get hot?  This happens through &lt;b&gt;convection&lt;/b&gt;, where the solid spoon is warmed by the hotter solid pot it is touching.  This is 1 of 3 methods of &lt;b&gt;heat transfer&lt;/b&gt; between objects.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The two technical terms I wanted you to learn were “convection” and “heat transfer”.  Both came later in the paragraph, &lt;strong&gt;after&lt;/strong&gt; I’d described a scenario you were familiar with.  What if I instead gave you the definitions upfront?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Jargon First&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;&lt;b&gt;Convection&lt;/b&gt; is the movement caused within a fluid by the tendency of hotter and therefore less dense material to rise, and colder, denser material to sink under the influence of gravity, which consequently results in &lt;b&gt;heat transfer&lt;/b&gt;.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Most people would check out after reading the first few words.  Instead of putting such a strong emphasis on teaching the technical terms, put an emphasis on teaching the concepts and what the code is &lt;em&gt;doing&lt;/em&gt;.  The jargon can always be injected at the end.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;I'm currently build a course - TypeScript for JavaScript Developers&lt;/em&gt;!  &lt;b&gt;Sign up for updates &lt;a href="https://www.tsforjs.com" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;...or find me on &lt;a href="https://twitter.com/shaundai" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>todayilearned</category>
      <category>techtalks</category>
      <category>devjournal</category>
    </item>
    <item>
      <title>State and setState Explained with Emotion</title>
      <dc:creator>Shaundai Person</dc:creator>
      <pubDate>Mon, 03 May 2021 18:24:31 +0000</pubDate>
      <link>https://dev.to/shaundai/state-and-setstate-explained-with-emotion-110k</link>
      <guid>https://dev.to/shaundai/state-and-setstate-explained-with-emotion-110k</guid>
      <description>&lt;p&gt;&lt;em&gt;This article is part of a React Family series inspired by my conversation with Jason Lengstorf on &lt;a href="https://www.learnwithjason.dev/functional-react-with-styled-components" rel="noopener noreferrer"&gt;this episode of Learn with Jason&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Cover photo by &lt;a href="https://unsplash.com/@tengyart?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Tengyart&lt;/a&gt; on &lt;a href="https://unsplash.com/s/photos/emotion?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Unsplash&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In this example, we have three React components.  One, &lt;code&gt;&amp;lt;Mom /&amp;gt;&lt;/code&gt; is, of course, the parent component.  The others are children of &lt;code&gt;&amp;lt;Mom /&amp;gt;&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;Toddler /&amp;gt;&lt;/code&gt; and&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;Teen /&amp;gt;&lt;/code&gt;.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Mom&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="mi"&gt;2&lt;/span&gt; 
&lt;span class="mi"&gt;3&lt;/span&gt;   &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
&lt;span class="mi"&gt;4&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="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="mi"&gt;5&lt;/span&gt;       &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Toddler&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="mi"&gt;6&lt;/span&gt;       &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Teen&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="mi"&gt;7&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="mi"&gt;8&lt;/span&gt;   &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="mi"&gt;9&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These components don't do or show anything just yet, but using this small React family, we'll see how &lt;code&gt;state&lt;/code&gt; can be set and passed between &lt;del&gt;family members&lt;/del&gt; components.&lt;/p&gt;

&lt;h2&gt;
  
  
  State at a High Level
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;State&lt;/code&gt;, like &lt;code&gt;props&lt;/code&gt;,  is an object containing information used to determine what's rendered by your React app.  This could be anything, from colors to a tally to whether a modal should currently be displayed on the page or hidden from view.  React &lt;code&gt;state&lt;/code&gt;, in this example, is going to be the &lt;em&gt;emotional state&lt;/em&gt; of our components.&lt;/p&gt;

&lt;p&gt;Unlike &lt;code&gt;props&lt;/code&gt;, &lt;code&gt;state&lt;/code&gt; is managed within the component it lives on.  By contrast, &lt;code&gt;props&lt;/code&gt; is set and managed &lt;em&gt;outside&lt;/em&gt; of the component, then passed &lt;em&gt;into&lt;/em&gt; the component using it.&lt;/p&gt;

&lt;p&gt;State should always live on the highest-order component that’s involved in its use.  There are two reasons for this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;State-setting functions can only be used to set &lt;code&gt;state&lt;/code&gt; for either (1) the component that holds the function or for (2) one of its parents.  A parent, or higher-order component, cannot have a set &lt;code&gt;state&lt;/code&gt; that lives on a child component.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;State&lt;/code&gt; can be passed from parent to child (via props), information about state can be passed from child to parent (via state-setting functions), but information can only be passed from sibling-to-sibling by going through the parent (via a combination of state-setting functions and props).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We’ll explore these in further detail, but for now just understand that in our case state will need to live on &lt;code&gt;&amp;lt;Mom /&amp;gt;&lt;/code&gt; because she is the highest-order component involved in using our &lt;code&gt;state&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;When a React component is rendered, it uses &lt;code&gt;state&lt;/code&gt;'s initial value.  This value could be any Javascript data type or structural type including null, undefined, 0, or just a blank value (like an empty string).  In our example, our parent component &lt;code&gt;&amp;lt;Mom /&amp;gt;&lt;/code&gt; has an initial state of string ‘happy’.  We set the initial state to &lt;code&gt;happy&lt;/code&gt; using the &lt;code&gt;useState&lt;/code&gt; hook and render it in the DOM using JSX on line 9 below.&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="mi"&gt;1&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Mom&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="mi"&gt;2&lt;/span&gt; 
&lt;span class="mi"&gt;3&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;emotion&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setEmotion&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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;happy&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="mi"&gt;4&lt;/span&gt; 
&lt;span class="mi"&gt;5&lt;/span&gt;   &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
&lt;span class="mi"&gt;6&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="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="mi"&gt;7&lt;/span&gt;       &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Toddler&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="mi"&gt;8&lt;/span&gt;       &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Teen&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="mi"&gt;9&lt;/span&gt;        &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;emotion&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="c1"&gt;//happy&lt;/span&gt;
&lt;span class="mi"&gt;10&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="mi"&gt;11&lt;/span&gt;   &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="mi"&gt;12&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Setting State
&lt;/h2&gt;

&lt;h4&gt;
  
  
  &lt;b&gt;&lt;em&gt;Components setting their own state&lt;/em&gt;&lt;/b&gt;
&lt;/h4&gt;

&lt;p&gt;Just like your emotional state, React &lt;code&gt;state&lt;/code&gt; can be changed and maintained by a trigger (a function).  In class components, these functions would be called setState functions.  We’ll be using React Hooks, so our function can be called whatever we want to call it.  Common convention is to call it &lt;code&gt;set + WhateverTheFunctionDoes&lt;/code&gt;.   Anytime &lt;code&gt;state&lt;/code&gt; is changed, the component is re-rendered.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;Mom /&amp;gt;&lt;/code&gt; can hold these functions to update her own state, as below. &lt;code&gt;handleMeditation()&lt;/code&gt; changes &lt;code&gt;&amp;lt;Mom /&amp;gt;&lt;/code&gt;’s &lt;code&gt;state&lt;/code&gt; to &lt;code&gt;‘calm’&lt;/code&gt;.  When a user clicks the button we've added to lines 13-15, &lt;code&gt;setEmotion&lt;/code&gt; is triggered and our &lt;code&gt;state&lt;/code&gt; of &lt;code&gt;emotion&lt;/code&gt; is changed to &lt;code&gt;calm.&lt;/code&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="mi"&gt;1&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Mom&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="mi"&gt;2&lt;/span&gt; 
&lt;span class="mi"&gt;3&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;emotion&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setEmotion&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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;happy&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="mi"&gt;4&lt;/span&gt; 
&lt;span class="mi"&gt;5&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;handleMeditation&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="mi"&gt;6&lt;/span&gt;   &lt;span class="nf"&gt;setEmotion&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;calm&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="mi"&gt;7&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="mi"&gt;8&lt;/span&gt; 
&lt;span class="mi"&gt;9&lt;/span&gt;  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
&lt;span class="mi"&gt;10&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="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="mi"&gt;11&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Toddler&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="mi"&gt;12&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Teen&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="mi"&gt;13&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;handleMeditation&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="mi"&gt;14&lt;/span&gt;         &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;emotion&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;  &lt;span class="c1"&gt;//changes to 'calm' once button is clicked&lt;/span&gt;
&lt;span class="mi"&gt;15&lt;/span&gt;       &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="mi"&gt;16&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="mi"&gt;17&lt;/span&gt;   &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="mi"&gt;18&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;b&gt;&lt;em&gt;Passing information from parent to child&lt;/em&gt;&lt;/b&gt;
&lt;/h4&gt;

&lt;p&gt;From here, &lt;code&gt;&amp;lt;Mom /&amp;gt;&lt;/code&gt; can pass her &lt;em&gt;emotional state&lt;/em&gt; on to her children 😃 as props.  &lt;code&gt;&amp;lt;Toddler /&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;Teen /&amp;gt;&lt;/code&gt; will both get passed the initial props of &lt;code&gt;happy&lt;/code&gt;.  Any time &lt;code&gt;&amp;lt;Mom /&amp;gt;&lt;/code&gt;’s state changes, the &lt;em&gt;emotional state&lt;/em&gt; of the children will be updated to match &lt;code&gt;&amp;lt;Mom /&amp;gt;&lt;/code&gt;’s.&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="mi"&gt;1&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Mom&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="mi"&gt;2&lt;/span&gt; 
&lt;span class="mi"&gt;3&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;emotion&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setEmotion&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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;happy&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="mi"&gt;4&lt;/span&gt; 
&lt;span class="mi"&gt;5&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;handleMeditation&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="mi"&gt;6&lt;/span&gt;   &lt;span class="nf"&gt;setEmotion&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;calm&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="mi"&gt;7&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="mi"&gt;8&lt;/span&gt; 
&lt;span class="mi"&gt;9&lt;/span&gt;  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
&lt;span class="mi"&gt;10&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="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="c1"&gt;//initial props value of 'happy' changes to 'calm' in Toddler and Teen once button is clicked&lt;/span&gt;
&lt;span class="mi"&gt;11&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Toddler&lt;/span&gt; &lt;span class="nx"&gt;emotion&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;emotion&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="mi"&gt;12&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Teen&lt;/span&gt; &lt;span class="nx"&gt;emotion&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;emotion&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="mi"&gt;13&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;handleMeditation&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="mi"&gt;14&lt;/span&gt;         &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;emotion&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;  &lt;span class="c1"&gt;//changes to 'calm' once button is clicked&lt;/span&gt;
&lt;span class="mi"&gt;15&lt;/span&gt;       &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="mi"&gt;16&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="mi"&gt;17&lt;/span&gt;   &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="mi"&gt;18&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;b&gt;&lt;em&gt;Passing information from child to parent&lt;/em&gt;&lt;/b&gt;
&lt;/h4&gt;

&lt;p&gt;State-setting functions can also be passed down to children as &lt;code&gt;props&lt;/code&gt;.  If a child has access to any trigger - or function - that is paired with &lt;code&gt;&amp;lt;Mom /&amp;gt;&lt;/code&gt;’s state, the child thus has the ability to manipulate &lt;code&gt;&amp;lt;Mom /&amp;gt;&lt;/code&gt;’s - or the parent component’s - &lt;code&gt;state&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Let’s say that &lt;code&gt;&amp;lt;Mom /&amp;gt;&lt;/code&gt; has a different handler function called &lt;code&gt;handleTemperTantrum()&lt;/code&gt;.  &lt;code&gt;&amp;lt;Mom /&amp;gt;&lt;/code&gt; passes this function to child &lt;code&gt;&amp;lt;Toddler /&amp;gt;&lt;/code&gt; as a prop:&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="mi"&gt;1&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Mom&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="mi"&gt;2&lt;/span&gt; 
&lt;span class="mi"&gt;3&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;emotion&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setEmotion&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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;happy&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="mi"&gt;4&lt;/span&gt; 
&lt;span class="mi"&gt;5&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;handleTemperTantrum&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="mi"&gt;6&lt;/span&gt;   &lt;span class="nf"&gt;setEmotion&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;annoyed&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="mi"&gt;7&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="mi"&gt;8&lt;/span&gt; 
&lt;span class="mi"&gt;9&lt;/span&gt;  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
&lt;span class="mi"&gt;10&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="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="mi"&gt;11&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Toddler&lt;/span&gt; &lt;span class="nx"&gt;handleTemperTantrum&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;handleTemperTantrum&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="mi"&gt;12&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Teen&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="mi"&gt;13&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="mi"&gt;14&lt;/span&gt;   &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="mi"&gt;15&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, &lt;code&gt;&amp;lt;Toddler /&amp;gt;&lt;/code&gt; has the ability to &lt;del&gt;manipulate&lt;/del&gt; update and manage &lt;code&gt;&amp;lt;Mom /&amp;gt;&lt;/code&gt;’s state on its own!  &lt;code&gt;&amp;lt;Toddler /&amp;gt;&lt;/code&gt; uses this function to change &lt;code&gt;&amp;lt;Mom /&amp;gt;&lt;/code&gt;’s state to 'annoyed' any time the button on lines 4-6 is clicked.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Toddler Component&lt;/b&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="mi"&gt;1&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Toddler&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="nx"&gt;handleTemperTantrum&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="mi"&gt;2&lt;/span&gt; 
&lt;span class="mi"&gt;3&lt;/span&gt;  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
&lt;span class="mi"&gt;4&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;handleTemperTantrum&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="mi"&gt;5&lt;/span&gt;      
&lt;span class="mi"&gt;6&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;   &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="mi"&gt;8&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This button does not actually display anything except an empty button, though.  Since the actual &lt;code&gt;state&lt;/code&gt; of &lt;code&gt;emotion&lt;/code&gt; still lives on &lt;code&gt;&amp;lt;Mom /&amp;gt;&lt;/code&gt;, we'll need to pass &lt;code&gt;emotion&lt;/code&gt; down to her child.  In fact, since parents can pass state down to any children as &lt;code&gt;props&lt;/code&gt;, we can pass &lt;code&gt;annoyed&lt;/code&gt; to both &lt;code&gt;&amp;lt;Toddler /&amp;gt;&lt;/code&gt; &lt;em&gt;and&lt;/em&gt; &lt;code&gt;&amp;lt;Teen /&amp;gt;&lt;/code&gt; as props for them to use.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Mom Component:&lt;/b&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="mi"&gt;1&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Mom&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="mi"&gt;2&lt;/span&gt; 
&lt;span class="mi"&gt;3&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;emotion&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setEmotion&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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;happy&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="mi"&gt;4&lt;/span&gt; 
&lt;span class="mi"&gt;5&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;handleTemperTantrum&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="mi"&gt;6&lt;/span&gt;   &lt;span class="nf"&gt;setEmotion&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;annoyed&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="mi"&gt;7&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="mi"&gt;8&lt;/span&gt; 
&lt;span class="mi"&gt;9&lt;/span&gt;  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
&lt;span class="mi"&gt;10&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="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="mi"&gt;11&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Toddler&lt;/span&gt; &lt;span class="nx"&gt;handleTemperTantrum&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;handleTemperTantrum&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="nx"&gt;emotion&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;emotion&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="mi"&gt;12&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Teen&lt;/span&gt; &lt;span class="nx"&gt;emotion&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;emotion&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="mi"&gt;13&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="mi"&gt;14&lt;/span&gt;   &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="mi"&gt;15&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;b&gt;Toddler Component:&lt;/b&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="mi"&gt;1&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Toddler&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="nx"&gt;handleTemperTantrum&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;emotion&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="mi"&gt;2&lt;/span&gt; 
&lt;span class="mi"&gt;3&lt;/span&gt;  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
&lt;span class="mi"&gt;4&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;handleTemperTantrum&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="mi"&gt;5&lt;/span&gt;      &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;emotion&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="c1"&gt;//now this will say 'calm', or will change to 'annoyed' once this button is clicked&lt;/span&gt;
&lt;span class="mi"&gt;6&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;   &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="mi"&gt;8&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Any time &lt;code&gt;&amp;lt;Mom /&amp;gt;&lt;/code&gt;’s state is updated, &lt;code&gt;&amp;lt;Toddler /&amp;gt;&lt;/code&gt;s and &lt;code&gt;&amp;lt;Teen /&amp;gt;&lt;/code&gt;s emotional states are updated accordingly.&lt;/p&gt;

&lt;p&gt;State-setting functions can either live on the component that the state lives on, or on one of its children.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;b&gt;&lt;em&gt;Passing information from sibling to sibling&lt;/em&gt;&lt;/b&gt;
&lt;/h4&gt;

&lt;p&gt;Siblings can pass state between one another, but they have to do it through their common parent.  Just as we did in the last example, &lt;code&gt;&amp;lt;Toddler /&amp;gt;&lt;/code&gt; can pass state to &lt;code&gt;&amp;lt;Teen /&amp;gt;&lt;/code&gt; using this workflow:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;Toddler /&amp;gt;&lt;/code&gt; has the &lt;code&gt;setTemperTantrum()&lt;/code&gt; function, which manages and updates the &lt;code&gt;state&lt;/code&gt; that lives on &lt;code&gt;&amp;lt;Mom /&amp;gt;&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;Toddler /&amp;gt;&lt;/code&gt; sets &lt;code&gt;&amp;lt;Mom /&amp;gt;&lt;/code&gt;’s state to &lt;code&gt;annoyed&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;Mom /&amp;gt;&lt;/code&gt; passes &lt;code&gt;annoyed&lt;/code&gt; as a prop to &lt;code&gt;&amp;lt;Teen /&amp;gt;&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;Teen /&amp;gt;&lt;/code&gt; accepts emotion as a prop.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Find me on &lt;a href="https://twitter.com/shaundai" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt; or &lt;a href="https://www.linkedin.com/in/shaundai/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>codenewbie</category>
      <category>react</category>
      <category>javascript</category>
      <category>functional</category>
    </item>
    <item>
      <title>Using LocalHost for Mobile Development</title>
      <dc:creator>Shaundai Person</dc:creator>
      <pubDate>Sat, 09 Jan 2021 22:01:01 +0000</pubDate>
      <link>https://dev.to/shaundai/using-localhost-for-mobile-development-1k4g</link>
      <guid>https://dev.to/shaundai/using-localhost-for-mobile-development-1k4g</guid>
      <description>&lt;h4&gt;
  
  
  &lt;em&gt;This short tutorial is for Mac users&lt;/em&gt;
&lt;/h4&gt;

&lt;p&gt;You may have known Chrome DevTools enables you to test the look and feel of your web application on differently-sized devices, but did you know that you can &lt;em&gt;also&lt;/em&gt; use run localhost on any device that can connect to the internet?  As you run localhost:3000 (or whichever port) on your local machine, your phone and tablets can run your program in real time for developing and testing on mobile.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;b&gt;Why is this important?&lt;/b&gt;
&lt;/h3&gt;

&lt;p&gt;The Chrome DevTools Device Toolbar is a great tool that saves a lot of time, but it’s not perfect.  After deploying my personal website for example, I was surprised to find that the version of my site I saw in my iPhone’s browser looked quite different from the local DevTools version I’d spent hours with, tweaking media query after media query.  When I later pulled up my site on my monitor’s wide screen, I discovered that I’d never &lt;em&gt;actually&lt;/em&gt; accounted for screens wider than the 13” laptop that I’d been programming on, either.&lt;/p&gt;

&lt;p&gt;To avoid these types of glitches and UI/UX bugs &lt;em&gt;before&lt;/em&gt; deploying for the whole world to see (ideal, right?), it’s essential to test your app on physical devices of different sizes.  One cool thing about running localhost from your mobile device is that, just like with localhost on your computer, you can see realtime changes to your app &lt;b&gt;&lt;em&gt;as you code&lt;/em&gt;&lt;/b&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;b&gt;The How-To &lt;em&gt;(for Mac users)&lt;/em&gt;:&lt;/b&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;b&gt;(1) Run your program on your Mac’s localhost&lt;/b&gt;&lt;br&gt;
Make sure your program is running on localhost.  When you go to the localhost port you’re running (ex. localhost:3000), the current version of your app in development should be visible.&lt;/p&gt;

&lt;p&gt;Take note of the port you are using.  Common port numbers are &lt;em&gt;3000, 3001, 8000&lt;/em&gt;, or &lt;em&gt;8080&lt;/em&gt;.  You can find the port number in your URL bar after “localhost:”  In this instance, my localhost port is &lt;b&gt;&lt;em&gt;port 3000&lt;/em&gt;&lt;/b&gt;.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;(2) Find the IP address of your Mac&lt;/b&gt;&lt;br&gt;
Here, we want to find the IP address of the Mac running localhost.  To find the IP address, start by clicking the apple logo in the top left corner of your Mac to open the dropdown menu.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F0vfoaj9p6jd19ve8mwf3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F0vfoaj9p6jd19ve8mwf3.png" alt="Apple menu dropdown" width="664" height="698"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Choose &lt;b&gt;System Preferences&lt;/b&gt; from the menu to open up your System Preferences.&lt;/p&gt;

&lt;p&gt;Next, choose &lt;b&gt;Network&lt;/b&gt; from the list of options in &lt;b&gt;System Preferences&lt;/b&gt;.  Your Network App should open up.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fl31erwdck5pt6dwmxzo6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fl31erwdck5pt6dwmxzo6.png" alt="System Preferences menu with Network App highlighted" width="800" height="705"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Your IP address will be in the middle box on the right, under &lt;b&gt;Status&lt;/b&gt;.  Underneath your network's status, find the sentence telling you the wi-fi network you're connected to and your IP address.  In my case, the IP address is &lt;b&gt;&lt;em&gt;123.45.6.08&lt;/em&gt;&lt;/b&gt; .  Take note of the IP address because we will need it for the final step.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ffbp2d0k1n84yxsxy2is7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ffbp2d0k1n84yxsxy2is7.png" alt="Network page in mac shows IP address under status section" width="800" height="692"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;(3) Connect your mobile device to the same wi-fi network as your Mac&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;If this isn’t already the case.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;(4) Open localhost on your mobile device&lt;/b&gt;&lt;br&gt;
In the URL bar in your phone, go to&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;http://{your-IP-address}:{your-port-number}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In my case, I’d put this into the URL bar:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;http://123.45.6.08:3000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you should see your app locally on your mobile device.  Now go build something great!&lt;/p&gt;

&lt;p&gt;Connect with me on &lt;a href="https://www.twitter.com/shaundai" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt; and on &lt;a href="https://www.linkedin.com/in/shaundai" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>codenewbie</category>
      <category>webdev</category>
      <category>mobile</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>One Thing That Made My Job Application Stand Out</title>
      <dc:creator>Shaundai Person</dc:creator>
      <pubDate>Thu, 31 Dec 2020 21:36:43 +0000</pubDate>
      <link>https://dev.to/shaundai/one-thing-that-made-my-job-application-stand-out-3dik</link>
      <guid>https://dev.to/shaundai/one-thing-that-made-my-job-application-stand-out-3dik</guid>
      <description>&lt;h4&gt;
  
  
  &lt;b&gt; TL;DR: it’s video. Video is the one thing. &lt;/b&gt;
&lt;/h4&gt;

&lt;p&gt;I moved into software engineering after 12 years in a non-technical career.  I’m a self-taught developer; the most formal software training I’ve got under my belt is the 3/4 of the Codecademy Pro web development track I completed.&lt;/p&gt;

&lt;p&gt;When it came to applying for engineering roles, my biggest concern was getting my resume to stand out.  These days, companies have the advantage of a huge pool of qualified candidates to fill a small number of roles; I knew I’d be up against dozens of others competing for the same spot and many other applicants likely had better experience or more relevant education.  Though I felt confident that my 1 ½ years of building projects earned me the skills to make a great Junior, the tricky part would be convincing hiring managers to also see what I saw in myself.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;b&gt;Using what I knew&lt;/b&gt;
&lt;/h4&gt;

&lt;p&gt;The previous 12 years of my career were spent in sales, cold calling and emailing people who’d never heard of me or my company to ask them for tens of thousands of dollars.  The trickiest part in prospecting was standing out from other sellers and from the rest of the noise in my prospects’ inboxes.  Once I finally got the prospect’s attention, I needed to deliver a compelling message that was interesting enough to get them to take another call with me.  Then another call, then another call, and so on, until I got the signed contract.&lt;/p&gt;

&lt;p&gt;How is all of this relevant to applying for jobs, you ask?  Well, applying for jobs &lt;em&gt;is&lt;/em&gt; a form of prospecting!  In both cases you’re trying to stand out from the competition, get the attention of someone who’s never met you, show enough value so that they are interested in having a conversation with you, and then once you’ve sold them on the conversation, get them - in a very short span of time - to trust you enough to bet on you.&lt;/p&gt;

&lt;p&gt;Okay so here’s the point of this post - you don’t have to be a stellar salesperson to get the attention of recruiters.  I’m going to tell you about the one game-changing prospecting tactic that I attribute to my success in switching careers.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;b&gt;Why video?&lt;/b&gt;
&lt;/h4&gt;

&lt;p&gt;Using video in prospecting can increase reply rates by 25%.  Video helps to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Establish a human connection between you and the recipient&lt;/li&gt;
&lt;li&gt;Cause the recipient to become familiar with and comfortable with you&lt;/li&gt;
&lt;li&gt;Make you noticeable and memorable&lt;/li&gt;
&lt;li&gt;Convey emotion and context that is difficult to derive from written text&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;…in other words, video gives you the ability to STAND OUT!&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;b&gt;Types&lt;/b&gt;
&lt;/h4&gt;

&lt;p&gt;Two types of videos work best when it comes to job applications:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;&lt;b&gt;Project Demos:&lt;/b&gt;&lt;/em&gt; short overview video of a project in your portfolio.  You may or may not be on camera.  In this video, you’ll walk through your completed project (not the code).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;&lt;b&gt;Introduction Videos:&lt;/b&gt;&lt;/em&gt; short video introducing yourself, talking about your professional accomplishments and personal interests, and explaining why you are a fit for the role (think cover letter, but in video form).  You’ll be on camera for this one.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fpl7e4szyitmrhr80nj1y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fpl7e4szyitmrhr80nj1y.png" alt="Email to hiring manager with video embedded in body" width="800" height="849"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;b&gt;Tips for good video&lt;/b&gt;
&lt;/h3&gt;

&lt;p&gt;Keep in mind that you don't need to spend a lot of time making these videos.  If you find yourself working for hours on editing and adding special effects, you’re doing too much!  In fact, videos that look too marketing-y (yeah, I said it) can actually leave a negative impression on the hiring manager.  Remember, the goal is to show you – the authentic, real, human you.  Once you’ve completed your portfolio project, designate a half hour max to making the demo video.  This includes writing up bullet points about what you want to talk about, practicing, and recording.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;b&gt;Length&lt;/b&gt;
&lt;/h4&gt;

&lt;p&gt;Learned this from my marketing friends – it’s important to keep the length &lt;em&gt;down&lt;/em&gt;.  Demo videos should be no more than 2 minutes but the shorter, the better.  If you’re like me, you may find yourself thinking “there’s no way this video will be longer than 40 seconds” only to realize you’ve recorded a 5 min 26 second intro!  Keep it short and sweet to avoid losing the attention of your audience. &lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;b&gt;Location&lt;/b&gt;
&lt;/h4&gt;

&lt;p&gt;When using the videos in an email, stick the video in the body of the email - not as an attachment or link.  We want to put the fewest number of clicks between the recipient and the actual video in order to make it easy for him/her to access.  Links and attachments are also too easy to overlook; including the video in the body of the email prevents the hiring manager from accidentally missing your video entirely.   If you &lt;em&gt;have&lt;/em&gt; to use a link, make sure to draw attention to it using bold, capitalized text that clearly draws attention to the fact that it’s a &lt;b&gt;SHORT PRODUCT DEMO VIDEO&lt;/b&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;b&gt;“…but I’m filling out applications on the company website.  Where should I put my videos?”&lt;/b&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I get it - for most of the jobs you’ll be applying for you’ll be applying using a form on a website.  There may not necessarily be somewhere to stick the videos (like in an email).  Some ideas:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Oftentimes, there is an additional field for “attachments” where you can stick your CV and other relevant materials to your application.  Attach your video to your application here.&lt;/li&gt;
&lt;li&gt;If you’ve put together an online portfolio, embed the demo videos on your portfolio page.&lt;/li&gt;
&lt;li&gt;For the top 5-10 companies you’re applying to, use LinkedIn or on the company website to find out who the hiring manager is and email them directly (video included, of course).
Include a demo video in a message the day before the interview telling them how excited you are for the upcoming interview and that you wanted to send along a demo you made them of a project that showcases your skills in (insert skill relevant to role).&lt;/li&gt;
&lt;li&gt;After the interview, include a demo video in a thank you email.  Or, use a video as your thank you email.  Send a recording of you thanking the interviewer for their time and re-iterating why you’re a perfect fit for the role.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  &lt;b&gt;Sound human&lt;/b&gt;
&lt;/h4&gt;

&lt;p&gt;Given that we only have a couple of minutes to convey our message, it’s important to sound both interesting and human.    Have fun with it!  It’s okay to stumble on your words a bit (all part of being human).  If you consider yourself a novice when it comes to public speaking, practice using a relaxing tempo and voice inflections that make you sound interested in the product you’re demonstrating.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;b&gt;Get in the user’s shoes&lt;/b&gt;
&lt;/h4&gt;

&lt;p&gt;As a seller, this is the one that’s nearest and dearest to my heart (and probably the most important).  Talk about the value of your portfolio project from the user’s perspective.  You don’t need to answer every single one of these questions in the video, but here are some ideas of ways to get into the user’s shoes?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What problem is your project solving?&lt;/li&gt;
&lt;li&gt;In what ways does this feature make something easier or better for the people using it?&lt;/li&gt;
&lt;li&gt;What did you put in the app to make it a product that your users will want to use?&lt;/li&gt;
&lt;li&gt;What considerations did you make for other people who might be working with you on this project if it were for a company?&lt;/li&gt;
&lt;li&gt;
&lt;b&gt;&lt;em&gt;Intro&lt;/em&gt;&lt;/b&gt; videos - why &lt;em&gt;you&lt;/em&gt; for this role? What do you like about this company? What can you bring to the table?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let’s say you’ve built a weather-forecasting app that you want to showcase through video.  You used aria-labels, color contrast, and gentle transitions that make your app more accessible.  In your video, make sure to call out how you put some serious thought into accessibility because you know how important it is for apps to be accessible to all.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;b&gt;Software (free): &lt;/b&gt;
&lt;/h4&gt;

&lt;p&gt;There are lots of great free options, but my favorites are &lt;a href="https://www.vidyard.com/" rel="noopener noreferrer"&gt;Vidyard&lt;/a&gt; and &lt;a href="https://obsproject.com/" rel="noopener noreferrer"&gt;OBS&lt;/a&gt;.  What I like about Vidyard is that you can see when someone has watched your video.  OBS is better if you’re trying to do more cutting and editing (probably overkill for a demo video, but a great option for introduction videos).&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;b&gt;Other video quick tips&lt;/b&gt;
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Watch for “Crazy Mouse” – limit the shaky, jarring mouse movement&lt;/li&gt;
&lt;li&gt;Use Animated Thumbnails or Gifs in your email to draw attention to your video&lt;/li&gt;
&lt;li&gt;Keep in mind that most emails these days (yes, even work emails) are read from mobile devices.  It’s best to put some text before your video, but limit it to 200-400 characters that include an eye-catching first sentence.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Have you used video in a job application? What other tips would you add?&lt;/p&gt;

&lt;p&gt;Connect with me on &lt;a href="https://www.twitter.com/shaundai" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt; and on &lt;a href="https://www.linkedin.com/in/shaundai" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>codenewbie</category>
      <category>career</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>5 Traits of Good Developers</title>
      <dc:creator>Shaundai Person</dc:creator>
      <pubDate>Thu, 24 Dec 2020 02:47:38 +0000</pubDate>
      <link>https://dev.to/shaundai/5-traits-of-good-developers-e00</link>
      <guid>https://dev.to/shaundai/5-traits-of-good-developers-e00</guid>
      <description>&lt;p&gt;I hate to admit it but certain stereotypes about developers kept me from even considering a career in programming for decades.  I thought the same way that many people outside of tech still think - &lt;b&gt;software engineering isn’t a field I’d ever be able to get into because developers must [insert stereotype of choice: have CS degrees from top universities, be terrible in social situations, know how to program FPGA chips at birth, etc].&lt;/b&gt;  &lt;/p&gt;

&lt;p&gt;I’m here to tell you that many of those entry-blocking stereotypes are invalid.  In fact, common traits of the best developers are traits that you likely already have!  Put plainly, you &lt;del&gt;can&lt;/del&gt; will be an amazing developer, even without that advanced degree in trigonometry.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;b&gt;(1) You Love to Learn&lt;/b&gt;
&lt;/h4&gt;

&lt;p&gt;Even at the most senior levels of engineering, you’ll never be expected to know everything.  With so much information out there and with technologies changing and evolving every day, it’s impossible to know it all.  No matter how long you’ve been in the software game there will always be more to learn: more programming languages to master, newer techniques to try, better ways to collaborate with others.&lt;/p&gt;

&lt;p&gt;The best developers are the ones who embrace the change and who continually seek new opportunities to learn.  These individuals adapt more quickly, develop and hone a broader range of skills, and are able to think more creatively.  For these reasons, developers who love to learn also tend to enjoy their work more.  And who doesn’t want to be happier at work?&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;b&gt;(2) You Like Puzzles&lt;/b&gt;
&lt;/h4&gt;

&lt;p&gt;A common misconception is that all software engineers are good at math.  The truth is that most areas of software engineering don’t require math skills at all.  What they &lt;em&gt;do&lt;/em&gt; require is the ability to solve puzzles.&lt;/p&gt;

&lt;p&gt;If you consider yourself the type of person who likes puzzles - whether you prefer jigsaw puzzles, logic problems, or you’re great at figuring out the ending of mystery movies midway through the film - you have a key trait common with the best developers.  Coding - like puzzles - requires use of both sides of your brain (the left side for analytic thinking and the right for creativity) to answer questions like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Why did this break?&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;How can I get this to work?&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;How can I make this happen using the skills/tools available to me now?&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Why did this break?&lt;/em&gt; (yeah, I know this is on here twice but it happens a &lt;em&gt;lot&lt;/em&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Writing code &lt;em&gt;is&lt;/em&gt; a puzzle with so many unique correct (and also incorrect) solutions.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fj2rkpdsylykpb54gtcdg.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fj2rkpdsylykpb54gtcdg.jpg" alt="Rubiks Cube" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;b&gt;(3) You’re Good at Recognizing Patterns&lt;/b&gt;
&lt;/h4&gt;

&lt;p&gt;If you like to solve puzzles, chances are that you’re also good at recognizing patterns.    Our human brains solve puzzles by looking for patterns among the information available to us.&lt;/p&gt;

&lt;p&gt;From the day you start learning to code, you’ll similarly use patterns to solve problems.  As you become more skilled, you’ll be able to quickly recognize problems similar to those you’ve encountered before and reuse code or similar solutions (aka software patterns) that work.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;b&gt;(4) You’re A Problem Solver&lt;/b&gt;
&lt;/h4&gt;

&lt;p&gt;Any developer will tell you that a great deal of time at work will be spent troubleshooting and debugging your code.  If you’re working with others, you’ll also need to fix errors in code you might only be seeing for the first time.  Your success depends on your resilience as well as your ability to break up big problems into smaller parts in order to find a solution.&lt;/p&gt;

&lt;p&gt;Debugging can be really frustrating - especially when you’re new.  Invest time in learning to use the developer console and debugging methods in the language(s) you are programming in.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;b&gt;(5) You're Good at Google&lt;/b&gt;
&lt;/h4&gt;

&lt;p&gt;I mentioned this before but as a developer, you’ll never know everything.  I’ll add that it’s impossible to retain all of that great knowledge you’ll be building at work.  Chances are, you’ll find yourself Googling things like &lt;em&gt;“what does git pull origin master mean”&lt;/em&gt; day after day.&lt;/p&gt;

&lt;p&gt;Believe it or not, efficient Googling is an important skill for developers.  No matter which programming language you use, Google (or whichever search engine you prefer) is going to be one of the most used tools in your tech stack throughout your entire career.  Knowing what to put in the search will save you LOTS of time that would otherwise be spent reading through pages and pages of Stack Overflow questions to find the answer you're &lt;em&gt;really&lt;/em&gt; looking for.&lt;/p&gt;

&lt;p&gt;Connect with me on &lt;a href="https://www.twitter.com/shaundai" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt; and on &lt;a href="https://www.linkedin.com/in/shaundai" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>career</category>
      <category>beginners</category>
      <category>codenewbie</category>
      <category>webdev</category>
    </item>
    <item>
      <title>5 Things I Learned by Asking Developers One Question</title>
      <dc:creator>Shaundai Person</dc:creator>
      <pubDate>Mon, 07 Dec 2020 02:49:12 +0000</pubDate>
      <link>https://dev.to/shaundai/5-things-i-learned-by-asking-developers-one-question-52h7</link>
      <guid>https://dev.to/shaundai/5-things-i-learned-by-asking-developers-one-question-52h7</guid>
      <description>&lt;p&gt;Breaking into engineering is no easy task.&lt;/p&gt;

&lt;p&gt;Over the past year, I’d gradually built the skills needed to transition from the only career I’ve ever known - sales - into UI engineering.    Prior to beginning this self-taught journey, I had no technical background &lt;em&gt;(uh, unless a basic working knowledge of Excel counts)&lt;/em&gt;!&lt;/p&gt;

&lt;p&gt;As a full-time working mom, I needed to be strategic about how I spent my time.  To make sure I was learning the right things and building the right stuff, I went to developers at all levels - from Junior to VP - and asked the same question: &lt;em&gt;As someone coming from a non-technical role - how can I make myself stand out?&lt;/em&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;(1) Yes, you &lt;em&gt;should&lt;/em&gt; build a portfolio&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Especially consider putting together a portfolio if you’re coming in at an entry level or switching to engineering from an otherwise non-traditional role &lt;em&gt;(like me)&lt;/em&gt;.  Don’t worry - you don’t need to spend months building a portfolio from scratch.  Host one easily using Github Pages or a website-generation platform like Wix or Squarespace.&lt;/p&gt;

&lt;p&gt;The most important part is being strategic about the &lt;em&gt;types&lt;/em&gt; of projects you put in your portfolio.  Remember that recruiters and hiring managers are looking through a lot of other portfolios like yours and when they get 200 applicants for one opening, they need to make tough decisions about how to narrow down the applicant pool.  Make your portfolio stand out:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Make it obvious which languages/frameworks you've used so they can see how your skills match the role you’re looking for.&lt;/li&gt;
&lt;li&gt;Narrow it down to 2-4 key projects that really show the breadth and depth of your skills and only include these in the portfolio.  There is no way a recruiter is going to look through all 25-30 of the projects from every single candidate who crosses their path.&lt;/li&gt;
&lt;li&gt;
&lt;b&gt;IMPORTANT:&lt;/b&gt; Go for "corporate-style" projects.  Yes, the random gif generators and random cat generators are adorable.  If you're applying to work at a corporation (or an agency that does work for corporations), the recruiter will want to see polished projects that aim to serve a business purpose.  &lt;em&gt;(Think fake client websites, clones of part of an existing platform like Twitter or Uber, or something that solves a problem in your everyday life)&lt;/em&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;(2) Build a network&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;You might be wondering why/if building a network is really important.&lt;/p&gt;

&lt;p&gt;First, being an employee referral increases your chances of getting the job by 10x.  That’s not all — building a network will help you to stay on top of new things going in the tech industry, meet potential mentors/mentees/advocates/hiring managers/etc, enhance the skills you'll need to level up your career, and keep you motivated during those tough times.&lt;/p&gt;

&lt;p&gt;For the introverts out there, I get it.  Networking can be pretty awkward and super stressful.  But it's a necessary evil and with practice, it will just get easier.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;(3) If you want to be a good frontend developer, you should learn at least a little about a backend framework&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Or vice versa.  While you’re at it, learn a little bit about design, too - especially if you want to freelance, work for a large company, or eventually move into management.  Your work as a dev will require you to understand requirements from someone who essentially is speaking a different language than you, then pass off your work to someone who uses &lt;em&gt;another&lt;/em&gt; language!&lt;/p&gt;

&lt;p&gt;Coming from the software sales world, I see how often devs get stuck in their own bubble and oftentimes don't even know how to use the product they're building!  They don't take the time to get a wholistic understanding of their product from the customer side, sales side, or even the design side.  You can make yourself stand out by understanding at least a little about what is going on over the fence and how the work you do will make an impact, or what you could do to make your colleagues' jobs easier.  Take a course in something new or talk with someone else who is in the role.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;(4) Several lines readable of code &amp;gt; one line of code that only you understand&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;This goes along with the last piece of advice.  Even if you don’t expect to be working on a team, remember that one day, you’ll need to read your own code again after not-having looked at it for several months.  Do your future self/future colleagues a favor and name your functions something like &lt;em&gt;formatPhoneNumber&lt;/em&gt; instead of &lt;em&gt;fixFon&lt;/em&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;(5)Talk about what you're working on (a LOT)&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;It’s YOUR JOB to make sure you’re putting your work in front of the people who need to see it.  Talk about what you’re working on (often) and show off your progress.  It’s a tough shift to make for people who - like me - were taught that tooting your own horn makes you braggy.  Here are some ways to put yourself out there without coming off as obnoxious:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Solve a problem/complete a project, then write a blog post about how you did it.  Share the blog post with an engineering manager and ask for feedback&lt;/li&gt;
&lt;li&gt;Commit to writing social media posts 3x week about the progress on your current project&lt;/li&gt;
&lt;li&gt;Invite engineers from your company or from meetups to talk 1:1 over coffee (or tea. or water.) Ask about their career journey and exciting projects they are working on.  Tell them what you're working on and ask for their feedback on current projects or your portfolio.&lt;/li&gt;
&lt;li&gt;Accept compliments by simply saying “thank you.”  This may sound like a no-brainer but for women in particular, we often meet compliments with fairly negative comments or we use it as an opportunity to give someone else credit for our work ("Well, without so-and-so, this would have never gotten done!" or "Oh, this was so stressful to do and I'm not really happy with the way it came out because...").  Just say thank you.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What advice would you give to developers trying to move into engineering from non-traditional roles?&lt;/p&gt;

&lt;p&gt;Connect with me on &lt;a href="https://www.twitter.com/shaundai" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt; and on &lt;a href="https://www.linkedin.com/in/shaundai" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>career</category>
      <category>beginners</category>
      <category>codenewbie</category>
      <category>webdev</category>
    </item>
    <item>
      <title>How to Switch to the Engineering Team at your Current Company</title>
      <dc:creator>Shaundai Person</dc:creator>
      <pubDate>Sat, 05 Dec 2020 23:07:44 +0000</pubDate>
      <link>https://dev.to/shaundai/how-to-switch-to-the-engineering-team-at-your-current-company-5goc</link>
      <guid>https://dev.to/shaundai/how-to-switch-to-the-engineering-team-at-your-current-company-5goc</guid>
      <description>&lt;p&gt;I started a sales role at &lt;a href="https://www.salesloft.com" rel="noopener noreferrer"&gt;SalesLoft&lt;/a&gt; when I moved to Atlanta, 11 years into a successful career in sales.  At the time, I had exactly 0 years of professional experience as a developer. (If you’re interested, &lt;a href="https://www.gatsbyjs.com/blog/voices-gatsby-shaundai-person/" rel="noopener noreferrer"&gt;check out this article about my decision to switch careers&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;A little over a year into my SalesLoft journey, I accepted an offer as a Junior UI Engineer.  The advice in this post is for anyone looking to make a similar switch.  Whether you’re coming from a non-traditional role or you're already pretty technical, here are some tips to moving into engineering without leaving your current company.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Side note: In this post, I mention "hiring manager" quite a bit.  I understand that in most cases, there is no open Junior position just yet.  The "hiring manager" is the person who - when your ideal position opens up and you get the job - will be your new manager.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Find a Mentor&lt;/p&gt;

&lt;p&gt;Find an Internal Advocate&lt;/p&gt;

&lt;p&gt;Go for Coffee&lt;/p&gt;

&lt;p&gt;Toot Your Own Horn&lt;/p&gt;

&lt;p&gt;Do a Good Job&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;a&gt;&lt;/a&gt;Find a Mentor
&lt;/h4&gt;

&lt;p&gt;A mentor:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Does not necessarily have to work at your company (but in this case, it’s better if he/she does)&lt;/li&gt;
&lt;li&gt;Is 1-3 levels above where you are in your career&lt;/li&gt;
&lt;li&gt;Works with you formally or informally on your career objectives&lt;/li&gt;
&lt;li&gt;Can work with you to discuss challenges in your code and help you get unstuck when you hit a problem&lt;/li&gt;
&lt;li&gt;Follows your lead.  You drive the relationship - deciding what to meet about, bringing forward questions that you have, facilitating times to meet, etc.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Remember that you can have more than one mentor.  In fact, I’ll just go ahead and say that you &lt;em&gt;should&lt;/em&gt; try and find more than one mentor.  Different mentors can help with different areas of your life.  For example, you may have a mentor for parenting, a mentor for becoming a better JavaScript developer, and an internal mentor at your company who helps you navigate your career as an engineer.&lt;/p&gt;

&lt;p&gt;Your relationship with your programming mentor doesn't have to be incredibly formal; you can choose to only meet when you have questions.  The important part of mentorship is to have a go-to person for your questions.  Your mentor doesn't need to have all the answers, but he/she can help you figure out where to go to find them.  They can help you determine which learning areas to focus on and which aren't worth your time.  In my case, sticking to a regular weekly meeting with my mentor also forced me to stay accountable for keeping up with my coding even when life got busy.  I didn't want to show up to our meeting "empty-handed" so I made sure to work on my projects or take part of a course during the week so that I had good questions to talk through when we met.&lt;/p&gt;

&lt;p&gt;Quick Tips:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Finding a mentor can be tough. It requires a huge investment of time from both sides.  Don't get discouraged if someone you want to be your mentor can't take it on because of other priorities.&lt;/li&gt;
&lt;li&gt;A good way to find a mentor is to invite people for coffee (see below) as a way to kind of "date" potential mentors and let a mentoring relationship naturally blossom when you find a good fit.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  &lt;a&gt;&lt;/a&gt;Find an Internal Advocate
&lt;/h4&gt;

&lt;p&gt;This person is likely a different person from your mentor, but it could be the same person.  An internal advocate will go to bat for you when you're not around.  They will get in front of the right people (and make sure that YOU'RE put in front of the right people) with the message that you rock and you would make a strong fit on your company's engineering team.  In addition, advocates will push you to advocate for yourself.  Here are some qualities of a good advocate:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Works for your company at a senior leadership or higher&lt;/li&gt;
&lt;li&gt;Provides you with helpful information about how to stand out at your organization&lt;/li&gt;
&lt;li&gt;Is trusted and respected by the people who make the hiring decisions on your engineering team&lt;/li&gt;
&lt;li&gt;If put in front of one of the people who make the hiring decision on your engineering team, is willing to speak on behalf of you&lt;/li&gt;
&lt;li&gt;Speaks highly of you (and often) when you're not around&lt;/li&gt;
&lt;li&gt;Pushes you to "toot your own horn," even when you feel shy/humble/nervous about it&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Quick tips:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Give him/her talking points! Make a point to regularly reach out to show them projects you're working on and ask for their feedback.  Ask: "If I were building this for (your_company_name_here or your_customer_name_here), what would I add?" "If I were working on this project with others, what kinds of things should I incorporate?" "Is this something you'd find useful? What would you change?"&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  &lt;a&gt;&lt;/a&gt;Go for coffee
&lt;/h4&gt;

&lt;p&gt;Invite someone from your engineering team out for coffee once a week.  I mean, it doesn't have to be coffee.  Could be tea.  Could be for a walk and talk over the phone.&lt;/p&gt;

&lt;p&gt;You've probably heard this before (and it's true!) - it's not always what you know, it's &lt;em&gt;WHO&lt;/em&gt; you know.  When it comes down to you vs another internal candidate, if more people on your engineering team already know you and start to see you as a natural fit for the team, they are going to advocate for YOU to be the next engineering hire.  When it comes time for the technical interview, you'll probably be interviewing with someone you've already won over with your coffee and conversation months before.&lt;/p&gt;

&lt;p&gt;Quick tips:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Spread the love to different people.  Make it a goal to meet with 2 new people each month.&lt;/li&gt;
&lt;li&gt;Plan a few questions beforehand so that you have something to talk about.  People love talking about themselves, so here are a few good conversation-starters:

&lt;ul&gt;
&lt;li&gt;Tell me about your journey into tech/engineering.&lt;/li&gt;
&lt;li&gt;Here's what I'm doing: _____. What else can I do to stand out to the hiring managers?&lt;/li&gt;
&lt;li&gt;What was your interview like here?&lt;/li&gt;
&lt;li&gt;Did you always see yourself as an engineer?&lt;/li&gt;
&lt;li&gt;Do you work on side projects in your spare time? If so, what are you working on these days?&lt;/li&gt;
&lt;li&gt;I think I'm going to learn (insert language, technology, platform, etc) next so that I can stand out among the other candidates for the next Junior role here...do you think that's worth my time?&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h4&gt;
  
  
  Toot your own horn
&lt;/h4&gt;

&lt;p&gt;Self-advocacy makes a lot of us feel uncomfortable.  It can feel like bragging or showing off.  But if you're not letting people know about what you're working on, no one will know. When it comes time to apply for the Junior opening at your company, you are going to need more than just your resume to stand out against others who have more technical experience.  A great way to do this is to open up, get vulnerable, and let others into your journey by showcasing your work!&lt;/p&gt;

&lt;p&gt;Quick Tips (without feeling too "braggy"):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Set up quarterly meetings with the (future) hiring manager to talk through progress.  I used a spreadsheet in one of my conversations to highlight the projects that I'd done and how they mapped to the skills on our company's Junior job listing.  Ask the hiring manager for feedback on your learning plan.&lt;/li&gt;
&lt;li&gt;In one of your coffee conversations, ask how engineers at your company show what they're working on to others.  Is it through a private Slack channel (could you get an invite to join?)?  Is it through submissions to a Google Form or company newsletter (can you get the link so you can add your projects)?  Maybe its through 1:1 meetings with their manager (in this case, it's definitely important to get those regularly-scheduled meetings with one of the managers of the role you'd like to eventually apply for.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  &lt;a&gt;&lt;/a&gt;Do a Good Job!
&lt;/h4&gt;

&lt;p&gt;Even if you work for a big company where you're pretty confident that your current manager doesn't have any contact with the hiring manager of the team you'd like to move to, rest assured - your future manager &lt;em&gt;will&lt;/em&gt; find out about your work ethic, ability to contribute to a team, and overall fit from members of your current team.&lt;/p&gt;

&lt;p&gt;Make sure you're doing a great job in your role &lt;em&gt;today&lt;/em&gt;!&lt;/p&gt;

&lt;p&gt;Connect with me on &lt;a href="https://www.twitter.com/shaundai" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt; and on &lt;a href="https://www.linkedin.com/in/shaundai" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>career</category>
      <category>codenewbie</category>
      <category>careerswitch</category>
      <category>webdev</category>
    </item>
    <item>
      <title>How to: Deploy Create-React-App on Surge</title>
      <dc:creator>Shaundai Person</dc:creator>
      <pubDate>Sat, 05 Dec 2020 14:43:38 +0000</pubDate>
      <link>https://dev.to/shaundai/how-to-deploy-create-react-app-on-surge-1j57</link>
      <guid>https://dev.to/shaundai/how-to-deploy-create-react-app-on-surge-1j57</guid>
      <description>&lt;h4&gt;
  
  
  Have a React app you're ready for the world to see? Check out these 5 easy steps to deploy that bad boy!
&lt;/h4&gt;

&lt;h4&gt;
  
  
  1. Install Surge
&lt;/h4&gt;

&lt;p&gt;First things first - let's make sure you have surge installed.&lt;/p&gt;

&lt;p&gt;Install Surge globally ("globally" means that all of your projects will have access to Surge, not just this one) by typing this into your terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install --global surge
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  2. Create a build folder for your repo
&lt;/h4&gt;

&lt;p&gt;In the terminal, get to the root directory of your completed React app ("root directory" is the highest-level folder for your app).  If you used create-react-app to get your app running in the first place, type npm run build in the command line and press enter.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm run build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Npm will create a build folder, which is basically a deployable version of all of the React files you've worked so hard on, minus the junk and the secret information you wanted to keep hidden.&lt;/p&gt;

&lt;p&gt;Now navigate to your build folder by typing the following into the command line.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  3. Deploy to Surge
&lt;/h4&gt;

&lt;p&gt;We're going to deploy to surge at this point, which is as easy as typing one word in the command window to activate the program: surge.  Type surge into the command line and press enter.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;surge
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  4. Create a Surge Account (or log into your existing account)
&lt;/h4&gt;

&lt;p&gt;Surge will prompt you to either create an account or log in.  If this is your first time using Surge, use your email address and create a password to create a Surge account through the command line.  If you've used surge before, your most recently used credentials will appear and you can press enter to keep it moving or create a new account/enter a different login from there.&lt;/p&gt;

&lt;h4&gt;
  
  
  5. Get your Domain
&lt;/h4&gt;

&lt;p&gt;Surge will make up a domain name for you.  You can keep the domain they give you, change the surge sub-domain to your own available name (for example: 'my-customname.surge.sh'), or use a custom domain by following the &lt;a href="https://surge.sh/help/adding-a-custom-domain" rel="noopener noreferrer"&gt;instructions here&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Press enter.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You're done!  Enter the link in your browser to see your app live in action.&lt;/p&gt;

&lt;p&gt;Connect with me on &lt;a href="https://www.twitter.com/shaundai" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt; and on &lt;a href="https://www.linkedin.com/in/shaundai" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>surge</category>
      <category>react</category>
      <category>deploy</category>
      <category>createreactapp</category>
    </item>
    <item>
      <title>Creating a Gatsby Blog Hosted on Netlify</title>
      <dc:creator>Shaundai Person</dc:creator>
      <pubDate>Sat, 05 Dec 2020 14:29:37 +0000</pubDate>
      <link>https://dev.to/shaundai/creating-a-gatsby-blog-hosted-on-netlify-3akb</link>
      <guid>https://dev.to/shaundai/creating-a-gatsby-blog-hosted-on-netlify-3akb</guid>
      <description>&lt;p&gt;Netlify makes it SO EASY for developers at any skill level to build and manage a static websites.  If you're thinking of hosting a blog with Netlify as well, let me assure you that the Gatsby + Netlify CMS is the way to get this blog up and running in 10 minutes.  Add  blog articles is a breeze;  Netlify provides an admin dashboard that allows you to add future posts without having to spending time duplicating code over and over.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fobkv5iiebjqbkqpx81en.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fobkv5iiebjqbkqpx81en.png" alt="Screenshot of Netlify Admin Page" width="800" height="210"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's start by adding a Gatsby blog to your existing Netlify site with a custom domain.  Here’s what you’ll need:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Netlify site with custom domain (I purchased my domain from Netlify)&lt;/li&gt;
&lt;li&gt;Gatsby CLI Installed&lt;/li&gt;
&lt;li&gt;A GitHub account&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let’s start out with a simple Gatsby blog.  Gatsby provides a simple, yet elegant, starter blog for you to work with.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Creating your Gatsby blog:&lt;/strong&gt;
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt; In your terminal, type the following command to create a new Gatsby blog site using gatsby-personal-starter-blog.  &lt;code&gt;[your-project-title]&lt;/code&gt;should be the name of your blog (so...whatever you want it to be).  The github.com link needs to be exactly as typed below.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;gatsby new [your-project-title] https://github.com/thomaswangio/gatsby-personal-starter-blog
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Give Gatsby a moment to install all of the required packages and dependencies (about 3-4 minutes).&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Once it's finished installing, cd into your project and run your project locally to see the updates in real time before sending to production.  To do this, type into your terminal:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd [your-project-title]
gatsby develop
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You officially have a Gatsby site!  How easy was that?! To see the local site, go to &lt;code&gt;http://localhost:8000&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now, let’s make a few customizations before deploying to GitHub.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Customizing your blog site:&lt;/strong&gt;
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;This part will be essential for managing your Gatsby site using the admin dashboard.  Open this project in your favorite code editor and open &lt;code&gt;static/admin/config.yml&lt;/code&gt;.  On line two, change the name from &lt;code&gt;name: test-repo to name: github&lt;/code&gt;.  Press enter to add another line for line 3 and type &lt;code&gt;repo: [username]/[repo-name]&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;code&gt;[username]&lt;/code&gt; should be your GitHub username.  &lt;code&gt;[repo-name]&lt;/code&gt; should be the name of the GitHub repo where this project lives.  Here's how that section should now look:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;backend:
  name: github
  repo: [username]/[repo-name]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you can check out your gorgeous new admin dashboard: &lt;code&gt;http://localhost:8000/admin&lt;/code&gt;.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Continue to make the blog your own by opening gatsby-config.js in your code editor.  You'll find the default siteMetaData there; edit it to make it yours.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Also, scroll down to the bottom to change the favicon (called icon) to something other than the Gatsby logo, and to make more customizations to the background color and name of your blog.&lt;/p&gt;

&lt;h3&gt;
  
  
  Connecting your blog to GitHub repo:
&lt;/h3&gt;

&lt;p&gt;In GitHub, create a new repo (make sure to give it the same name as your project).  You’ll push your code to GitHub by typing the below into your terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; git init
&amp;gt; git add .
&amp;gt; git commit -m “initial commit”
&amp;gt; git remote add origin https://github.com/[username]/[repo-name]
&amp;gt; git push -u origin master
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You're done! Give yourself a pat on the back.&lt;/p&gt;

&lt;p&gt;Connect with me on &lt;a href="https://www.twitter.com/shaundai" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt; and on &lt;a href="https://www.linkedin.com/in/shaundai" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>blogging</category>
      <category>gatsby</category>
      <category>netlify</category>
      <category>blog</category>
    </item>
  </channel>
</rss>
