<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Nicole Zonnenberg</title>
    <description>The latest articles on Forem by Nicole Zonnenberg (@nikacodes).</description>
    <link>https://forem.com/nikacodes</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%2F126749%2Ffc1ffe1b-d25a-492d-a7a9-a8470a43be1d.png</url>
      <title>Forem: Nicole Zonnenberg</title>
      <link>https://forem.com/nikacodes</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/nikacodes"/>
    <language>en</language>
    <item>
      <title>Code Hot Takes</title>
      <dc:creator>Nicole Zonnenberg</dc:creator>
      <pubDate>Tue, 16 Apr 2024 12:43:31 +0000</pubDate>
      <link>https://forem.com/nikacodes/code-hot-takes-16kp</link>
      <guid>https://forem.com/nikacodes/code-hot-takes-16kp</guid>
      <description>&lt;h2&gt;
  
  
  What's your coding hot take?
&lt;/h2&gt;

&lt;p&gt;I'll go first:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Readability is more important than efficiency when writing code.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;i.e. Well written code can be picked up and understood by most software developers/engineers and does not require a lot of parsing or jargon understanding.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>discuss</category>
    </item>
    <item>
      <title>My Must Have VSCode Plugins</title>
      <dc:creator>Nicole Zonnenberg</dc:creator>
      <pubDate>Thu, 14 Dec 2023 22:13:40 +0000</pubDate>
      <link>https://forem.com/nikacodes/my-must-have-vscode-plugins-23c5</link>
      <guid>https://forem.com/nikacodes/my-must-have-vscode-plugins-23c5</guid>
      <description>&lt;p&gt;I was helping someone set up their computer for some L33T CODING 😎🤘 and after I left them to noodle around, I made a list of some of my preferred VSCode plugins that make &lt;em&gt;my&lt;/em&gt; life easier.&lt;/p&gt;

&lt;h3&gt;
  
  
  Code Editing and Productivity
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=formulahendry.auto-close-tag"&gt;&lt;strong&gt;Auto Close Tag&lt;/strong&gt;&lt;/a&gt;: Automatically generate and close HTML or XML tags as you type, reducing syntax errors and improving coding efficiency.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=formulahendry.auto-rename-tag"&gt;&lt;strong&gt;Auto Rename Tag&lt;/strong&gt;&lt;/a&gt;: Automatically renames paired HTML/XML tags, ensuring consistency.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker"&gt;&lt;strong&gt;Code Spell Checker&lt;/strong&gt;&lt;/a&gt;: Identifies and corrects spelling mistakes within code and comments, contributing to code quality, readability, and error prevention.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Version Control and Code History
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;a href="https://marketplace.visualstudio.com/items?itemName=waderyan.gitblame"&gt;&lt;strong&gt;GitBlame&lt;/strong&gt; (part of GitLens)&lt;/a&gt;: Provides detailed information about each line of code, including author, commit details and time stamp. (Usually you figure out the person who made the mistake was you all along.)&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  HTML and Markup Language Support
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=mikestead.dotenv"&gt;&lt;strong&gt;DotENV&lt;/strong&gt;&lt;/a&gt;: Makes reading and writing &lt;code&gt;.env&lt;/code&gt; files easier through syntax highlighting, auto-completion, and error detection.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=anteprimorac.html-end-tag-labels"&gt;&lt;strong&gt;HTML End Tag Labels&lt;/strong&gt;&lt;/a&gt;: Enhances readability and code accessibility by visually labeling closing tags, aiding in quick identification and preventing syntax errors.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=oderwat.indent-rainbow"&gt;&lt;strong&gt;Indent Rainbows&lt;/strong&gt;&lt;/a&gt;: Improves code indentation visibility by adding colorful highlighting to different levels of indentation, aiding in code readability, navigation, and error prevention.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Visual Enhancements and User Interface
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=PKief.material-icon-theme"&gt;&lt;strong&gt;Material Icon Theme&lt;/strong&gt;&lt;/a&gt;: This is a personal preference but I find these icons much easier to recognize.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=tal7aouy.rainbow-bracket"&gt;&lt;strong&gt;Rainbow Brackets&lt;/strong&gt;&lt;/a&gt;: Improves the visibility of nested structures, aiding in quick identification, and helps prevent bracket-related errors.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;What are some of your favorite plugins?&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>productivity</category>
      <category>vscode</category>
    </item>
    <item>
      <title>ReactJS Good Practices</title>
      <dc:creator>Nicole Zonnenberg</dc:creator>
      <pubDate>Wed, 01 Nov 2023 15:03:57 +0000</pubDate>
      <link>https://forem.com/nikacodes/reactjs-good-practices-59b3</link>
      <guid>https://forem.com/nikacodes/reactjs-good-practices-59b3</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Written as an exercise for my engineering cohort.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;React is a free and open-source front-end JavaScript library for building user interfaces based on components and state management. It is maintained by Meta and can be used to develop single-page, mobile, or server-rendered applications with frameworks like NextJS.&lt;/p&gt;

&lt;p&gt;ReactJS is a highly flexible framework that offers a wide range of features and capabilities to create highly interactive and dynamic user interfaces. It gives developers the flexibility to choose the best approach for their specific case, allowing for highly customizable and scalable applications. However, with this flexibility comes the responsibility to follow good practices to ensure the code is maintainable, efficient, and optimized.&lt;/p&gt;

&lt;p&gt;This document is a record of “good practices”–not “best practices”–as no project utilizing ReactJS has the same requirements or constraints. These are the methods we recommend that will produce good outcomes, but are not strict standards.&lt;/p&gt;

&lt;p&gt;At the end of this doc, you’ll also find a list of additional materials–resources, repos, tools, and playgrounds–where you can learn more about ReactJS and play with it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Our ReactJS good practices
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Componentization
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TLDR&lt;/strong&gt;: Break your application into smaller, simpler, reusable components.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A component is an independent and reusable piece of code. It serves the same purpose as JavaScript functions, but works in isolation and returns HTML.&lt;/p&gt;

&lt;p&gt;Each component should have a specific purpose and should only be responsible for rendering that particular functionality. A component should be reusable, easy to understand, and follow best practices for  state management and separation of concerns.&lt;/p&gt;

&lt;h3&gt;
  
  
  Class vs Functional Components
&lt;/h3&gt;

&lt;p&gt;Use functional components as much as possible, as they are simpler, more concise, and easier to test. Use class components when you need to implement lifecycle methods, stateful logic, or when you need to access refs when React Hooks does not support certain functions. For example: &lt;code&gt;getSnapshotBeforeUpdate&lt;/code&gt;, &lt;code&gt;getDerivedStateFromError&lt;/code&gt; (such as in Error Boundaries) and &lt;code&gt;componentDidCatch&lt;/code&gt; (&lt;a href="https://legacy.reactjs.org/docs/hooks-faq.html#do-hooks-cover-all-use-cases-for-classes"&gt;source&lt;/a&gt;).&lt;/p&gt;

&lt;h4&gt;
  
  
  Class Component
&lt;/h4&gt;

&lt;p&gt;Similar to functional component but has some additional features. The functional component does not care about the components in your app whereas the class components can work with each other.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;✔ Good Example - A class component that extends the Component class and has a render method that returns a simple JSX element.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Welcome&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Component&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;render &lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h1&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Hello&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;welcome&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h1&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;blockquote&gt;
&lt;p&gt;✖ Bad Example - The below example has a constructor method and binds the handleInputChange method to the component instance, which can cause unnecessary overhead. The component is also not reusable because it has hardcoded logic for setting the name state.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Welcome&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Component&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;super&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;welcome&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;welcome&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;handleInputChange&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;handleInputChange&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;bind&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&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;event&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setState&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;welcome&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nf"&gt;render&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h1&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;welcome&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h1&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;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;welcome&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;handleInputChange&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;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Functional Component
&lt;/h4&gt;

&lt;p&gt;Functional Components are JavaScript functions. Efficient functional components are used only when the component is not required to interact with any other components or require data from other components. They can inherit variables when called.&lt;/p&gt;

&lt;p&gt;We will often recommend functional components over class components, as functional components are simpler and easier to test.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;✔ Good Example - Takes an object as an argument and returns a simple JSX element; is reusable and easy to understand.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;Welcome&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="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h1&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="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;welcome&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h1&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Testing the above code would only require the test of the component’s single function (in this case, the welcome header).&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;✖ Bad Example - While the below code is equally as valid as the example above, it is more complicated and not single function. In this component, we’re not only dealing with showing the welcome header but also the input where the user can input a new name, the handling of that change, and state management.&lt;/p&gt;

&lt;p&gt;Testing the code below would require not only the header, but also the input, the event handler, and the state change.&lt;/p&gt;

&lt;p&gt;While that might seem manageable, code and applications can get complicated quickly. So for scalable purposes, keeping the components simple is a necessity.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;Welcome&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="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;welcome&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setWelcome&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;handleInputChange&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&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="nf"&gt;setName&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="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;h1&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;welcome&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h1&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;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;welcome&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;handleInputChange&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;
  
  
  Presentational vs. Container Components
&lt;/h3&gt;

&lt;p&gt;Presentational and container components can be either functional or class components. What separates these two components is their function in the overall application. &lt;/p&gt;

&lt;h4&gt;
  
  
  Presentational Component
&lt;/h4&gt;

&lt;p&gt;Presentational components are concerned with how things look. It receives data and behavior from parent components.&lt;/p&gt;

&lt;h4&gt;
  
  
  Container Component
&lt;/h4&gt;

&lt;p&gt;Container components are concerned with how things work. They provide the data and behavior to presentational or other container components.&lt;/p&gt;

