<?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: Analogy | Absence | Example</title>
    <description>The latest articles on DEV Community by Analogy | Absence | Example (@mathlete).</description>
    <link>https://dev.to/mathlete</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%2F495500%2F0ab0f2f8-f4c3-4419-9acf-6eedd7b83e23.jpg</url>
      <title>DEV Community: Analogy | Absence | Example</title>
      <link>https://dev.to/mathlete</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mathlete"/>
    <language>en</language>
    <item>
      <title>My first significant refactoring of a project</title>
      <dc:creator>Analogy | Absence | Example</dc:creator>
      <pubDate>Tue, 07 Sep 2021 05:55:40 +0000</pubDate>
      <link>https://dev.to/mathlete/my-first-significant-refactoring-of-a-project-2dhh</link>
      <guid>https://dev.to/mathlete/my-first-significant-refactoring-of-a-project-2dhh</guid>
      <description>&lt;p&gt;I built &lt;a href="//www.QWERTYBall.com"&gt;QWERTYBall&lt;/a&gt; as a project in bootcamp. To make it work, I'd furiously google an example of the feature I wanted, then just as furiously I'd add whatever framework, css, and code used in that example to my codebase. The resulting game worked great, but under the hood it was a hot mess. I dreaded a potential employer taking a look at my github repo and seeing the slap-dash approach I took to make the game work.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Organize it
&lt;/h2&gt;

&lt;p&gt;The first step I took to refactor the game was just to organize it. It had been months since I wrote the code, and I wasn't sure how everything worked. I used on my all-time favorite VSCode extension, &lt;a href="https://marketplace.visualstudio.com/items?itemName=dakara.dakara-foldplus"&gt;Fold Plus&lt;/a&gt;, to collapse all the code and just see which functions were called and in what order. Unsurprisingly, all the functions were out of order, but I moved everything around so that they were as sequential as possible.&lt;/p&gt;

&lt;p&gt;Next, I commented out the code into sections. Because it's a game, I organized the code in the following manner:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Initialize Variables&lt;/li&gt;
&lt;li&gt;Launch App&lt;/li&gt;
&lt;li&gt;Start Game&lt;/li&gt;
&lt;li&gt;Game Play&lt;/li&gt;
&lt;li&gt;Game Over&lt;/li&gt;
&lt;li&gt;Save Game&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At this point, I found that I still didn't truly understand the structure well enough, so I decided to diagram it using &lt;a href="//www.lucidchart.com"&gt;LucidChart&lt;/a&gt;. Here's the diagram I created:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Gsw_tUZT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dmen6yuwkixehelsv9n6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Gsw_tUZT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dmen6yuwkixehelsv9n6.png" alt="Alt Text" width="800" height="604"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This was a total game-changer. I felt as though I finally had a bird's eye view on how the code was structured. Seeing it this way helped me realize what code was superfluous, and what code was not even used in the first place. I ended up making several successive versions of the diagram because I kept finding new ways to clean up the code.&lt;/p&gt;

&lt;p&gt;This will be the first installment of a series devoted to this refactor. Next up, I'll detail how I reduced my CSS code from a ridiculous 8,053 lines to just &lt;del&gt;615&lt;/del&gt; 252--and I have further to go!&lt;/p&gt;

</description>
      <category>beginners</category>
    </item>
    <item>
      <title>What's the difference between CSS, SASS, and SCSS?</title>
      <dc:creator>Analogy | Absence | Example</dc:creator>
      <pubDate>Tue, 31 Aug 2021 02:32:51 +0000</pubDate>
      <link>https://dev.to/mathlete/what-s-the-difference-between-css-sass-and-scss-g2b</link>
      <guid>https://dev.to/mathlete/what-s-the-difference-between-css-sass-and-scss-g2b</guid>
      <description>&lt;p&gt;When I wrote &lt;a href="//www.QWERTYBall.com"&gt;QWERTYBall&lt;/a&gt;, I was especially eager to get it working and looking how I wanted. If I wanted a certain feature, I'd read a tutorial on how to add it, and do whatever the tutorial said to do. In the process, I ended up with a lot of extra files I didn't need. &lt;/p&gt;

&lt;p&gt;In the interest of streamlining the app I wrote all those months ago, I recently revisited the code and found I had CSS files, SASS files, and SCSS files. The problem is that I had no idea what SASS or SCSS was, so I set out to learn. Here's what I found.&lt;/p&gt;

&lt;h2&gt;
  
  
  CSS
&lt;/h2&gt;

&lt;p&gt;CSS stands for Cascading Style Sheets. Before CSS, there wasn't any formal separation between the code that defined how a webpage looked and the content featured on that webpage. This lack of separation made it laborious to update the look of a webpage because you had to hunt all over to find and change the fonts, colors, margins, and anything else.&lt;/p&gt;

&lt;h2&gt;
  
  
  SASS
&lt;/h2&gt;

&lt;p&gt;SASS stands for Syntactically Awesome Style Sheets. In 2006, SASS was developed to solve the problem of excessive repetition in CSS by allowing for variables, nesting, and mixins (a pre-defined group of styles). SASS also added programmatic features such as arguments, loops, and conditional logic. The authors of SASS also decided to change the syntax a bit by eliminating the need for semicolons and curly braces. Instead, the syntax is "whitespace-sensitive" and must have proper indentation. SASS is a CSS "pre-processor" and outputs traditional CSS so any slightly modern browser can implement it.&lt;/p&gt;

&lt;h2&gt;
  
  
  SCSS
&lt;/h2&gt;

&lt;p&gt;SCSS stands for Sassy CSS, and it's a newer syntax for SASS. It's simply CSS with the same featureset as SASS but requires semicolons and curly braces just like CSS. In fact, you can convert any CSS file to SCSS by changing the doc type from &lt;code&gt;.css&lt;/code&gt; to &lt;code&gt;.scss&lt;/code&gt; because SCSS is an extension of the syntax of CSS.&lt;/p&gt;

&lt;h2&gt;
  
  
  Examples
&lt;/h2&gt;

&lt;p&gt;Here's some CSS for two buttons. Following is how you would accomplish the same goal using SASS and SCSS.&lt;/p&gt;