&lt;h2&gt;
  
  
  Function Types
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;General Rules (TLDR)&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use &lt;strong&gt;function&lt;/strong&gt; in the global scope and for Object.prototype properties.&lt;/li&gt;
&lt;li&gt;Use class for object constructors.&lt;/li&gt;
&lt;li&gt;Use =&amp;gt; everywhere else.&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Arrow Functions
&lt;/h3&gt;

&lt;p&gt;While any arrow function can be replaced by a standard function, there would be little to gain from doing so.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why use arrow functions almost everywhere?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Scope safety&lt;/strong&gt;: When arrow functions are consistently used, everything is guaranteed to use &lt;a href="https://www.tutorialspoint.com/what-is-the-arrow-function-in-reactjs"&gt;the same thisObject as the root&lt;/a&gt;. A single standard function in combination with arrow functions can mess up the scope.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Code readability&lt;/strong&gt;: Arrow functions are easier to read and write. Also, when almost everything is an arrow function, any regular (named) function stands out for defining the scope.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;✔ Good Example - The below is an example of code that is simple and readable. It’s not hard to understand what is happening.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;comments&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[];&lt;/span&gt;
&lt;span class="nx"&gt;articles&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getList&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;articles&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;all&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="nx"&gt;articles&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;article&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;article&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;comments&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getList&lt;/span&gt;&lt;span class="p"&gt;())))&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;commentsLists&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;commentLists&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;reduce&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;concet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)));&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;comments&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;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;comments&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;comments&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;✖ Bad Example - The below code works the same as above and for all intents and purposes is perfectly reasonable code. However, there’s a lot of extra characters that make reading the code more difficult.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;comments&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[];&lt;/span&gt;
&lt;span class="nx"&gt;articles&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getList&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;articles&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
       &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;all&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;articles&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;article&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;article&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;comments&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getList&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
       &lt;span class="p"&gt;}));&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;commentLists&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
       &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;commentLists&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;reduct&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;concat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
       &lt;span class="p"&gt;});&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;comments&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
       &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;comments&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;comments&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}.&lt;/span&gt;&lt;span class="nf"&gt;bind&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Named Functions
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Why always use regular functions on the global scope or module scope?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;To differentiate the functions that should not access &lt;strong&gt;thisObject&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The &lt;strong&gt;window&lt;/strong&gt; object (global scope) is best addressed explicitly.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Many &lt;strong&gt;Object.prototype&lt;/strong&gt; definitions live in the global scope (i.e. &lt;strong&gt;String.prototype.truncate&lt;/strong&gt;, etc.). These generally have to be named functions and can help avoid errors.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Function declarations are &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function#function_declaration_hoisting"&gt;hoisted&lt;/a&gt; (meaning they can be accessed before they are declared), which is useful in a static utility function.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: Named functions can double as object constructors.&lt;/p&gt;

&lt;h3&gt;
  
  
  Object Constructors
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: If you don’t initialize state and you don’t bind methods, you don’t need to implement a constructor for components.&lt;/p&gt;

&lt;p&gt;Typically constructors are used for two purposes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Initializing local state by assigning an object to &lt;strong&gt;this.state&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Binding event handler methods to an instance.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Do not call setState()&lt;/strong&gt; in the constructor(). Instead, if your component needs to use local state, &lt;strong&gt;assign the initial state to this.state&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;constructor&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="p"&gt;{&lt;/span&gt;
   &lt;span class="k"&gt;super&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
   &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;counter&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="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;handleClick&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;handleClick&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;bind&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  State Management
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://react.dev/learn/state-a-components-memory"&gt;State&lt;/a&gt; should be managed in the component where it is needed, and props should be used to pass data and functionality between components.&lt;/p&gt;

&lt;h3&gt;
  
  
  Separation of Concerns
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TLDR&lt;/strong&gt;: Separation of concerns is the practice of separating different functionalities of an application into distinct and independent components, each responsible for a specific task.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This separation enables developers to manage and reason about different components independently, reducing the complexity of the application and making it easier to maintain and scale.&lt;/p&gt;

&lt;h3&gt;
  
  
  Keep State as Minimal as Possible
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TLDR&lt;/strong&gt;: State should only contain data that is necessary for the component to function.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Avoid using complex state structures to make it easier to manage and debug. There are multiple libraries to help manage complex state management such as &lt;a href="https://redux.js.org/"&gt;Redux&lt;/a&gt;, &lt;a href="https://hookstate.js.org/"&gt;Hookstate&lt;/a&gt;, etc.&lt;/p&gt;

&lt;h3&gt;
  
  
  React Hooks
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://react.dev/reference/react"&gt;React Hooks&lt;/a&gt; let you use state and other features within functional components. You must import individual hooks from react.&lt;/p&gt;

&lt;p&gt;It is possible to &lt;a href="https://www.w3schools.com/react/react_customhooks.asp"&gt;create custom react hooks&lt;/a&gt;. Custom Hooks start with &lt;strong&gt;use&lt;/strong&gt; (i.e. &lt;strong&gt;useFetch&lt;/strong&gt;).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Hook Rules:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Hooks can only be called inside React function components.&lt;/li&gt;
&lt;li&gt;Hooks can only be called at the top level of a component.&lt;/li&gt;
&lt;li&gt;Hooks cannot be conditional.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Event Handling
&lt;/h2&gt;

&lt;p&gt;React has its own &lt;a href="https://react.dev/learn/responding-to-events"&gt;event system&lt;/a&gt;. Avoid using native DOM events or directly modifying the state.&lt;/p&gt;

&lt;p&gt;Event handlers can pass a data argument using arrow functions. This can help race conditions that can occur.&lt;/p&gt;

&lt;p&gt;For example, &lt;strong&gt;useEffect&lt;/strong&gt; has a clean up function that we can take advantage of in two ways:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;If there are going to be several requests, but only want to render the last result, we can use a boolean flag.
&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="nf"&gt;useEffect&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;let&lt;/span&gt; &lt;span class="nx"&gt;active&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;fetchData&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
     &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(...);&lt;/span&gt;
     &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;newData&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&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;active&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nf"&gt;setFetchedId&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;id&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nf"&gt;setData&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;newData&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="nf"&gt;fetchData&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;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
     &lt;span class="nx"&gt;active&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&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;id&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the example above:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Changing &lt;strong&gt;props.id&lt;/strong&gt; will cause a re-render.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Every re-render will trigger the clean up function to run (setting &lt;strong&gt;active&lt;/strong&gt; to &lt;strong&gt;false&lt;/strong&gt;).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When &lt;strong&gt;active&lt;/strong&gt; is set to &lt;strong&gt;false&lt;/strong&gt;, the older requests won’t update the state.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The above example will still have a race condition (multiple requests), but only the results from the newest request will be used.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;If we don’t have users on Internet Explorer, we can use &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/AbortController"&gt;AbortController&lt;/a&gt;.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;abortController&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;AbortController&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
   &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;fetchData&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
         &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(...,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="na"&gt;signal&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;abortController&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;signal&lt;/span&gt;
         &lt;span class="p"&gt;});&lt;/span&gt;
         &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;newData&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
         &lt;span class="nf"&gt;setFetchedId&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
         &lt;span class="nf"&gt;setData&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;newData&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
         &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;AbortError&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="c1"&gt;// Aborting a fetch throws error&lt;/span&gt;
            &lt;span class="c1"&gt;// Cannot update state&lt;/span&gt;
         &lt;span class="p"&gt;}&lt;/span&gt;
         &lt;span class="c1"&gt;// Handle other errors&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
   &lt;span class="p"&gt;};&lt;/span&gt;
   &lt;span class="nf"&gt;fetchData&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;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;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
         &lt;span class="nx"&gt;abortController&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;abort&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;AbortController is initialized at the start of the effect.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/AbortController/signal"&gt;AbortController.signal&lt;/a&gt; is passed to &lt;strong&gt;fetch&lt;/strong&gt; as an option.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;AbortErrors are caught in the &lt;strong&gt;try&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Abort function is called inside the clean-up function.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Unlike the former example, the abort function cancels the in-flight HTTP requests so it will only show the last &lt;em&gt;successful&lt;/em&gt; request.&lt;/p&gt;

&lt;h2&gt;
  
  
  Type Checking
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TLDR&lt;/strong&gt;: It is recommended to use TypeScript when possible in addition to PropTypes for type checking. TypeScript &lt;em&gt;should&lt;/em&gt; catch all errors in compile, but having PropTypes will catch anything that snuck through at runtime.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A robust application should check and confirm that it is receiving and returning the right types of data. One of the weaknesses of JavaScript is how easily variables can change types.&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="c1"&gt;// The variable zero can be assigned the integer zero&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;zero&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// But then I can reassign it to a string&lt;/span&gt;
&lt;span class="nx"&gt;zero&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;zero&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two of the most common ways to check for type checking for React are PropTypes and/or TypeScript. Both can be used separately or together; both differ in how they work.&lt;/p&gt;

&lt;h3&gt;
  
  
  propTypes and defaultProps
&lt;/h3&gt;

&lt;p&gt;The PropTypes utility is available through the prop-types package. It is a runtime type-checking tool for props in React Applications. With PropTypes, you can define types of props expected in a component.&lt;/p&gt;

&lt;p&gt;However, PropTypes does not provide warnings in production applications. Warnings are only printed in development.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;PropTypes&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;prop-types&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Component&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;fullName&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;age&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;courses&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;enrolled&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="p"&gt;...&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nx"&gt;Component&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;propTypes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="na"&gt;fullName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Proptypes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;string&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;isRequired&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
   &lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Proptypes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;int&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;isRequired&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
   &lt;span class="na"&gt;courses&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Proptypes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;array&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
   &lt;span class="na"&gt;enrolled&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Proptypes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;bool&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;isRequired&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  TypeScript
&lt;/h3&gt;

&lt;p&gt;TypeScript is a free and open-source programming language that adds static typing with optional type annotations to JavaScript. Unlike PropTypes, which does type-checking while the application is running in the browser, TypeScript does type-checking during compile time when the TypeScript is compiled in JavaScript. It shows errors in the integrated development environment (IDE) so the problems can be caught earlier.&lt;/p&gt;

&lt;p&gt;Here is how the above example could be implemented in TypeScript:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kr"&gt;interface&lt;/span&gt; &lt;span class="nx"&gt;ComponentProps&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;fullName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;courses&lt;/span&gt;&lt;span class="p"&gt;?:&lt;/span&gt; &lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;enrolled&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;boolean&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Components&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;FC&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;ComponentProps&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="nx"&gt;fullName&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;age&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;courses&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;enrolled&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="c1"&gt;// ...&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This means that the application will not compile if the code tries to assign a variable that has been assigned one data type (re: a number) another data type (re: a string).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: Both TypeScript and PropTypes will not catch these issues in production.&lt;/p&gt;

&lt;h2&gt;
  
  
  Debugging
&lt;/h2&gt;

&lt;h3&gt;
  
  
  React Developer Tools
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TLDR&lt;/strong&gt;: Browser extension for debugging and inspecting React components. It helps visualize components and their state in real time.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The easiest way to debug websites built with React is to install the &lt;a href="https://react.dev/learn/react-developer-tools"&gt;React Developer Tools&lt;/a&gt; browser extension. It is available for several popular browsers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi?hl=en"&gt;Install for Chrome&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://addons.mozilla.org/en-US/firefox/addon/react-devtools/"&gt;Install for Firefox&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://microsoftedge.microsoft.com/addons/detail/react-developer-tools/gpphkfbcpidddadnkolkpfckpihlkkil"&gt;Install for Edge&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Testing
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Recommended Testing Frameworks &amp;amp; Utilities:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/facebook/jest"&gt;Jest&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/testing-library/react-testing-library"&gt;React Testing Library&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/mpeyper/react-hooks-testing-library"&gt;React Hooks Testing Library&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Tips &amp;amp; Tricks
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Avoid Copying Props to State
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;⚠ This is a common mistake:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;constructor&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="p"&gt;{&lt;/span&gt;
   &lt;span class="k"&gt;super&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
   &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;color&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 problem is that it’s both unnecessary (you can use &lt;strong&gt;this.props.color&lt;/strong&gt; directly) and creates bugs (updates to the color prop won’t be reflected in the state).&lt;/p&gt;

&lt;h3&gt;
  
  
  Error Boundaries
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Class components that catch all errors/exceptions thrown at children component levels.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: ErrorBoundaries should be declared as class components because they do not support functional components.&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="c1"&gt;// ErrorBoundary Component&lt;/span&gt;
&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ErrorBondary&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Component&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;super&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;hasErrors&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="nf"&gt;getDerivedStateFromError&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;hasError&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="nf"&gt;render &lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;hasError&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;ErrorMessage&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;children&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Linting
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://eslint.org/"&gt;EsLint&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://prettier.io/"&gt;Prettier&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  React Fragments
&lt;/h3&gt;

&lt;p&gt;Individual components can only return a single element. With Fragment (imported from react), you can group elements together but it does not add any element in the DOM.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Fragment&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Frag&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Fragment&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;ComponentA&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;ComponentB&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/Fragment&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="c1"&gt;// Or after Babel 7&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;NewFrag&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;ComponentA&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;ComponentB&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;  
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/&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;h2&gt;
  
  
  Additional materials
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Official Resources
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://reactjs.org/docs"&gt;React Documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/facebook/react"&gt;React Github&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://reactjs.org/"&gt;React Official Website&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://reactjs.org/tutorial/tutorial.html"&gt;ReactJS Tutorial&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Certifications &amp;amp; Courses
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://egghead.io/q?q=react"&gt;Egghead.io&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://epicreact.dev/"&gt;Epic React&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.coursera.org/professional-certificates/meta-front-end-developer"&gt;Meta Front-End Developer Professional Certificate&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Communities
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.reactiflux.com/"&gt;Reactiflux Discord Channel&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://stackoverflow.com/questions/tagged/reactjs"&gt;React SlackOverflow&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Frameworks
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://blitzjs.com/"&gt;Blitz&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/gatsbyjs/gatsby"&gt;GatsbyJS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/vercel/next.js"&gt;NextJS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/marmelab/react-admin"&gt;React Admin&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Playgrounds
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Interactive:

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://playcode.io/react"&gt;https://playcode.io/react&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://stackblitz.com/edit/react-playground-practice?"&gt;https://stackblitz.com/edit/react-playground-practice&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


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

&lt;h3&gt;
  
  
  Resources and Tools
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://react.dev/learn/start-a-new-react-project"&gt;Start a New React App &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/markerikson/react-redux-links"&gt;React-Redux Links&lt;/a&gt; - List of tutorials and resources for React/Redux.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://react.dev/learn/react-developer-tools"&gt;React Developer Tools&lt;/a&gt; - Inspection of React component hierarchy&lt;/li&gt;
&lt;li&gt;&lt;a href="https://react-hook-form.com/get-started"&gt;React Hook Form&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/gaearon/react-hot-loader"&gt;React Hot Loader&lt;/a&gt; - Tweak React components in real time&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/jamiebuilds/react-loadable"&gt;React Loadable&lt;/a&gt; - A higher order component for loading components with promises&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/ReactTraining/react-router"&gt;React Router&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://storybook.js.org/tutorials/intro-to-storybook/react/en/get-started/"&gt;Storybook&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://tsdx.io/"&gt;tsdx&lt;/a&gt; - Zero-config CLI for TypeScript package development&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>react</category>
    </item>
    <item>
      <title>The Best* Tech Interview</title>
      <dc:creator>Nicole Zonnenberg</dc:creator>
      <pubDate>Thu, 09 Feb 2023 20:52:52 +0000</pubDate>
      <link>https://forem.com/nikacodes/the-best-tech-interview-1gac</link>
      <guid>https://forem.com/nikacodes/the-best-tech-interview-1gac</guid>
      <description>&lt;p&gt;*At the date of this article.&lt;/p&gt;

&lt;p&gt;I do not know many people who would claim to love interviewing for jobs. The interview process can feel like torture, especially when there are multiple hurdles to clear before the final hired/not hired answer. It has become the norm to talk with multiple people on different rungs of a company ladder, emphasizing not just about the job, but benefits, company culture, and possibly more.&lt;/p&gt;

&lt;p&gt;In the tech industry, a necessary evil is the tech interview as a way to assess an applicant's technical skill. After tens of tech interviews, I can confidently say I have not experienced the same tech interview twice. They have ranged from understandable to infuriating, making me wonder how the interviewers could possibly know my skills well enough for the job I was applying to.&lt;/p&gt;

&lt;p&gt;I have written out code on paper and white board; done quizzes; created a small app from scratch; live coded while one or more interviewers watched on; answered questions about hypothetical scenarios, to name a few types of technical interviews.&lt;/p&gt;

&lt;p&gt;At best, I would remain neutral about the job; at worst, it would leave me discouraged about the whole interview process.&lt;/p&gt;

&lt;p&gt;But this article is about one tech interview that was different.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Full disclosure:&lt;/strong&gt; I didn't end up getting the job. But the interview has stuck with me. And I wanted to share what made it such a good experience so that other engineers could be on the lookout for similar green flags in the hiring process.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Technical Interview:
&lt;/h2&gt;

&lt;h3&gt;
  
  
  The Process
&lt;/h3&gt;

&lt;p&gt;After a 40 minute screening call with the recruiter, I was given the outline of the next part of my application process for a full stack engineer position. I would have two tech interviews, one for backend code and one for frontend. 48 hours (minimum) before the scheduled tech interviews, I would be given access to the relevant pull request (frontend or backend), that would mock code from a supposed teammate for me to review through asynchronous comments.&lt;/p&gt;

&lt;p&gt;The technical interview would go over my background, my comments, and continue from there over the course of 90 minutes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Receive and review two Pull Requests before the respective interviews.
&lt;/h3&gt;

&lt;p&gt;While I was told that I would have up to 48 hours for both pull requests (commonly known as PRs), I was given over a week with each pull request. Without even starting the actual PR reviews, the company was making sure &lt;strong&gt;I had some knowledge of git&lt;/strong&gt;; that I could clone the repo with the PR branch down to my computer and run the code locally.&lt;/p&gt;

&lt;p&gt;The exercise itself was &lt;strong&gt;clearly mimicking a regular task in the day-to-day&lt;/strong&gt; for the job I applied for. By reviewing code, I was asked to read, interpret, and &lt;strong&gt;form meaningful opinions&lt;/strong&gt; about the code and communicate those opinions through written comments. The instructions linked to a page for a &lt;a href="https://conventionalcomments.org/"&gt;preferred comment convention&lt;/a&gt;, which &lt;strong&gt;checked my attention to detail and ability to follow directions&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In practice, this task showcased &lt;strong&gt;my communication skills asynchronously and through text&lt;/strong&gt;, a must for most collaborative coding projects nowadays. I made sure to offer solutions when I found ways the code could be improved. I also made sure to comment on what I thought the PR author did well or if I learned something from their code.&lt;/p&gt;

&lt;p&gt;Overall, I was thrilled because I could take my time with it. The PRs were small and gave both myself and my interviewers an idea of what it would be like if I was a member of their team.&lt;/p&gt;

&lt;p&gt;I also double checked whether or not my solutions worked locally before I made the comment. This really helped me in the next step:&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: A 90 minute tech interview.
&lt;/h3&gt;

&lt;p&gt;I have had technical interviews as short as twenty minutes and as long as three or more hours, so this was definitely on the longer side. For most of those interviews, I was lucky to even have an idea of what to expect. This was the rare occasion I felt incredibly prepared because of my previous task of reviewing the pull requests ahead of time.&lt;/p&gt;

&lt;p&gt;The first 15 to twenty 20 was spent on introductions, a very light overview of what the interview would entail, and then a walkthrough of my comments and the code itself. I was given a chance to clarify and expand on any of my comments.&lt;/p&gt;

&lt;p&gt;After that, we spent the majority of the time “pair coding” as I “took over” the pull request and applied the changes I had commented/recommended in the PR review.&lt;/p&gt;

&lt;p&gt;I think this is a &lt;em&gt;brilliant&lt;/em&gt; way to do a live coding interview. At this point, I already had a*&lt;em&gt;t least 48 hours with this code&lt;/em&gt;* and took advantage of it. I had tried out several of my suggestions to make sure they worked before I left my comments. And, once again, &lt;strong&gt;it mimicked a real-life situation that I would probably experience on their team&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The interviewers were mostly silent, allowing me to “drive” or lead the live coding exercise. However, they were not completely passive. I was allowed (and did) ask questions as we combed through the code. In one situation, I clarified that I would ask the product/design team if there were any conventions when changing the layout on the frontend and confirmed that normally I would use an existing component library. I was able to &lt;strong&gt;convey that I understood the makeup of a tech team and how to work with different disciplines&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Another example of this interview giving a real pair coding experience is that the engineer was able to see that I understood the code and the end goal, but for whatever reason was not able to find the best answer for the framework. This allowed him to course correct, and I was not stuck for too long on a problem that I could have figured out given more time, but didn't let me wallow in fruitless internet searches.&lt;/p&gt;

&lt;p&gt;This pair coding exercise was also a chance for me to &lt;strong&gt;get a feel for the company’s culture&lt;/strong&gt;. Beyond the still present pressure of an interview, the facilitators treated the sessions like we were already teammates. They talked with me through my solutions, sometimes tweaking the parameters to see how I might solve a slightly different problem.&lt;/p&gt;

&lt;p&gt;On more than one occasion, both interviewers were able to point out specific tricks that were unique to the frameworks or practices their team preferred. &lt;strong&gt;They were quick to affirm that I was on the right track and only helped me when it was obvious I would figure it out given enough time on my own&lt;/strong&gt;, but wanted to see what I would do at the next step before time ran out.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thoughts:
&lt;/h2&gt;

&lt;p&gt;How often has a promising candidate been hired and started, only for their team to later learn that  they’re unwilling to learn a new stack or practice? Or that they grate with other teammates or the scrum master? Or that they have a rigid way of thinking that makes any sort of communication painful?&lt;/p&gt;

&lt;p&gt;Or, from the candidate’s side, &lt;strong&gt;how often does the interview feel like an honest representation of the company and the job they are looking to fill?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The process described above, while not perfect, left me feeling like I was able to show my range of knowledge and skills (both “hard”--writing code, problem solving--and “soft”--communication, teamwork). I was not frustrated and worried that I didn’t know what the company was looking for or wondering how I could have done better in the moment. While I was disappointed when I wasn’t offered the job, it was a valuable learning experience. I had a good idea of what skills to improve on.&lt;/p&gt;

&lt;p&gt;I can only guess what it was like on the interviewer’s side, but I felt like they had the best picture of me as a candidate and potential employee/teammate. When they said no, they must have felt confident I wasn’t right for the job. And honestly? If that’s the case, I’m glad I didn’t get the job. That’s what a good hiring process is for; it’s a place where both the candidate and the company get to evaluate each other to make sure it’s a good fit.&lt;/p&gt;

&lt;h2&gt;
  
  
  Connect with Me
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://twitter.com/NikaCodes"&gt;Twitter&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/Sun-Mountain"&gt;GitHub&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://sun-mountain.io"&gt;Website&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>career</category>
      <category>community</category>
    </item>
    <item>
      <title>What are the best questions you can ask as an interviewee?</title>
      <dc:creator>Nicole Zonnenberg</dc:creator>
      <pubDate>Wed, 20 Nov 2019 15:28:38 +0000</pubDate>
      <link>https://forem.com/nikacodes/what-are-the-most-important-questions-you-can-ask-as-an-interviewee-2bm4</link>
      <guid>https://forem.com/nikacodes/what-are-the-most-important-questions-you-can-ask-as-an-interviewee-2bm4</guid>
      <description>&lt;p&gt;When you are interviewing for a job, what are some of the best questions you can ask to determine that if the company is a good fit for &lt;em&gt;you?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This is a great way to communicate what &lt;em&gt;you're&lt;/em&gt; looking for in a company. It's one of the few times you have almost full control in the interview. Not to mention, it can show the company that you are taking this as seriously as they (hopefully) are.&lt;/p&gt;

&lt;p&gt;Some of mine include:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;What is the turnover rate at your company?&lt;p&gt;&lt;em&gt;Turn over is normal for any company, but I'm always wary of companies that have a high turnover rate or claim to have a very low or non-existent turn over. Some companies can be very upfront with having a high turn over rate, whether it's their industry or their culture.&lt;/em&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;Do you and your colleagues spend time together outside of work?&lt;p&gt;&lt;em&gt;Or "Do you and your team eat lunch together often?" This (hopefully) conveys I'm looking for a good/healthy work relationship with my future coworkers.&lt;/em&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;Is there an opportunity for mentorship at your company?&lt;p&gt;&lt;em&gt;Not a requirement, but it shows that a company has an interest in their employee's growth in their positions, skills, etc.&lt;/em&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;Is there an opportunity for continued education?&lt;p&gt;&lt;em&gt;Working in tech, we are dealing with constant changes in languages, tools, and applications. Most companies I've interviewed with either provide a stipend or will subsidize classes, courses, and conferences. Again, not a deal breaker, but it shows the company is willing to invest in its employees.&lt;/em&gt;&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/egSqD74685gzK/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/egSqD74685gzK/giphy.gif" alt='GIF: one man asks "what are your qualifications?" the next man asks "what are YOUR qualifications?" with an emphasis on the your. The first man shakes his head.'&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>career</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Cover Your Base (Element)</title>
      <dc:creator>Nicole Zonnenberg</dc:creator>
      <pubDate>Sun, 12 May 2019 13:51:25 +0000</pubDate>
      <link>https://forem.com/nikacodes/cover-your-base-element-5502</link>
      <guid>https://forem.com/nikacodes/cover-your-base-element-5502</guid>
      <description>&lt;p&gt;The &lt;code&gt;&amp;lt;base&amp;gt;&lt;/code&gt; tag is a child of the &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt; tag that can pass down a specific URL to all link elements in an HTML document.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
    // If the &lt;span class="nt"&gt;&amp;lt;base&amp;gt;&lt;/span&gt; tag contains a URL

    &lt;span class="nt"&gt;&amp;lt;base&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"http://fakeurl.dev/"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can write &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; tags as the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;// A simple &lt;span class="nt"&gt;&amp;lt;a&amp;gt;&lt;/span&gt; tag without a specific 
&lt;span class="nt"&gt;&amp;lt;a&amp;gt;&lt;/span&gt;Link One&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;

// An anchor
&lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"#anchor"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Link Two&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;

// A path from the original index.html of the URL
&lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"/fakepath"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Link Three&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The links will direct as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;// A simple &lt;span class="nt"&gt;&amp;lt;a&amp;gt;&lt;/span&gt; tag without a specific 
&lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"http://fakeurl.dev/"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Link One&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;

// An anchor
&lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"http://fakeurl.dev/#anchor"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Link Two&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;

// A path from the original index.html of the URL
&lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"http://fakeurl.dev/fakepath"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Link Three&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also pass down a specific attribute, such as a &lt;code&gt;target&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;base&lt;/span&gt; &lt;span class="na"&gt;target=&lt;/span&gt;&lt;span class="s"&gt;"_blank"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    // will ensure that all links will open in a separate tab.
&lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; There can only be one &lt;code&gt;&amp;lt;base&amp;gt;&lt;/code&gt; tag in a head. If there is more than one it will recognize only the first &lt;code&gt;href&lt;/code&gt; and &lt;code&gt;target&lt;/code&gt; values.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base"&gt;Further reading.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://codepen.io/sdras/pen/KLzyqr"&gt;CodePen Example&lt;/a&gt; by &lt;a href="https://twitter.com/sarah_edo"&gt;Sarah Drasner&lt;/a&gt;&lt;/p&gt;

</description>
      <category>html</category>
      <category>webdev</category>
      <category>frontend</category>
    </item>
    <item>
      <title>My Bootcamp Experience</title>
      <dc:creator>Nicole Zonnenberg</dc:creator>
      <pubDate>Thu, 11 Apr 2019 15:40:46 +0000</pubDate>
      <link>https://forem.com/nikacodes/my-bootcamp-experience-4jh</link>
      <guid>https://forem.com/nikacodes/my-bootcamp-experience-4jh</guid>
      <description>&lt;h2&gt;
  
  
  Before
&lt;/h2&gt;

&lt;p&gt;The day before I started my coding bootcamp, this is what my car looked like:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F628d5h8m4013i1r24loj.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F628d5h8m4013i1r24loj.jpg"&gt;&lt;/a&gt;&lt;/p&gt;
Don't worry, my insurance covered it and I got it fixed before the end of the month.



&lt;p&gt;This would not be my only car troubles over the course of the next three months, but it certainly would be the worst. I don't remember being angry or upset, just sighing and adding it to my &lt;em&gt;very long&lt;/em&gt; to do list.&lt;/p&gt;

&lt;p&gt;In less than 24 hours, I was going to start the Web Development Immersive at General Assembly (GA). Needless to say, I had a lot of other things on my mind. Like how for the next three months I was going to commute from Baltimore to DC, five days a week, for 9 to 5 classes where I would learn over 10 different programming languages and practices.&lt;/p&gt;

&lt;p&gt;Over the course of 2018, I had been taking stock of my life, where I was, where I wanted to go, &lt;em&gt;what&lt;/em&gt; I wanted. College had not answered these questions, so I was reluctant to go back to any formal schooling.&lt;/p&gt;

&lt;p&gt;I had the benefit of being self taught in HTML, CSS, and some JavaScript, so coding and the logic was not completely foreign to me. I was, in fact, working as a freelance front-end/email developer when I applied to GA. I was enjoying the work, but didn't feel confident enough to apply to any full time positions.&lt;/p&gt;

&lt;p&gt;After talking with friends who had completed similar programs for similar reasons (a.k.a. a complete overhaul in their career) and research into programs that met my qualifications (specifically, I wanted an in person experience), I applied and was accepted to GA.&lt;/p&gt;

&lt;h2&gt;
  
  
  During
&lt;/h2&gt;

&lt;p&gt;To say that GA made sure we had realistic expectations is probably an understatement. While reviewing our HTML, CSS, and Javascript pre-work, they made sure that we understood what we had signed up for.&lt;/p&gt;

&lt;p&gt;One way they chose to illustrate this is with a graph:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F2p8rjt7ct2e074bodd6p.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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F2p8rjt7ct2e074bodd6p.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There were days where around 4pm I was so overwhelmed I could not take in any more information and had to listen to static or instrumental music on the train.&lt;/p&gt;

&lt;p&gt;My class quickly learned that this wasn't going to operate like any other class setting we had experience with. The teachers could not afford to answer every question in depth until we were satisfied, otherwise we would not cover everything in the lesson and there was zero room in the schedule to recover any time lost.&lt;/p&gt;

&lt;p&gt;If something wasn't covered in class, it was up to us to do the extra legwork in addition to whatever supplementary work was assigned for after hours.&lt;/p&gt;

&lt;p&gt;After three solid months of this, I can now say with confidence that it was more like this graph:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fwqrltlfj3vhz1r0r3534.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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fwqrltlfj3vhz1r0r3534.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I feel lucky to have had such patient teachers, who did try to answer our questions to the best of their abilities without digging into too much of our time.&lt;/p&gt;

&lt;p&gt;Requiring us to learn the material on our own on some level helped instill a sense of self-reliance that we will carry with us throughout our developer careers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Lessons Learned at GA
&lt;/h2&gt;

&lt;h4&gt;
  
  
  (That Wasn't Just Coding)
&lt;/h4&gt;

&lt;h3&gt;
  
  
  Sleep is important.
&lt;/h3&gt;

&lt;p&gt;Sacrificing sleep may help to finish one or two assignments, it greatly decreased the likelihood I would be mentally present in a lesson. Not to mention the amount of times I went to sleep grumbling about a problem and then waking up, looking at it with fresh eyes, and solving it in minutes.&lt;/p&gt;

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

&lt;h3&gt;
  
  
  Make friends.
&lt;/h3&gt;

&lt;p&gt;While I may be skeptical sometimes when authority figures tell me "This is the best class I've ever taught", I somewhat believed them when it came to my cohort. We were a strong mix of different strengths that complimented each other almost scarily well. Not only did it emphasize the strengths of team coding, but it also helped to have people to commiserate with when our lessons got particularly challenging.&lt;/p&gt;

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

&lt;h3&gt;
  
  
  Be Honest
&lt;/h3&gt;

&lt;p&gt;With yourself. With your teachers. Know when the struggle is what's helping you vs. hindering you. Know your limits. Let your friends know how you're doing, and not just when things are going well.&lt;/p&gt;

&lt;p&gt;Because here's the real truth: &lt;strong&gt;No one wants you to fail.&lt;/strong&gt; Not your family, not your friends, not your bootcamp. Everyone wants you to live your best life, but they can't help you unless you tell them when you need help.&lt;/p&gt;

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

&lt;p&gt;Before my time at GA even started, I told a good friend not in the program how I thought it would go. &lt;/p&gt;

&lt;blockquote&gt;
"I'll probably start off super excited and killing it. Then will come the mid-slog where you won't see me for weeks, or if you do, I'll look like the undead. And then, just when I'm close to the finish line, when I'm almost done, I'll be ready to give up everything because I'll be impatient to move on to whatever's next."
&lt;/blockquote&gt;

&lt;p&gt;And lo and behold, it played out almost exactly how I predicted. When I was two weeks out from graduation and pretty much over everything, my friend patiently reminded me that I had predicted all of this and gave me a much needed pep talk.&lt;/p&gt;

&lt;h2&gt;
  
  
  After
&lt;/h2&gt;

&lt;p&gt;The relief that I felt after completing GA was quickly replaced with the anxiety of a job search. Now, you're probably going to roll your eyes when I tell you how long my search was, but searching for a job without any regular work to rely on for an income brought me to a very dark place. I suffer from anxiety and depression and when the rejections, however polite, started rolling in, it was difficult.&lt;/p&gt;

&lt;p&gt;I relied a lot on my friends, who took great pleasure in reminding me how everything worked out when I happily accepted a job a mere two weeks after graduation.&lt;/p&gt;

&lt;p&gt;I'm thrilled to be able to say that I accepted a position as a JavaScript Dev consultant with the US Coast Guard, which honestly feels unreal.&lt;/p&gt;

&lt;p&gt;It also means DC isn't done with me yet!&lt;/p&gt;

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

&lt;p&gt;I am so grateful for the experience at GA and everyone who supported me in any way. And I can't wait to see what this next chapter of my life holds.&lt;/p&gt;

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

&lt;h2&gt;
  
  
  Some Numbers
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;143&lt;/strong&gt; hours of transportation (roughly)&lt;br&gt;
&lt;strong&gt;38&lt;/strong&gt; days of formal instruction&lt;br&gt;
&lt;strong&gt;36&lt;/strong&gt; hours of audio books listened to&lt;br&gt;
&lt;strong&gt;20&lt;/strong&gt; (ish) days dedicated to projects&lt;br&gt;
&lt;strong&gt;5&lt;/strong&gt; days of being moderately sick&lt;br&gt;
&lt;strong&gt;4&lt;/strong&gt; portfolio worthy projects&lt;br&gt;
&lt;strong&gt;3&lt;/strong&gt; dance events where I was on staff&lt;br&gt;
&lt;strong&gt;2&lt;/strong&gt; flat tires (so many car troubles!)&lt;br&gt;
&lt;strong&gt;1&lt;/strong&gt; job in web development!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>blog</category>
      <category>bootcamp</category>
      <category>personal</category>
    </item>
    <item>
      <title>Making An Animated Timer With CSS &amp; JavaScript</title>
      <dc:creator>Nicole Zonnenberg</dc:creator>
      <pubDate>Mon, 25 Feb 2019 21:07:48 +0000</pubDate>
      <link>https://forem.com/nikacodes/making-an-animated-timer-with-css--javascript-jpa</link>
      <guid>https://forem.com/nikacodes/making-an-animated-timer-with-css--javascript-jpa</guid>
      <description>&lt;p&gt;With my time at General Assembly rapidly coming to an end, there is less direct instruction and more encouraging us to play in the huge sandbox that is web development. Recently, an entire day was dedicated to us teaching ourselves either the beginnings of another language or skill not covered by GA's curriculum.&lt;/p&gt;

&lt;p&gt;I chose to create a JavaScript Timer with CSS animations.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why did I choose this subject?
&lt;/h2&gt;

&lt;p&gt;I have an idea for my capstone project that would be greatly enhanced visually by CSS Animation triggered via JavaScript.&lt;/p&gt;

&lt;h2&gt;
  
  
  What problem does it solve? / Why does one use it?
&lt;/h2&gt;

&lt;p&gt;It doesn't so much solve a problem but has the potential to make an existing project more aesthetically pleasing to the user.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/nzonnenberg/basic-color-theory-for-web-developers-15a0"&gt;Being visually pleasing makes user interface easier to understand&lt;/a&gt; and navigate as well as easier to sell to potential buys or users.&lt;/p&gt;

&lt;h2&gt;
  
  
  What are the alternatives?
&lt;/h2&gt;

&lt;p&gt;I would have little to no styling or a static webpage where the only moving part is the JavaScript timer, which can look fairly unappealing or boring.&lt;/p&gt;

&lt;h1&gt;
  
  
  Teaching Myself
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Step One - Making the timer.
&lt;/h2&gt;

&lt;p&gt;Luckily the internet--in its vast wealth of information--has many examples of JavaScript timers. I used one from &lt;a href="https://www.w3schools.com/howto/howto_js_countdown.asp"&gt;w3schools&lt;/a&gt; and modified it to my specifications (counting down from 1 minute).&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Note&lt;/strong&gt;: I also had it restart at 1 minute after the timer reached 0 in order to make sure the animation worked more than once in a page load.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step Two - Add basic CSS styling.
&lt;/h2&gt;

&lt;p&gt;Determine what a static version of my countdown timer will look like and define any necessary classes. (This was easy enough.)&lt;/p&gt;

&lt;h2&gt;
  
  
  Step Three - Learn About Animation.
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Animation vs. Transition&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A &lt;strong&gt;transition&lt;/strong&gt; is applied to an element and specifies a change that happens gradually over a period of time.&lt;/p&gt;

&lt;p&gt;An &lt;strong&gt;animation&lt;/strong&gt; just runs in the background regardless of anything else happening via the user or the rest of the website.&lt;/p&gt;

&lt;p&gt;At this point I realized that the title of this whole project (&lt;em&gt;Making An Animated Timer With CSS &amp;amp; JavaScript&lt;/em&gt;) is a lie. What I am actually making is a &lt;em&gt;Transitional Timer&lt;/em&gt; with CSS &amp;amp; JavaScript.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step Four - Add animation independent of JS
&lt;/h2&gt;

&lt;p&gt;I was able to add a div that would shrink over the course of a designated time in the CSS code.&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;.visual-timer&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;border-top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;50px&lt;/span&gt; &lt;span class="nb"&gt;solid&lt;/span&gt; &lt;span class="m"&gt;#004D00&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;5%&lt;/span&gt; &lt;span class="nb"&gt;auto&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="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;.width-change&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c"&gt;/* Animation code */&lt;/span&gt;
    &lt;span class="nl"&gt;-webkit-animation-name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;widthChange&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c"&gt;/* Safari 4.0 - 8.0 */&lt;/span&gt;
    &lt;span class="nl"&gt;-webkit-animation-duration&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;60s&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c"&gt;/* Safari 4.0 - 8.0 */&lt;/span&gt;
    &lt;span class="nl"&gt;animation-name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;widthChange&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;animation-duration&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;60s&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;@keyframes&lt;/span&gt; &lt;span class="n"&gt;widthChange&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nt"&gt;from&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="m"&gt;600px&lt;/span&gt;&lt;span class="p"&gt;;}&lt;/span&gt;
    &lt;span class="nt"&gt;to&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="m"&gt;0px&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;
  
  
  Step Five - connect the start of the animation with the start of JS function
&lt;/h2&gt;

&lt;p&gt;By adding  &lt;code&gt;visualTimer.classList.add("width-change");&lt;/code&gt;  at the beginning of the function I am able to initiate the animation when the timer started to count down. However, it would only work once and then not re-initiate when the timer reset.&lt;/p&gt;

&lt;p&gt;This was easily fixed by adding  &lt;code&gt;visualTimer.classList.remove("width-change");&lt;/code&gt;  when the timer reset, allowing the function to re-initialize the animation when the function looped thru.&lt;/p&gt;

&lt;h2&gt;
  
  
  What are the biggest conceptual hurdles (if any) you encountered when researching this?
&lt;/h2&gt;

&lt;p&gt;At this point, I was still not happy with how the animation didn't reflect the timer exactly. It was not consistent so that it was over half way thru its countdown when the timer was at 30 seconds.&lt;/p&gt;

&lt;p&gt;But then I found another way to breakdown the animation so that it did not go as quickly.&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="k"&gt;@keyframes&lt;/span&gt; &lt;span class="n"&gt;widthChange&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="err"&gt;0&lt;/span&gt;&lt;span class="o"&gt;%&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="m"&gt;600px&lt;/span&gt;&lt;span class="p"&gt;;}&lt;/span&gt;
    &lt;span class="err"&gt;25&lt;/span&gt;&lt;span class="o"&gt;%&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="m"&gt;450px&lt;/span&gt;&lt;span class="p"&gt;;}&lt;/span&gt;
    &lt;span class="err"&gt;50&lt;/span&gt;&lt;span class="o"&gt;%&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="m"&gt;300px&lt;/span&gt;&lt;span class="p"&gt;;}&lt;/span&gt;
    &lt;span class="err"&gt;75&lt;/span&gt;&lt;span class="o"&gt;%&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="m"&gt;150px&lt;/span&gt;&lt;span class="p"&gt;;}&lt;/span&gt;
    &lt;span class="err"&gt;100&lt;/span&gt;&lt;span class="o"&gt;%&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="m"&gt;0px&lt;/span&gt;&lt;span class="p"&gt;;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This way it hit half way thru the length of the animation when the timer &lt;em&gt;was&lt;/em&gt; at 30 seconds. However, the rate at which the width changes still isn't as consistent as I would like.&lt;/p&gt;