&lt;p&gt;CSS&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;
&lt;span class="nc"&gt;.button.danger&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;border&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1px&lt;/span&gt; &lt;span class="nb"&gt;solid&lt;/span&gt; &lt;span class="no"&gt;black&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;50%&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.button.warning&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;border&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1px&lt;/span&gt; &lt;span class="nb"&gt;solid&lt;/span&gt; &lt;span class="no"&gt;black&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;60&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;50%&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;SASS&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sass"&gt;&lt;code&gt;&lt;span class="nv"&gt;$red&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="m"&gt;50%&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nv"&gt;$yellow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;60&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="m"&gt;50%&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nv"&gt;$neutral&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0%&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0%&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;=myBtn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$bdr&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$bg&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 
  &lt;span class="nl"&gt;border&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt; &lt;span class="nb"&gt;px&lt;/span&gt; &lt;span class="nb"&gt;solid&lt;/span&gt; &lt;span class="nv"&gt;$bdr&lt;/span&gt;
  &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;$bg&lt;/span&gt;

&lt;span class="nt"&gt;button&lt;/span&gt; 
  &lt;span class="nt"&gt;danger&lt;/span&gt; 
    &lt;span class="nd"&gt;+myBtn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$neutral&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$red&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

  &lt;span class="nt"&gt;warning&lt;/span&gt; 
    &lt;span class="nd"&gt;+myBtn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$neutral&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$yellow&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;SCSS&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight scss"&gt;&lt;code&gt;&lt;span class="nv"&gt;$red&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="m"&gt;50%&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nv"&gt;$yellow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;60&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="m"&gt;50%&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nv"&gt;$neutral&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0%&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0%&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="k"&gt;@mixin&lt;/span&gt; &lt;span class="nf"&gt;myBtn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$bdr&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$bg&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;border&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt; &lt;span class="nb"&gt;px&lt;/span&gt; &lt;span class="nb"&gt;solid&lt;/span&gt; &lt;span class="nv"&gt;$bdr&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;$bg&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nt"&gt;danger&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;@include&lt;/span&gt; &lt;span class="nd"&gt;myBtn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$neutral&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$red&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nt"&gt;warning&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;@include&lt;/span&gt; &lt;span class="nd"&gt;myBtn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$neutral&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$yellow&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>css</category>
      <category>beginners</category>
    </item>
    <item>
      <title>The 6 VSCode Extensions I couldn't live without</title>
      <dc:creator>Analogy | Absence | Example</dc:creator>
      <pubDate>Tue, 24 Aug 2021 04:49:37 +0000</pubDate>
      <link>https://dev.to/mathlete/the-6-vscode-extensions-i-couldn-t-live-without-2483</link>
      <guid>https://dev.to/mathlete/the-6-vscode-extensions-i-couldn-t-live-without-2483</guid>
      <description>&lt;p&gt;The geniuses behind VSCode can't think of &lt;em&gt;everything&lt;/em&gt;, so it's absolutely wonderful that any programmer with a great idea can create an extension that we can all benefit from. We all have our favorites, and these are mine. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=dakara.dakara-foldplus"&gt;Fold Plus&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;What:&lt;/strong&gt; Allows you to collapse every nested block of code &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Why:&lt;/strong&gt; Collapsing all your code blocks makes your code so much easier to understand&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;How much:&lt;/strong&gt; Free&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=mhutchie.git-graph"&gt;Git Graph&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;What:&lt;/strong&gt; A visualization of your git history &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Why:&lt;/strong&gt; Your git history is confusing as fuck, admit it&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;How much:&lt;/strong&gt; Free&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=monokai.theme-monokai-pro-vscode&amp;amp;ssr=false#overview"&gt;Monokai Pro&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;What:&lt;/strong&gt; Color scheme for code &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Why:&lt;/strong&gt; It's just how code should be colored. Prove me wrong.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;How much:&lt;/strong&gt; Free evaluation copy, then €9.95 to buy it (I did. It's worth it)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=2gua.rainbow-brackets"&gt;Rainbow Brackets&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;What:&lt;/strong&gt; Colors opening and closing bracket pairs the same color &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Why:&lt;/strong&gt; Makes it 1000 times easier to understand which opening and closing brackets are paired because they are the same color&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;How much:&lt;/strong&gt; Free&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode"&gt;Prettier Code Formatter&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;What:&lt;/strong&gt; It formats and indents your code so it's much easier to parse &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Why:&lt;/strong&gt; It's much easier than trying to understand a giant block of spaghetti code.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;How much:&lt;/strong&gt; Free&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=ban.spellright"&gt;Spell Right&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;What:&lt;/strong&gt; A spellchecker for VSCode &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Why:&lt;/strong&gt; You're still lousy at spelling and need a spellchecker&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;How much:&lt;/strong&gt; Free&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Those are my favey-faves, what are yours? Please add them in the comments below, I am always hungry for a new clever extension to make writing code easier!&lt;/p&gt;

</description>
      <category>beginners</category>
    </item>
    <item>
      <title>What I DIDN'T learn from Flexbox Froggy</title>
      <dc:creator>Analogy | Absence | Example</dc:creator>
      <pubDate>Tue, 17 Aug 2021 01:11:04 +0000</pubDate>
      <link>https://dev.to/mathlete/what-i-didn-t-learn-from-flexbox-froggy-2dlc</link>
      <guid>https://dev.to/mathlete/what-i-didn-t-learn-from-flexbox-froggy-2dlc</guid>
      <description>&lt;p&gt;In the interest of learning Flexbox during bootcamp, I tried my hand at the brilliant &lt;a href="https://flexboxfroggy.com"&gt;Flexbox Froggy&lt;/a&gt; challenge. I completed all 24 levels, but in a pattern-matching, brute-force kinda way. By the end, I felt like I had learned nothing.&lt;/p&gt;

&lt;p&gt;Months later, I decided to try my hand again at &lt;a href="https://flexboxfroggy.com"&gt;Flexbox Froggy&lt;/a&gt;. There's a lot that I learned about &lt;a href="https://dev.to/mathlete/what-i-learned-from-flexbox-froggy-container-properties-509f"&gt;&lt;em&gt;container&lt;/em&gt; properties&lt;/a&gt; and &lt;a href="https://dev.to/mathlete/what-i-learned-from-flexbox-froggy-item-properties-3k7o"&gt;&lt;em&gt;item&lt;/em&gt; properties&lt;/a&gt;, but I found there's a few commands that aren't included in Flexbox Froggy, and I'm gonna go over them in this post!&lt;/p&gt;