&lt;h2&gt;
  
  
  What article(s) or forum(s) was most helpful to you in learning this?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://css-tricks.com/controlling-css-animations-transitions-javascript/"&gt;https://css-tricks.com/controlling-css-animations-transitions-javascript/&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.sitepoint.com/css3-animation-javascript-event-handlers/"&gt;https://www.sitepoint.com/css3-animation-javascript-event-handlers/&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.w3schools.com/css/css3_animations.asp"&gt;https://www.w3schools.com/css/css3_animations.asp&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.w3schools.com/howto/howto_js_add_class.asp"&gt;https://www.w3schools.com/howto/howto_js_add_class.asp&lt;/a&gt;&lt;br&gt;
&lt;a href="https://gomakethings.com/two-ways-to-set-an-elements-css-with-vanilla-javascript/"&gt;https://gomakethings.com/two-ways-to-set-an-elements-css-with-vanilla-javascript/&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  For the Future
&lt;/h2&gt;

&lt;p&gt;Aside from a more consistent animation, I would like to have the animation duration change based on the timer. So that if the timer was longer or shorter, the animation would speed up or slow down to match.&lt;/p&gt;

&lt;p&gt;Possible solutions I have in mind are to integrate SASS or build the styling in the JavaScript itself and have the duration be variables. If anyone has any suggestions, they are welcome!&lt;/p&gt;
&lt;h2&gt;
  
  
  A modified version for CodePen
&lt;/h2&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/sun-mountain/embed/zbYNOJ?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>css</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Basic Color Theory for Web Developers</title>
      <dc:creator>Nicole Zonnenberg</dc:creator>
      <pubDate>Fri, 25 Jan 2019 13:37:16 +0000</pubDate>
      <link>https://forem.com/nikacodes/basic-color-theory-for-web-developers-15a0</link>
      <guid>https://forem.com/nikacodes/basic-color-theory-for-web-developers-15a0</guid>
      <description>&lt;p&gt;You would be hard-pressed to find an art class without a color wheel hanging somewhere on its walls. If you’ve ever taken an art class, you might have been introduced to paints and mixing paints by creating one of your own.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fcgr160zn3evkbry9h3l7.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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fcgr160zn3evkbry9h3l7.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You would have learned about primary and secondary colors. Maybe even tertiary colors if you continued to take art after elementary school. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fh1li6xy7lsolpx1pfd7y.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fh1li6xy7lsolpx1pfd7y.jpg"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But unless you studied art in any capacity at a high school level or higher, you probably did not realize that the color wheel is the simplest way to demonstrate &lt;a href="https://en.wikipedia.org/wiki/Color_theory" rel="noopener noreferrer"&gt;color theory&lt;/a&gt;, the practice of mixing colors and the study of specific color combinations.&lt;/p&gt;