&lt;h2&gt;
  
  
  flex-grow
&lt;/h2&gt;

&lt;p&gt;Imagine that you have three children you're driving to the park. Two are babies, and one is a toddler. Since the toddler is twice as big as the babies, he'll need a car seat that is twice as big, too. If each baby gets a space, the toddler will need a space that's twice as big. &lt;code&gt;flex-grow&lt;/code&gt; allows you to designate a multiple of space for any element that you want. In this example, it would work 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="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;baby&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;flex&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;grow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;toddler&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;flex&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;grow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  flex-shrink
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;flex-shrink&lt;/code&gt; is like the inverse of &lt;code&gt;flex-grow&lt;/code&gt;. The example above, where I need right-sized car seats for two babies and a toddler. Instead of giving each baby a space set to &lt;code&gt;1&lt;/code&gt; and the toddler gets a space set to &lt;code&gt;2&lt;/code&gt;, I can give the toddler a space set to &lt;code&gt;1&lt;/code&gt; and the babies get a space set to &lt;code&gt;0.5&lt;/code&gt;, 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="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;toddler&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;flex&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;grow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;baby&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;flex&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;grow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.5&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
&lt;span class="p"&gt;}&lt;/span&gt;

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

&lt;/div&gt;






&lt;h2&gt;
  
  
  flex-basis
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;flex-basis&lt;/code&gt; is a little tricky to explain without an example, so here's an example (based on this good article from [mastery.games]9&lt;a href="https://mastery.games/post/the-difference-between-width-and-flex-basis/)):"&gt;https://mastery.games/post/the-difference-between-width-and-flex-basis/)):&lt;/a&gt; Imagine you have an 1000px wide container and you have four 200px items you want to put inside the container. 1000px minus (4 * 200px) = 800px, so there will be an extra 200px of empty space. If you want those four items to stretch to fit nicely into that 1000px container, you can dictate the &lt;code&gt;basis&lt;/code&gt; of the item to 250px (because you know 1000px ÷ 4 = 250px).&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="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;container&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="nx"&gt;px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;flex&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;basis&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;250&lt;/span&gt;&lt;span class="nx"&gt;px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
&lt;span class="p"&gt;}&lt;/span&gt;

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

&lt;/div&gt;



</description>
      <category>beginners</category>
      <category>css</category>
    </item>
    <item>
      <title>What I learned from Flexbox Froggy: Item Properties</title>
      <dc:creator>Analogy | Absence | Example</dc:creator>
      <pubDate>Tue, 10 Aug 2021 02:13:41 +0000</pubDate>
      <link>https://dev.to/mathlete/what-i-learned-from-flexbox-froggy-item-properties-3k7o</link>
      <guid>https://dev.to/mathlete/what-i-learned-from-flexbox-froggy-item-properties-3k7o</guid>
      <description>&lt;p&gt;In the interest of learning Flexbox during bootcamp, I tried my hand at the brilliant &lt;a href="https://flexboxfroggy.com"&gt;Flexbox Froggy&lt;/a&gt; challenge. I completed all 24 levels, but in a pattern-matching, brute-force kinda way. By the end, I felt like I had learned nothing.&lt;/p&gt;

&lt;p&gt;Today, months later, I decided to try my hand again at &lt;a href="https://flexboxfroggy.com"&gt;Flexbox Froggy&lt;/a&gt;. Here's what I learned about &lt;em&gt;item&lt;/em&gt; properties (&lt;a href="https://dev.to/mathlete/what-i-learned-from-flexbox-froggy-container-properties-509f"&gt;to see what I learned about children properties, click here&lt;/a&gt;. (Spoiler: it's all about overriding the settings of the container)&lt;/p&gt;

&lt;h2&gt;
  
  
  Override the container's order
&lt;/h2&gt;

&lt;p&gt;We use &lt;code&gt;flex-direction&lt;/code&gt; to define the main axis and thus the order of a container. That should be good enough, right? Well, if for some reason you want to define the order of your items as distinct from the defined order of the parent container, here's an example:&lt;/p&gt;

&lt;h4&gt;
  
  
  Example: Before
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="nx"&gt;pond&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="c1"&gt;// nothing here yet&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7lQUJETN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ioi57tnc9ds2fm0x48uk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7lQUJETN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ioi57tnc9ds2fm0x48uk.png" alt="Alt Text" width="800" height="189"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Example: After
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="nx"&gt;pond&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nx"&gt;flex&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;direction&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;column&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mfp9fOgV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nfeyt24hyfon6a7zilwi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mfp9fOgV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nfeyt24hyfon6a7zilwi.png" alt="Alt Text" width="800" height="189"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Override the container's vertical alignment
&lt;/h2&gt;

&lt;p&gt;We use &lt;code&gt;align-items&lt;/code&gt; to specify the alignment of the contents of a container along the &lt;em&gt;cross-axis&lt;/em&gt;. If you want to override that, you can use &lt;code&gt;align-self&lt;/code&gt; like we do here:&lt;/p&gt;

&lt;h4&gt;
  
  
  Example: Before
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="nx"&gt;pond&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nx"&gt;align&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;items&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;flex&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;start&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;yellow&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// nothing here yet&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fodfj-Qm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6en1u2kbnday7be559od.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fodfj-Qm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6en1u2kbnday7be559od.png" alt="Alt Text" width="800" height="805"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Example: After
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="nx"&gt;pond&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nx"&gt;align&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;items&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;flex&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;start&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;yellow&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;align&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;flex&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;end&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5f7jPJzI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iqs0p18qo9t1xdm46vyq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5f7jPJzI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iqs0p18qo9t1xdm46vyq.png" alt="Alt Text" width="800" height="805"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Options
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;align-self: flex-start&lt;/code&gt;: vertically align items to the top of the container&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;align-self: flex-end&lt;/code&gt;: vertically align items to the bottom of the container&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;align-self: center&lt;/code&gt;: vertically align items to the center of the container&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;align-self: stretch&lt;/code&gt;: vertically stretch items from the top of the container to the bottom of the container&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;align-self: baseline&lt;/code&gt;: vertically center each item to the baseline of the container that text sits upon&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Next up: What I DIDN'T learn from Flexbox Froggy!&lt;/em&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>css</category>
    </item>
    <item>
      <title>What I learned from Flexbox Froggy: Container Properties</title>
      <dc:creator>Analogy | Absence | Example</dc:creator>
      <pubDate>Tue, 03 Aug 2021 06:19:13 +0000</pubDate>
      <link>https://dev.to/mathlete/what-i-learned-from-flexbox-froggy-container-properties-509f</link>
      <guid>https://dev.to/mathlete/what-i-learned-from-flexbox-froggy-container-properties-509f</guid>
      <description>&lt;p&gt;In the interest of learning Flexbox during bootcamp, I tried my hand at the brilliant &lt;a href="https://flexboxfroggy.com" rel="noopener noreferrer"&gt;Flexbox Froggy&lt;/a&gt; challenge. I completed all 24 levels, but in a pattern-matching, brute-force kinda way. By the end, I felt like I had learned nothing.&lt;/p&gt;