&lt;h2&gt;
  
  
  But what is color theory?
&lt;/h2&gt;

&lt;p&gt;&lt;b&gt;A brief history&lt;/b&gt;: Color theory emerged when impressionists like Edouard Manet, Edgar Degas, and Claude Monet (you might have heard of them) started experimenting with capturing light rather than a perfect likeness.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fqg743mrylv8mon76b4z0.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fqg743mrylv8mon76b4z0.jpg"&gt;&lt;/a&gt;&lt;/p&gt;
Monet's Haystacks



&lt;p&gt;&lt;b&gt;Short answer&lt;/b&gt;: It comes down to how the human eye translates light waves into colors. Colors that match have similar or complementary waves.&lt;/p&gt;

&lt;p&gt;Color theory can get into the science of light waves, and why colors look the way they do. For the purposes of this article however, we are going to focus on the questions:&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;Why do certain colors match?&lt;/li&gt;
    &lt;li&gt;How do I pick the "right" colors?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Color matching seems to be a "you either have it or you don't" kind of thing. Or the longest, most excruciating part of designing a webpage or an app is determining which exact green to use for your background.&lt;/p&gt;

&lt;p&gt;Whatever your color-related woes are, here's a little cheat sheet to look at:&lt;/p&gt;

&lt;h2&gt;
  
  
  Level One: Monochromatic
&lt;/h2&gt;

&lt;p&gt;&lt;b&gt;Monochromatic&lt;/b&gt; is simply one or various shades of one color.&lt;/p&gt;

&lt;blockquote&gt;
&lt;b&gt;In WebDev&lt;/b&gt;: This is choosing a single &lt;a href="https://www.w3schools.com/colors/colors_picker.asp" rel="noopener noreferrer"&gt;Hex Code&lt;/a&gt; and making it lighter or darker without effecting the hue.
&lt;/blockquote&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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F48ktxlwm7qq095mkwuoa.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F48ktxlwm7qq095mkwuoa.jpg"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is the simplest way to color your webpage. Sites such as &lt;a href="http://facebook.com" rel="noopener noreferrer"&gt;Facebook&lt;/a&gt; and &lt;a href="http://twitter.com" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt; use the (mostly) monochromatic color scheme to their advantage. Black, white, and a sky blue, this color palette is part of what makes these social media apps so easy to use.&lt;/p&gt;

&lt;p&gt;The only differentiating colors come from users' avatars, links and photos, which can become recognizable to frequent users, making it easy to find posts by their favorite accounts.&lt;/p&gt;

&lt;p&gt;If there were more colors on Twitter's webpage, it would be harder to differentiate separate posts and who posted what.&lt;/p&gt;

&lt;p&gt;As a rule, even if you want more than one color, it's good to have one main color--either as the background color or the main header color.&lt;/p&gt;

&lt;blockquote&gt;
&lt;b&gt;Pro-Tip&lt;/b&gt;: If your webpage is only monochromatic make sure each shade is easily discernible from one another. Otherwise your webpage may not be user friendly if they cannot read text or separate the webpage's elements.
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Level Two: Complementary Colors
&lt;/h2&gt;

&lt;p&gt;But what if you want more than just different shades of orange? What if you want your links to stand out but not clash with the nav bar or the background color?&lt;/p&gt;

&lt;p&gt;If we're following basic color theory, one of the best ways to choose a color for immediate emphasis is to look for a &lt;b&gt;complementary&lt;/b&gt; color.&lt;/p&gt;

&lt;p&gt;A &lt;b&gt;complementary&lt;/b&gt; color of another can be found at the exact opposite of side of the color wheel. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F3fj00kbhg6s8nqpm3ut9.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F3fj00kbhg6s8nqpm3ut9.jpg"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Each &lt;b&gt;primary&lt;/b&gt; color matches with one &lt;b&gt;secondary&lt;/b&gt; color for their complementary color. An easy way to remember which colors to match is that the &lt;b&gt;secondary&lt;/b&gt; color matches with the &lt;b&gt;primary&lt;/b&gt; color it does not use. For example: red's complementary color is green, which is made out of blue and yellow.&lt;/p&gt;

&lt;blockquote&gt;
&lt;b&gt;Pro Tip&lt;/b&gt;: Add colors one at time and keep it simple. Do not sacrifice a clean, usable layout for a full rainbow. Otherwise you might accidentally channel the classic 90s websites like &lt;a href="https://spacejam.com/" rel="noopener noreferrer"&gt;this&lt;/a&gt;.
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Leveling Up
&lt;/h2&gt;

&lt;p&gt;As you get more comfortable with your burgeoning design skills, feel free to push the envelope. Color should never be scary work to with. Always be on the look out for &lt;a href="https://www.alispit.tel/#/" rel="noopener noreferrer"&gt;developers&lt;/a&gt; and designers who utilize color masterfully. Ask what you like about it, what you don't like, and why. This is how you build your own tastes and brand.&lt;/p&gt;

&lt;h2&gt;
  
  
  WebDev Hack
&lt;/h2&gt;

&lt;p&gt;Create color combinations/palettes with their hex codes/RBG numbers on hand. Or if you're a fan of SASS, store them in files to import on bigger projects. Especially if your job is to create the structure, not the look (which is determined by someone else, a customer or manager), then just view these colors as place holders that make the website easy to look at.&lt;/p&gt;

&lt;p&gt;Just make sure:&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;Everything is readable.&lt;/li&gt;
    &lt;li&gt;Links, headers, anything you want to put emphasis on is obviously different from plain text.&lt;/li&gt;
    &lt;li&gt;A user can easily discern different parts of your webpage (i.e. the nav bar, main content, separate the articles, etc.).&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Online Tools
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://paletton.com/" rel="noopener noreferrer"&gt;Palleton.com&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://coolors.co/" rel="noopener noreferrer"&gt;Coolors.co&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Shout out to &lt;a href="https://dev.to/ferkungamaboobo"&gt;Doug R. Thomas, Esq.&lt;/a&gt; for the following links:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://color.adobe.com/" rel="noopener noreferrer"&gt;Color.Adobe.com&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://webaim.org/resources/contrastchecker/" rel="noopener noreferrer"&gt;WebAIM - Color Contrast Checker&lt;/a&gt; - makes sure that text is readable over backgrounds.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.color-blindness.com/coblis-color-blindness-simulator/" rel="noopener noreferrer"&gt;Coblis — Color Blindness Simulator&lt;/a&gt; - tests screenshots of layout with colorblindness filters to make sure your content is readable for all audiences.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Continued Reading
&lt;/h2&gt;

&lt;p&gt;Hopefully picking a color or a color palette for your website, page, or app is less daunting after reading this article. If this topic interests you, I highly recommend &lt;a href="https://www.colormatters.com/color-and-design/basic-color-theory" rel="noopener noreferrer"&gt;reading more&lt;/a&gt; about the subject. We've only really touched the surface, but you can get into &lt;a href="https://99designs.com/blog/tips/the-7-step-guide-to-understanding-color-theory/" rel="noopener noreferrer"&gt;hues and shades and more&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Ultimately, there is no “wrong” answer when it comes to color, especially if you are making a project for yourself. Many assume taste is something you’re born with, but really it’s looking at successful designs and taking inspiration, trying different combinations, and finding what works best for you and your brand. Good luck and go create!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>css</category>
      <category>html</category>
      <category>design</category>
    </item>
    <item>
      <title>My First Bootcamp Project: Tower of Hanoi</title>
      <dc:creator>Nicole Zonnenberg</dc:creator>
      <pubDate>Mon, 14 Jan 2019 02:25:23 +0000</pubDate>
      <link>https://forem.com/nikacodes/my-first-bootcamp-project-tower-of-hanoi-3kob</link>
      <guid>https://forem.com/nikacodes/my-first-bootcamp-project-tower-of-hanoi-3kob</guid>
      <description>&lt;center&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2HylG5Rk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/6u0ofzhel948piwscrhz.png" width="800" height="463"&gt;&lt;/center&gt;

&lt;h2&gt;
  
  
  Background
&lt;/h2&gt;

&lt;p&gt;A little over one month ago, I quit my life and started a web development intensive at &lt;a href="https://generalassemb.ly/" rel="noopener noreferrer"&gt;General Assembly&lt;/a&gt;. It has been a rollercoaster of emotion and feeling and an experiment of 'How Little Sleep Can I Survive On And Still Function'. On alternating days I have celebrated or wanted to tear my hair out, which I hear is like being a developer in real life, so I guess I'm doing something right.&lt;/p&gt;

&lt;p&gt;This past week, my fellow devs in training and I tackled our first project: make a game using the skills we have learned over three weeks in HTML, CSS, and Javascript. We were given a list of five games to choose from (or could propose our own idea to be approved of by our instructors). I chose the &lt;a href="https://en.wikipedia.org/wiki/Tower_of_Hanoi" rel="noopener noreferrer"&gt;Tower of Hanoi&lt;/a&gt; because it seemed simple a simple case of identifying &lt;code&gt;div&lt;/code&gt;s and, in a click event, manipulate two out of the three &lt;code&gt;div&lt;/code&gt;s that would be my towers.&lt;/p&gt;

&lt;p&gt;However, true to form, I decided to add the extra challenge of using jQuery after finding this code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;tower.prepend($('&amp;lt;li class="disc disc-' + i + '" data-value="' + i + '"&amp;gt;&amp;lt;/li&amp;gt;'));
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Which in tandem with this code in SASS:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@for $i from 1 through # {
    .disc-#{$i} {
        width: #px * $i;
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I could theoretically create a game where the player could choose the difficulty level by adding and subtracting the number of discs in the game. Which I have to mention at this point was not a requirement at all.&lt;/p&gt;