&lt;p&gt;Today, months later, I decided to try my hand again at &lt;a href="https://flexboxfroggy.com" rel="noopener noreferrer"&gt;Flexbox Froggy&lt;/a&gt;. Here's what I learned.&lt;/p&gt;

&lt;h2&gt;
  
  
  Define your container and set the &lt;code&gt;display&lt;/code&gt; property to &lt;code&gt;flex&lt;/code&gt;
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;myContainer&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="c1"&gt;// everything else goes here&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Define the main axis of (the contents of) your container
&lt;/h2&gt;

&lt;p&gt;Most often, you'll want your items to be ordered from first to last. But should they be laid out from left-to-right, or from top-to-bottom?&lt;/p&gt;

&lt;h4&gt;
  
  
  Example: Before
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="nx"&gt;pond&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="c1"&gt;// nothing here yet&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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




&lt;h4&gt;
  
  
  Example: After
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="nx"&gt;pond&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nx"&gt;flex&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;direction&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;column&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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




&lt;h4&gt;
  
  
  Options
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Left-to-right: &lt;code&gt;flex-direction: row&lt;/code&gt; (if you want it right-to-left, choose &lt;code&gt;flex-direction: row-reverse&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Top-to-bottom: &lt;code&gt;flex-direction: column&lt;/code&gt; (if you want it bottom-to-top, choose &lt;code&gt;flex-direction: column-reverse&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Let your items wrap (or don't)
&lt;/h2&gt;

&lt;p&gt;By default, all your items to be confined to a single row (or a single column, if you chose &lt;code&gt;flex-direction: column&lt;/code&gt; above). If you want your items to wrap to the next line once they run out of space, choose &lt;code&gt;flex-direction: wrap&lt;/code&gt;. Lastly, if for some reason you want the wrapping to be reversed, choose &lt;code&gt;flex-direction: wrap-reverse&lt;/code&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Example: Before
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="nx"&gt;pond&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="c1"&gt;// nothing here yet&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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




&lt;h4&gt;
  
  
  Example: After
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="nx"&gt;pond&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nx"&gt;flex&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;wrap&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;wrap&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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




&lt;h2&gt;
  
  
  Horizontally align your items
&lt;/h2&gt;

&lt;p&gt;You're probably already familiar with text layout that is left-aligned, right-aligned, and center-aligned. You can, of course, align your items the same way, using &lt;code&gt;justify-content&lt;/code&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  Example: Before
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="nx"&gt;pond&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="c1"&gt;// nothing here yet&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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




&lt;h4&gt;
  
  
  Example: After
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="nx"&gt;pond&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nx"&gt;justify&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;flex&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;end&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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




&lt;h4&gt;
  
  
  Options
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;left align: &lt;code&gt;justify-content: flex-start&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;right align: &lt;code&gt;justify-content: flex-end&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;center align: &lt;code&gt;justify-content: center&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Vertically align your items
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;justify-content&lt;/code&gt; concerns alignment along the "main axis" (aka the horizontal axis). &lt;code&gt;align-items&lt;/code&gt; concerns alignment along the "cross axis" (aka the vertical axis).&lt;/p&gt;

&lt;h4&gt;
  
  
  Example: Before
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="nx"&gt;pond&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="c1"&gt;// nothing here yet&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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




&lt;h4&gt;
  
  
  Example: After
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="nx"&gt;pond&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nx"&gt;align&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;items&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;flex&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;end&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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




&lt;h4&gt;
  
  
  Options
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;align-items: flex-start&lt;/code&gt;: vertically align items to the top of the container&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;align-items: flex-end&lt;/code&gt;: vertically align items to the bottom of the container&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;align-items: center&lt;/code&gt;: vertically align items to the center of the container&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;align-items: stretch&lt;/code&gt;: vertically stretch items from the top of the container to the bottom of the container&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;align-items: baseline&lt;/code&gt;: vertically center each item to the baseline of the container that text sits upon&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Distribute your items
&lt;/h2&gt;

&lt;p&gt;The more interesting settings for &lt;code&gt;justify-content&lt;/code&gt; are &lt;code&gt;space-between&lt;/code&gt;, &lt;code&gt;space-around&lt;/code&gt;, and &lt;code&gt;space-evenly&lt;/code&gt;:&lt;/p&gt;

&lt;h4&gt;
  
  
  Example: Before
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="nx"&gt;pond&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="c1"&gt;// nothing here yet&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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




&lt;h4&gt;
  
  
  Example: After
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="nx"&gt;pond&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nx"&gt;justify&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;space&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;around&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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




&lt;h4&gt;
  
  
  Options
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;justify-content: space-between&lt;/code&gt;: put all the space &lt;strong&gt;between&lt;/strong&gt; your items, like x---x---x&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;justify-content: space-around&lt;/code&gt;: surround each item with the same amount of space on either side of that item, like -x--x--x-&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;justify-content: space-evenly&lt;/code&gt;: divide up all the available space before and after each item, like -x-x-x-x-&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Distribute your whitespace
&lt;/h2&gt;

&lt;p&gt;Imagine that you have a notebook-sized sheet of lined writing paper. Now, imagine that you only have 3 lines of text to write on that sheet of paper. You could start at the top of the page, which would leave the rest of the page below the text empty. You could put the text at the bottom of the page, leaving the top of the page empty. This is what &lt;code&gt;align-content&lt;/code&gt; controls.&lt;/p&gt;

&lt;h4&gt;
  
  
  Example: Before
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="nx"&gt;pond&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nx"&gt;flex&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;wrap&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;wrap&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="c1"&gt;// nothing here yet&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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




&lt;h4&gt;
  
  
  Example: After
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="nx"&gt;pond&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nx"&gt;flex&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;wrap&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;wrap&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nx"&gt;align&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;flex&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;end&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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




&lt;h4&gt;
  
  
  Options
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;align-content: flex-start&lt;/code&gt;: rows of items are clustered at the top of the container, leaving whitespace below&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;align-content: flex-end&lt;/code&gt;: rows of items are clustered at the bottom of the container, leaving whitespace above&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;align-content: center&lt;/code&gt;: rows of items are clustered at the center of the page, leaving whitespace above and below&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;align-content: space-between&lt;/code&gt;: items are distributed so that any available whitespace is  between rows of items, but never above the first row of items or below the last row of items.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;align-content: space-around&lt;/code&gt;: items are distributed so that any available whitespace is  between rows of items, including above the first row of items and below the last row of items.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;align-content: stretch&lt;/code&gt;: the items are stretched to fill all available space so there is no whitespace above or below a row of items.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Next: What I learned from Flexbox Froggy: Item properties!&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>css</category>
    </item>
    <item>
      <title>Understanding "truthiness" by comparing it to "falsiness"</title>
      <dc:creator>Analogy | Absence | Example</dc:creator>
      <pubDate>Mon, 26 Jul 2021 22:08:40 +0000</pubDate>
      <link>https://dev.to/mathlete/understanding-truthiness-by-comparing-it-to-falsiness-4177</link>
      <guid>https://dev.to/mathlete/understanding-truthiness-by-comparing-it-to-falsiness-4177</guid>
      <description>&lt;h3&gt;
  
  
  What is truthiness?
&lt;/h3&gt;

&lt;p&gt;If you write a statement where you are testing if something is true or not--like an &lt;code&gt;if&lt;/code&gt; statement that uses a logical operator like &lt;code&gt;||&lt;/code&gt;, &lt;code&gt;!&lt;/code&gt;, or &lt;code&gt;&amp;amp;&amp;amp;&lt;/code&gt;--you expect that statement to return a boolean value of &lt;code&gt;true&lt;/code&gt; or &lt;code&gt;false&lt;/code&gt;.  Sometimes it doesn't resolve to a boolean value--true or false--yet, nevertheless, it gets &lt;em&gt;interpreted&lt;/em&gt; like a boolean value. We call those values "truthy" or "falsey". &lt;/p&gt;

&lt;p&gt;In Javascript, we can list all the falsy values. They are: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;null&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;undefined&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;NaN&lt;/code&gt; (Not a Number)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;""&lt;/code&gt; (empty string)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;false&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;0&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There is not a corresponding list of "truthy" values, because all values are truthy unless they are defined as fasly or are one of the examples listed above.&lt;/p&gt;

&lt;p&gt;We can, however, demonstrate "truthiness" by showing examples of &lt;code&gt;if&lt;/code&gt; statements that resolve to truthy values. Let's start!&lt;/p&gt;




&lt;h2&gt;
  
  
  An empty string is falsy, but an empty array or empty object is truthy
&lt;/h2&gt;

&lt;p&gt;This is because an empty string is nothingness, but an empty array is still a container and an empty object is still a container. The array and object can be filled with content at a later point.&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;if&lt;/span&gt; &lt;span class="p"&gt;(&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="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hello&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// (nothing)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;({}){&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hello&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// hello&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;([]){&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hello&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// hello&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  &lt;code&gt;0&lt;/code&gt; is falsy, but &lt;code&gt;"0"&lt;/code&gt; is truthy
&lt;/h2&gt;

&lt;p&gt;This is because the value of 0 is zero, and therefore nothing, but "0" is a string with a single character that looks like a zero.&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;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hello&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// (nothing)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;0&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="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hello&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// hello&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  &lt;code&gt;false&lt;/code&gt; is falsy, but &lt;code&gt;true&lt;/code&gt; is truthy
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;I can't explain why this is, I just accept it.&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hello&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// (nothing)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hello&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// hello&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>beginners</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Let's talk about "falsiness"</title>
      <dc:creator>Analogy | Absence | Example</dc:creator>
      <pubDate>Tue, 20 Jul 2021 03:57:39 +0000</pubDate>
      <link>https://dev.to/mathlete/let-s-talk-about-falsiness-2551</link>
      <guid>https://dev.to/mathlete/let-s-talk-about-falsiness-2551</guid>
      <description>&lt;h3&gt;
  
  
  What is falsiness?
&lt;/h3&gt;

&lt;p&gt;If you write a statement where you are testing if something is true or not--like an &lt;code&gt;if&lt;/code&gt; statement that uses a logical operator like &lt;code&gt;||&lt;/code&gt;, &lt;code&gt;!&lt;/code&gt;, or &lt;code&gt;&amp;amp;&amp;amp;&lt;/code&gt;--you expect that statement to return a boolean value of &lt;code&gt;true&lt;/code&gt; or &lt;code&gt;false&lt;/code&gt;.  Sometimes it doesn't resolve to a boolean value--true or false--yet, nevertheless, it gets &lt;em&gt;interpreted&lt;/em&gt; like a boolean value. We call those values "truthy" or "falsey".&lt;/p&gt;

&lt;p&gt;In Javascript, examples of falsy values are: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;null&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;undefined&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;NaN&lt;/code&gt; (Not a Number)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;""&lt;/code&gt; (empty string)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;false&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;0&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Every other value--every value that is not one of the above--will evaluate to &lt;code&gt;true&lt;/code&gt; in a Boolean evaluation in Javascript. &lt;/p&gt;

&lt;p&gt;Let's go through them one by one. First, I'll demonstrate a variable assignment to each falsy value. Next, I'll show how that falsy value is is interpreted as &lt;code&gt;false&lt;/code&gt; using the &lt;code&gt;Boolean()&lt;/code&gt; function, which takes a value or expression and always returns either &lt;code&gt;true&lt;/code&gt; or &lt;code&gt;false&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;null&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;A variable that resolves to &lt;code&gt;null&lt;/code&gt; is a variable that has been deliberately assigned an empty value&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;foo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;foo&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// null&lt;/span&gt;

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

&lt;/div&gt;






&lt;h2&gt;
  
  
  &lt;code&gt;undefined&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;An &lt;code&gt;undefined&lt;/code&gt; variable is a variable that has not yet been assigned a value.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;foo&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;foo&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// undefined&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Boolean&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;foo&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="c1"&gt;// false&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  &lt;code&gt;NaN&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;A variable that resolves to &lt;code&gt;NaN&lt;/code&gt; can be the result of an invalid math operation, such as 0/0 or sqrt(-1). A number is expected from a math operation, but the expression is invalid, so the result is not a (valid) number.&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;let&lt;/span&gt; &lt;span class="nx"&gt;foo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;foo&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// undefined &lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Boolean&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;foo&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="c1"&gt;// false&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  &lt;code&gt;""&lt;/code&gt; (empty string)
&lt;/h2&gt;

&lt;p&gt;Just what it sounds like: a variable that has been assigned to a string with no content.&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;let&lt;/span&gt; &lt;span class="nx"&gt;foo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;""&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;foo&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// (actually, nothing shows up)&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Boolean&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;foo&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="c1"&gt;// false&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  &lt;code&gt;false&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Just what it sounds like: a variable that has been assigned to a the boolean value &lt;code&gt;false&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;foo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;foo&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// false&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Boolean&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;foo&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="c1"&gt;// false&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  &lt;code&gt;0&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Just what it sounds like: a variable that has been assigned to &lt;code&gt;0&lt;/code&gt; or that resolves to &lt;code&gt;0&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;foo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;foo&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// 0&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Boolean&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;foo&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="c1"&gt;// false&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>beginners</category>
      <category>javascript</category>
    </item>
    <item>
      <title>How I set up a brand-new React app</title>
      <dc:creator>Analogy | Absence | Example</dc:creator>
      <pubDate>Mon, 12 Jul 2021 23:11:52 +0000</pubDate>
      <link>https://dev.to/mathlete/how-i-set-up-a-brand-new-react-app-5aj5</link>
      <guid>https://dev.to/mathlete/how-i-set-up-a-brand-new-react-app-5aj5</guid>
      <description>&lt;h3&gt;
  
  
  Create your first branch and push it the right way
&lt;/h3&gt;

&lt;p&gt;The first thing I do with a new app is to create a new git branch to work on so I'm not pushing to main. I never know what I'm going to do first, so I just call it "first". Yes, I know that's basic of me. Type the following into your terminal: &lt;code&gt;git checkout -b first&lt;/code&gt; or &lt;code&gt;git checkout -b whateveryouwannacallit&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Ok, so you've checked out a new branch called first. Once you're ready to make your initial push of the branch first to git, make sure you use the command &lt;code&gt;git push -u origin first&lt;/code&gt;. The added &lt;code&gt;u&lt;/code&gt; sets up tracking information so that during future pushes, you can do git pull without having to specify the remote or the branch.&lt;/p&gt;

&lt;h3&gt;
  
  
  Remove Unnecessary Cruft
&lt;/h3&gt;

&lt;p&gt;There's a bunch of files in your automatically-created new app that you don't necessarily need. Some people delete them but I just move them to a new folder I create called "DELETE" juuuuust in case I need them at some point down the road. They include the following:&lt;/p&gt;

&lt;p&gt;remove from &lt;code&gt;public&lt;/code&gt; directory:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;favicon.ico&lt;/li&gt;
&lt;li&gt;logo192.png&lt;/li&gt;
&lt;li&gt;logo512.png&lt;/li&gt;
&lt;li&gt;manifest.json&lt;/li&gt;
&lt;li&gt;robots.txt&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;remove from &lt;code&gt;src&lt;/code&gt; directory:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;App.test.js&lt;/li&gt;
&lt;li&gt;logo.svg&lt;/li&gt;
&lt;li&gt;reportWebVitals.js&lt;/li&gt;
&lt;li&gt;setupTests.js&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once I'm done, my directory looks like this:&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh7lkeoe53q8alp2spz2y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh7lkeoe53q8alp2spz2y.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Helpful Dependencies
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://react-bootstrap.github.io/" rel="noopener noreferrer"&gt;React-Bootstrap&lt;/a&gt; makes it super easy to build screen layouts with their &lt;a href="https://react-bootstrap.github.io/layout/grid/" rel="noopener noreferrer"&gt;Grid System&lt;/a&gt; of Containers, Rows, and Columns. It also has a ton of &lt;a href="https://react-bootstrap.github.io/components/alerts/" rel="noopener noreferrer"&gt;components for common UI widgets&lt;/a&gt; like Alerts, Breadcrumbs, Buttons, Forms, Modals, Navbars, and on and on. Install it with
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;npm&lt;/span&gt; &lt;span class="nx"&gt;install&lt;/span&gt; &lt;span class="nx"&gt;react&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;bootstrap&lt;/span&gt; &lt;span class="nx"&gt;bootstrap&lt;/span&gt;&lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;4&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mf"&gt;6.0&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://reactrouter.com/web/guides/quick-start" rel="noopener noreferrer"&gt;React Router Dom&lt;/a&gt; makes it easy to create static and dynamic (and bookmarkable) pages. Install it with
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;npm&lt;/span&gt; &lt;span class="nx"&gt;install&lt;/span&gt; &lt;span class="nx"&gt;react&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;router&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;dom&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Easy-Peasy ReadMe
&lt;/h3&gt;

&lt;p&gt;At some point, fill that &lt;code&gt;README&lt;/code&gt; with useful content by visiting &lt;a href="https://www.makeareadme.com/" rel="noopener noreferrer"&gt;MakeAReadMe.com&lt;/a&gt; which provides handy Read Me templates.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>react</category>
    </item>
    <item>
      <title>Props vs. State</title>
      <dc:creator>Analogy | Absence | Example</dc:creator>
      <pubDate>Tue, 06 Jul 2021 05:05:37 +0000</pubDate>
      <link>https://dev.to/mathlete/props-vs-state-3dme</link>
      <guid>https://dev.to/mathlete/props-vs-state-3dme</guid>
      <description>&lt;p&gt;&lt;code&gt;props&lt;/code&gt; and &lt;code&gt;state&lt;/code&gt; are extremely useful ways to store information in React. That said, they can be easily confused. Here's a basic primer that I wrote for myself to better understand both how they are different and how they can be used together.&lt;/p&gt;

&lt;h3&gt;
  
  
  Props
&lt;/h3&gt;

&lt;p&gt;Props are to components as parameters are to functions. Let's say you have a simple program to create a shopping list. You have a List component that shows all the items and a Form component where you can enter an item from scratch or edit an item that already exists. In the circumstance where you want to edit an item that already exists, you want to present the user with the Form component already populated with the item so that they can edit it from, say, "Milk" to "Soy Milk". In that case, you would call the &lt;code&gt;Form&lt;/code&gt; component with the item as the parameter, like &lt;code&gt;&amp;lt;Form item="Milk"&amp;gt;&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="p"&gt;...&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Form&lt;/span&gt; &lt;span class="nx"&gt;item&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Milk&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;Form&lt;/code&gt; component would reference that parameter as a &lt;code&gt;prop&lt;/code&gt; like so:&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;Form&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;input&lt;/span&gt; 
        &lt;span class="nx"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;text&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; 
        &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; 
        &lt;span class="nx"&gt;onChange&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;handleInputChange&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;currentTarget&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The important thing to remember about &lt;code&gt;props&lt;/code&gt; is that &lt;code&gt;props&lt;/code&gt; are read-only inside the component they are passed into. They must originate from outside the component, and they can only be updated outside the component.&lt;/p&gt;

&lt;h3&gt;
  
  
  State
&lt;/h3&gt;

&lt;p&gt;State, by contrast, is initialized inside the component and can be updated inside the component. &lt;/p&gt;

&lt;p&gt;A common and useful way to use &lt;code&gt;state&lt;/code&gt; with &lt;code&gt;props&lt;/code&gt; is to create a state variable from the passed-in prop. Then you can update the state variable however you want. Using the example above, you would do the following:&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;Form&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setItem&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="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;input&lt;/span&gt; 
        &lt;span class="nx"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;text&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; 
        &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; 
        &lt;span class="nx"&gt;onChange&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;handleInputChange&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;currentTarget&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  What to use for what
&lt;/h3&gt;

&lt;p&gt;Remember the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If you have a value that will be created (and possibly updated) from inside that component, you need to use &lt;code&gt;state&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;If you have a value that will be used inside a component that was created outside the component, just use &lt;code&gt;props&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;If you have a value that may be updated inside a component that was created outside the component, create a &lt;code&gt;state&lt;/code&gt; variable that is set to that &lt;code&gt;prop&lt;/code&gt; and update the &lt;code&gt;state&lt;/code&gt; variable as you wish.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>beginners</category>
      <category>javascript</category>
      <category>react</category>
    </item>
    <item>
      <title>How to create a new React app from scratch</title>
      <dc:creator>Analogy | Absence | Example</dc:creator>
      <pubDate>Tue, 29 Jun 2021 02:03:12 +0000</pubDate>
      <link>https://dev.to/mathlete/how-to-create-a-clean-new-react-app-from-scratch-9dc</link>
      <guid>https://dev.to/mathlete/how-to-create-a-clean-new-react-app-from-scratch-9dc</guid>
      <description>&lt;p&gt;&lt;em&gt;Note: I have been battle-testing this and reading similar blog posts about how to accomplish the same thing. If you have feedback, I want to hear it! Please comment if you disagree with anything or have a better way.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Since I spend a lot more of my time working on existing apps, I &lt;del&gt;often&lt;/del&gt; always forget how to properly create a React app from scratch that is (1) Properly tied to a git repository, and (2) has a proper &lt;code&gt;.gitignore&lt;/code&gt; file. So, I'm kinda making this post for myself, but since you somehow landed on this post, I bet it will help you too!&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Decide what you're gonna call it. It doesn't matter that much because the you can call the resulting webapp something totally different later. For this post, let's call our app &lt;code&gt;my-foo&lt;/code&gt; (no spaces are allowed, thus the hyphen).&lt;/li&gt;
&lt;li&gt;In VSCode, from the top menu, select File &amp;gt; New Window. Once the new window opens, select Terminal &amp;gt; New Terminal from the top menu or just type &lt;code&gt;^~&lt;/code&gt;. In the resulting terminal window, type &lt;code&gt;npx create-react-app my-foo&lt;/code&gt;. 
&lt;code&gt;npx&lt;/code&gt; stands for Node Package Executer. We use &lt;code&gt;npx&lt;/code&gt; instead of &lt;code&gt;npm&lt;/code&gt; (Node Package Manager) because &lt;code&gt;npm&lt;/code&gt; requires you to already have &lt;code&gt;npm&lt;/code&gt; installed, which may not be the case.&lt;/li&gt;
&lt;li&gt;Once it's done creating the react app you just told it to create, change directories into the new &lt;code&gt;my-foo&lt;/code&gt; folder by typing &lt;code&gt;cd my-foo&lt;/code&gt;. &lt;/li&gt;
&lt;li&gt;Now that you're in your new directory, it's time to initialize your remote git repository. &lt;/li&gt;
&lt;li&gt;Go to your github page, which should be something like &lt;code&gt;github.com/yourname&lt;/code&gt; (mine is &lt;code&gt;github.com/mathlete01&lt;/code&gt;), click on the Repositories like at the top, click the green &lt;code&gt;new&lt;/code&gt; button and create a new repo(sitory) called &lt;code&gt;my-foo&lt;/code&gt;. LEAVE ALL THE BOXES UNCHECKED.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--TRleprDc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nx3dbegtt0152gj7ohvh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--TRleprDc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nx3dbegtt0152gj7ohvh.png" alt="Alt Text" width="800" height="873"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Yay! Now you have a repo for &lt;code&gt;my-foo&lt;/code&gt;. &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;On the next screen, it will show three different options. We want the first one, pictured below. Github makes it easy by providing all the commands you need. They make it even easier by providing a button that will copy all those commands to your clipboard. Click that button, then return to your terminal window and paste. Voila!&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HSeEBbZw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gp95dvbgatbwnl5v7b15.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HSeEBbZw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gp95dvbgatbwnl5v7b15.png" alt="Alt Text" width="800" height="873"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now you have created a brand-new react app with a both a &lt;code&gt;.gitignore&lt;/code&gt; and a &lt;code&gt;README&lt;/code&gt; file that were created by the &lt;code&gt;create-react-app&lt;/code&gt; command. &lt;/p&gt;

&lt;p&gt;Now go build something great!&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>react</category>
      <category>github</category>
    </item>
    <item>
      <title>Are you a console.log addict? Add this snippet to make it faster, easier, and clearer to use.</title>
      <dc:creator>Analogy | Absence | Example</dc:creator>
      <pubDate>Mon, 21 Jun 2021 19:04:53 +0000</pubDate>
      <link>https://dev.to/mathlete/an-easy-peasy-handy-dandy-user-snippet-to-check-the-value-of-anything-in-vs-code-5h6n</link>
      <guid>https://dev.to/mathlete/an-easy-peasy-handy-dandy-user-snippet-to-check-the-value-of-anything-in-vs-code-5h6n</guid>
      <description>&lt;h3&gt;
  
  
  Our first debugging friend, the humble &lt;code&gt;console.log&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;One of the first things you learn when programming javascript is how to print a value to the output window. Let's say you declare a variable called &lt;code&gt;myVar&lt;/code&gt;, and your code has a statement like &lt;code&gt;myVar = 1+1&lt;/code&gt;. When you want to make sure that your code is doing what you expect-- 1 + 1 = 2, so &lt;code&gt;myVar&lt;/code&gt; should equal 2--you write &lt;code&gt;console.log(myVar)&lt;/code&gt;. When the interpreter reaches that line of code, you will miraculously see &lt;code&gt;2&lt;/code&gt; appear in the output window. &lt;/p&gt;

&lt;h3&gt;
  
  
  ...but it doesn't scale
&lt;/h3&gt;

&lt;p&gt;The problem is, once you are peppering your code with &lt;code&gt;console.log&lt;/code&gt; statements, it's hard to remember what all the values appearing in the output window refer to. The solution is to write a more verbose &lt;code&gt;console.log&lt;/code&gt; statement, like&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`myVar = $myVar`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;but that can be cumbersome after a while.&lt;/p&gt;

&lt;h3&gt;
  
  
  My solution
&lt;/h3&gt;

&lt;p&gt;My solution was to create a snippet in VSCode so that when I type a shortcut--mine is &lt;code&gt;consolel&lt;/code&gt; (like typing &lt;code&gt;console.log&lt;/code&gt; without the period--I get the following statement:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`foo = `&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;foo&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I then double-click &lt;code&gt;foo&lt;/code&gt;, type &lt;code&gt;⌘d&lt;/code&gt; to select the other &lt;code&gt;foo&lt;/code&gt;, then type in &lt;code&gt;myVar&lt;/code&gt; to replace both &lt;code&gt;foo&lt;/code&gt;s with &lt;code&gt;myVar&lt;/code&gt;. The result is the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`myVar = `&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;myVar&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;...and when you run the code, what you see in the output window is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;myVar&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;...instead of just&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="mi"&gt;2&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Isn't that nice?&lt;/p&gt;

&lt;h3&gt;
  
  
  Here's how to create a snippet to quickly and easily add descriptive &lt;code&gt;console.log&lt;/code&gt; statements
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;In VSCode, at the top menu, select Code &amp;gt; Preferences &amp;gt; User Snippets&lt;/li&gt;
&lt;li&gt;The Command Palette will open. Select "New Global Snippets File" and type in the name you want to use. Mine was &lt;code&gt;consolelog&lt;/code&gt;, so it created a file titled &lt;code&gt;consolelog.code-snippets&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Your new code-snippet file will have a bunch of commented-out text inside a set of curly braces explaining how to use it. At the bottom of the text, but &lt;em&gt;inside the last curly brace&lt;/em&gt;, add the following code:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;consolelog&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:{&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;prefix&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;consolelog&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;body&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;console.log(`foo = `, foo)&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;description&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Shortcut for a descriptive console.log statement&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

    &lt;span class="p"&gt;},&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When you're finished, the code should look 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="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Place your global snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and &lt;/span&gt;
    &lt;span class="c1"&gt;// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope &lt;/span&gt;
    &lt;span class="c1"&gt;// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is &lt;/span&gt;
    &lt;span class="c1"&gt;// used to trigger the snippet and the body will be expanded and inserted. Possible variables are: &lt;/span&gt;
    &lt;span class="c1"&gt;// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. &lt;/span&gt;
    &lt;span class="c1"&gt;// Placeholders with the same ids are connected.&lt;/span&gt;
    &lt;span class="c1"&gt;// Example:&lt;/span&gt;
    &lt;span class="c1"&gt;// "Print to console": {&lt;/span&gt;
    &lt;span class="c1"&gt;//  "scope": "javascript,typescript",&lt;/span&gt;
    &lt;span class="c1"&gt;//  "prefix": "log",&lt;/span&gt;
    &lt;span class="c1"&gt;//  "body": [&lt;/span&gt;
    &lt;span class="c1"&gt;//      "console.log('$1');",&lt;/span&gt;
    &lt;span class="c1"&gt;//      "$2"&lt;/span&gt;
    &lt;span class="c1"&gt;//  ],&lt;/span&gt;
    &lt;span class="c1"&gt;//  "description": "Log output to console"&lt;/span&gt;
    &lt;span class="c1"&gt;// }&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;consolelog&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:{&lt;/span&gt;
        &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;prefix&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;consolelog&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
        &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;body&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;console.log(`foo = `, foo)&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
                &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;description&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Shortcut for a descriptive console.log statement&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;Here's what's going on in the code. As it says in the commented-out text, "Each snippet is defined under a snippet name and has a scope, prefix, body and description." In this case, they are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Snippet Name:&lt;/strong&gt; &lt;code&gt;consolelog&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scope:&lt;/strong&gt; (I skipped &lt;code&gt;scope&lt;/code&gt; to make this global)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Prefix:&lt;/strong&gt; The shortcut you choose to summon this snippet, I chose &lt;code&gt;consolelog&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Body:&lt;/strong&gt; The text you want the snippet to create, wrapped in brackets and quotes&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Description:&lt;/strong&gt; Whatever you think best explains your snippet. I wrote "Shortcut for a descriptive console.log statement"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I hope this helps!&lt;/p&gt;

</description>
      <category>vscode</category>
      <category>beginners</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