&lt;p&gt;But at a glance, it did not seem too much of an extra hurdle and I already knew how I would build my tower with two additional buttons to add and subtract discs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  function buildTower(tower) {
    $tower.html("");
    for (i = 1; i &amp;lt;= discNum; i++) {
      tower.prepend(
        $('&amp;lt;li class="disc disc-' + i + '" data-value="' + i + '"&amp;gt;&amp;lt;/li&amp;gt;')
      );
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I used the codes above to generate list items increasing in size. I struggled with bootstrap's established CSS code, but was able to figure out how to override it. However, once I built my first tower, the struggle began.&lt;/p&gt;

&lt;h2&gt;
  
  
  Building The Game
&lt;/h2&gt;

&lt;p&gt;The real challenge was how to remove the top list item from the original list, then recreate it in another list. There were several iterations where I successfully cloned my full tower in each box, but then had three towers and could not erase them.&lt;/p&gt;

&lt;p&gt;The trick was to create a variable &lt;code&gt;deck = []&lt;/code&gt; and assign it the first list item.  Once I had assigned the first list item to them empty array, I could delete then create an identical list item in the new tower.&lt;/p&gt;

&lt;p&gt;Then I was able to recreate the correct disc, only to have it placed underneath the larger discs. This made it impossible to play the game correctly.&lt;/p&gt;

&lt;center&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3-KzrGtV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/iucbzh6nltj28o8qnttj.png" width="739" height="495"&gt;&lt;/center&gt;

&lt;p&gt;After reading more about jQuery and jQuery methods, I was able to find the &lt;code&gt;.append&lt;/code&gt; method which added a new list item at the beginning rather than at the end.&lt;/p&gt;

&lt;p&gt;Now that I had met the requirements for a working game, I wanted to add one more feature: two buttons that could add and subtract discs to increase or decrease the difficulty level.&lt;/p&gt;

&lt;p&gt;The logic was simple enough:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  // Increase/Decrease discNum (not working?)

  $(".ad").click(function() {
    if (discNum &amp;lt; 7) {
      discNum++;
      return DiscNum;
    }
  });

  $(".sub").click(function() {
    if (discNum &amp;gt; 3) {
      discNum--;
      return DiscNum;
    }
  });
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Another learning curve and talking to my instructor, I realized I made a pretty beginner mistake.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  // Increase/Decrease discNum

  $(".ad").click(function() {
    if (discNum &amp;lt; 7) {
      discNum++;
      buildTower($tower.eq(0));
    }
  });

  $(".sub").click(function() {
    if (discNum &amp;gt; 3) {
      discNum--;
      buildTower($tower.eq(0));
    }
  });
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  For The Future
&lt;/h2&gt;

&lt;p&gt;I definitely want to continue working on this game. Now that I did it in jQuery, I think there would be a lot of learning potential to translate to Javascript.&lt;/p&gt;

&lt;p&gt;I would also like to add a timer element that starts with the first move and ends when the player finishes; a win scenario either lighting up the whole tower or having some sort of message appear saying the player one; add a move counter to see if the player can beat their personal best; and make it mobile responsive.&lt;/p&gt;

&lt;p&gt;Overall, this was a pretty fun challenge that definitely had moments that made me have to walk away from my computer, but easy enough that (sometimes with a little guidance) I could figure it out and overcome obstacles.&lt;/p&gt;

&lt;p&gt;I cannot wait to look back on this and see my growth as a web developer and compare it to future projects.&lt;/p&gt;

&lt;p&gt;If you would like to play the game, you may do so &lt;a href="https://sun-mountain.github.io/hanoi_game/" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Thank you.&lt;/p&gt;

</description>
      <category>jquery</category>
      <category>webdev</category>
      <category>gamedev</category>
      <category>bootcamp</category>
    </item>
    <item>
      <title>Warm Up For Developers: Recreating A Website, Breaking It Down, Building It Up</title>
      <dc:creator>Nicole Zonnenberg</dc:creator>
      <pubDate>Mon, 07 Jan 2019 20:15:21 +0000</pubDate>
      <link>https://forem.com/nikacodes/warm-up-for-developers-recreating-a-website-breaking-it-down-building-it-up-27dn</link>
      <guid>https://forem.com/nikacodes/warm-up-for-developers-recreating-a-website-breaking-it-down-building-it-up-27dn</guid>
      <description>&lt;p&gt;A warm up is considered essential for any type of strenuous activity. Athletes - both professional and amateur - will stretch and start with light physical movements before building to their full workout. Musicians will warm up their instruments and appendages with scales and tuning before attempting their next piece. Artists will do warm up sketches before jumping into their current endeavor. All of these groups are not only preparing their bodies, they are preparing their minds for the larger tasks at hand. They are getting into a rhythm before attempting harder, more strenuous challenges. In some cases, it is necessary to warm up in order to prevent injuries.&lt;/p&gt;

&lt;p&gt;Coding, like the previously mentioned practices, also benefits from constant practice and warm ups. An excellent warm up for any web developer is to recreate an already existing website. Depending on your level, you can add certain challenges to stretch your code skills. &lt;/p&gt;

&lt;blockquote&gt;
&lt;h3&gt;Pro Tip&lt;/h3&gt;
Try adding a time limit. How much of a full website can you make in an hour? Thirty minutes? How functional do you want to try and make your mock-website?&lt;/blockquote&gt;

&lt;p&gt;Recreating a website can seem like a monumental task, especially for beginners. If you are someone who has attempted to recreate an existing website or create a website from scratch, you probably have realized that even the simplest website can require hundreds of lines of code.&lt;/p&gt;

&lt;p&gt;What I hope to accomplish with this article is to help you look at a website and quickly break down its visual components and (hopefully) make the exercise a little bit easier.&lt;/p&gt;

&lt;h2&gt;The Warm Up&lt;/h2&gt;

&lt;p&gt;So you have picked your website, determined that it is not too difficult or too easy for your warm up goal, and you are ready to work! But where do you even start?&lt;/p&gt;

&lt;p&gt;For this article’s example, I am going to look at &lt;a href="https://medium.com/"&gt;Medium&lt;/a&gt;’s homepage and break it down.&lt;/p&gt;

&lt;p&gt;It may look simple, but once you start diving into the code, you will realize that it is composed of divs within divs within divs. In fact, you may think it is &lt;a href="https://en.wikipedia.org/wiki/Turtles_all_the_way_down"&gt;divs all the way down&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;One of the first things you may realize is that Medium is an infinite scrolling website. There is no “end” but it will keep regenerating articles for as long as you are willing to scroll. For the purposes of this article, I’m going to recommend adding a footer and limit yourself to ten articles in the content area.&lt;/p&gt;

&lt;h2&gt;Breaking It Down&lt;/h2&gt;

&lt;p&gt;When you first look at the page, think of the whole of the content as one block.&lt;/p&gt;

&lt;center&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--o5zjqWec--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://nicolezonnenberg.files.wordpress.com/2019/01/medium012.png" width="600" height="600"&gt;&lt;/center&gt;

&lt;p&gt;Does it go all the way from one side of webpage to the other? Is there a significant distance from the top of the webpage and the bottom when you scroll all the way down?&lt;/p&gt;

&lt;p&gt;For Medium there are significant borders around the whole of the content, so in your &lt;code&gt;&amp;lt;body&amp;gt;&lt;/code&gt; tag you will make a general &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; container that will be these specific dimensions using CSS or SASS.&lt;/p&gt;

&lt;p&gt;That was easy. But now we have start looking inside the box and all the pictures and texts, right? Nope! Because, we can still break this big box into smaller boxes.&lt;/p&gt;

&lt;center&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wvssIsDq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://nicolezonnenberg.files.wordpress.com/2019/01/medium2.png" width="600" height="600"&gt;&lt;/center&gt;

&lt;p&gt;This is much more manageable and we’ve already created three more easily definable &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; tags inside that first much larger &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; container.&lt;/p&gt;

&lt;p&gt;In fact your code--or psuedocode--should look very similar to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;body&amp;gt;
    &amp;lt;div id=”container”&amp;gt;
        &amp;lt;div id=”header”&amp;gt;
            Header
        &amp;lt;/div&amp;gt;
        &amp;lt;div id=”content”&amp;gt;
            Content
        &amp;lt;/div&amp;gt;
        &amp;lt;div id=”footer”&amp;gt;
            Footer
        &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;

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

&lt;/div&gt;



&lt;p&gt;All styling and positioning will be done in your CSS or SASS file(s) that are connected to the div id's. I recommend setting the dimensions and positions of each &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; as they are created. This makes it easier to problem shoot as you continue to add more elements.&lt;/p&gt;

&lt;p&gt;Now we are going to break down each section’s individual components. Remember: it is &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt;s all the way down.&lt;/p&gt;

&lt;h3&gt;Header&lt;/h3&gt;

&lt;center&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DnqAx59S--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://nicolezonnenberg.files.wordpress.com/2019/01/medium03.png" width="600" height="400"&gt;&lt;/center&gt;

&lt;p&gt;That's okay, but we can still break it down even more:&lt;/p&gt;

&lt;center&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--G7veeK-1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://nicolezonnenberg.files.wordpress.com/2019/01/medium04.png" width="600" height="300"&gt;&lt;/center&gt;

&lt;p&gt;For a warm up or exercise, it does not really matter what you call each section in your code. You will have to remember what you named what section or div. If you have to go back and fix something or debug, it will be a nightmare to figure out which div to target.&lt;/p&gt;

&lt;p&gt;I will also point out that the featured section is actually three columns, with the third column broken up into two more sections. It all depends on how small you are willing to let your &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt;'s go.&lt;/p&gt;

&lt;h3&gt;Content&lt;/h3&gt;

&lt;center&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--k6hi5AR4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://nicolezonnenberg.files.wordpress.com/2019/01/medium05.png" width="600" height="400"&gt;&lt;/center&gt;

&lt;p&gt;Once again, that is good. But we can do better.&lt;/p&gt;

&lt;center&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NJN3JfJT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://nicolezonnenberg.files.wordpress.com/2019/01/medium06.png" width="600" height="400"&gt;&lt;/center&gt;

&lt;p&gt;My examples will stop here, but I hope that you can see just how specific you can get with just &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt;’s or &lt;code&gt;&amp;lt;section&amp;gt;&lt;/code&gt;’s in your code.&lt;/p&gt;

&lt;p&gt;We are not going to worry about the footer here since it is a border we self-imposed onto this exercise. But if there was footer, we would break it down if necessary into its components. Footers usually contain a note about the company’s ownership of the website, some social media links, and some contact links.&lt;/p&gt;

&lt;h2&gt;In Practice&lt;/h2&gt;

&lt;p&gt;Use these exercises and warm-ups to experiment how many or few &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt;’s or &lt;code&gt;&amp;lt;section&amp;gt;&lt;/code&gt;’s you are comfortable working with. How many is too many? When does your code start to get incomprehensible? &lt;/p&gt;

&lt;p&gt;The answers to these questions and more will depend on your preferences as a coder.&lt;/p&gt;

&lt;p&gt;When you feel that you have broken down your website into the smallest and most manageable chunks--the key word being manageable--you are now ready to add content.&lt;/p&gt;

&lt;p&gt;I would not recommend getting super caught up in replicating a site’s content for this exercise. Especially if you chose a site whose page(s) update regularly. However, you will need to insert text and pictures (if the site has pictures) in order to make sure that you are being honest in your recreation.&lt;/p&gt;

&lt;p&gt;For pictures, here are some sites that I enjoy using:&lt;/p&gt;

&lt;p&gt;&lt;a&gt;&lt;/a&gt;&lt;a href="http://unsplash.com"&gt;http://unsplash.com&lt;/a&gt; &lt;br&gt;
&lt;a&gt;&lt;/a&gt;&lt;a href="http://fillmurray.com"&gt;http://fillmurray.com&lt;/a&gt; &lt;/p&gt;

&lt;h2&gt;Final Thoughts&lt;/h2&gt;

&lt;p&gt;The brain, like any muscle, performs better when you practice skills--like coding--regularly. Even if you do not finish completely, taking a website and trying to recreate it will improve your skills as a coder; familiarize you with different layouts for different sites; and provide you with an open sandbox to experiment and challenge yourself in a safe environment.&lt;/p&gt;

&lt;p&gt;I hope that this article has helped make breaking down and building up a website an easier task.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>coding</category>
      <category>html</category>
      <category>uxd</category>
    </item>
  </channel>
</rss>
