<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: dannohh</title>
    <description>The latest articles on DEV Community by dannohh (@dannohh).</description>
    <link>https://dev.to/dannohh</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%2F422426%2F9b695543-8056-4dd5-8e4f-c19fa4a12cd2.jpeg</url>
      <title>DEV Community: dannohh</title>
      <link>https://dev.to/dannohh</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dannohh"/>
    <language>en</language>
    <item>
      <title>A Very Basic JavaScript Intro by Dannohh and chatGPT!</title>
      <dc:creator>dannohh</dc:creator>
      <pubDate>Fri, 09 Dec 2022 20:10:10 +0000</pubDate>
      <link>https://dev.to/dannohh/a-very-basic-javascript-intro-by-dannohh-and-chatgpt-5dj5</link>
      <guid>https://dev.to/dannohh/a-very-basic-javascript-intro-by-dannohh-and-chatgpt-5dj5</guid>
      <description>&lt;p&gt;Welcome to Dannohh and chatGPT's JavaScript basics tutorial. We'll be your guide through the world of JavaScript.&lt;/p&gt;

&lt;p&gt;Before we get started, let's go over what you'll need to follow along with this tutorial. First, you'll need a computer with a text editor installed. We'll be using the browser developer tools in this tutorial, but you're free to use any text editor you're comfortable with. You'll also need a web browser to run our JavaScript code. Any modern browser will do, so feel free to use your favorite.&lt;/p&gt;

&lt;p&gt;Now that you have everything you need, let's jump in and start learning about JavaScript.&lt;/p&gt;

&lt;p&gt;JavaScript is a programming language that is commonly used to add interactivity to websites. It allows you to create dynamic content that can update in real-time, making your web pages more engaging and user-friendly.&lt;/p&gt;

&lt;p&gt;One of the key features of JavaScript is its ability to manipulate the Document Object Model, or the DOM. The DOM is a representation of the structure of a web page, and JavaScript allows you to access and modify its elements. This allows you to create highly interactive web pages that can respond to user input and change in real-time.&lt;/p&gt;

&lt;p&gt;Let's try out some basic JavaScript to see how it works. Open up your text editor and create a new file. Save the file as "index.html". This file will be our web page that we'll be working with.&lt;/p&gt;

&lt;p&gt;Next, let's add some basic HTML code to our page. Type the following into your index.html file:&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;html&amp;gt;
&amp;lt;head&amp;gt;
  &amp;lt;title&amp;gt;JavaScript Basics&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
  &amp;lt;h1&amp;gt;Hello, World!&amp;lt;/h1&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This code creates a simple web page with a heading that says "Hello, World!". Save the file and open it in your web browser. You should see the page with the "Hello, World!" heading.&lt;/p&gt;

&lt;p&gt;Now, let's add some JavaScript to our page. In your index.html file, add the following code just before the closing &lt;/p&gt;

</description>
      <category>javascript</category>
      <category>codenewbie</category>
      <category>webdev</category>
      <category>mentor</category>
    </item>
    <item>
      <title>React Hooks and state</title>
      <dc:creator>dannohh</dc:creator>
      <pubDate>Mon, 10 Aug 2020 14:56:17 +0000</pubDate>
      <link>https://dev.to/dannohh/react-hooks-and-state-1ioc</link>
      <guid>https://dev.to/dannohh/react-hooks-and-state-1ioc</guid>
      <description>&lt;p&gt;With React Hooks, we can give our functional components some state to keep track of and render()  with said component or even children components. To do this we can use the useState() hook to set our initial state and the setState() method for updating. When we want to do something AFTER our component renders for the first time, (Mounts) we can use the useEffect() method. So, we set the initial state of our component with the useState() method and update the state with the setState() method.&lt;/p&gt;

&lt;p&gt;Being able to manipulate and set the state of our functional components allows more freedom and flexibility while building or Apps with React. For example, when we want a small component to be able to keep track of, and update its own state without rendering it through a parent component, we could use a hook instead of the traditional Class component with a constructor, saving time, space and making our code easier to read for humans! Sweet!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>React MD</title>
      <dc:creator>dannohh</dc:creator>
      <pubDate>Wed, 05 Aug 2020 16:44:18 +0000</pubDate>
      <link>https://dev.to/dannohh/react-md-3cdd</link>
      <guid>https://dev.to/dannohh/react-md-3cdd</guid>
      <description>&lt;h1&gt;
  
  
  JSX
&lt;/h1&gt;

&lt;p&gt;JSX produces React Elements. It isn't HTML even though it looks similar. It comes with the full power of JS. Instead of separating concerns by file type, React separates concerns by Component. You can put any JS expression in a JSX element by using curly braces 👉 &lt;strong&gt;{&lt;/strong&gt;x + 5*&lt;em&gt;}&lt;/em&gt;* 👈&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="nx"&gt;If&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="nx"&gt;JSX&lt;/span&gt; &lt;span class="nx"&gt;element&lt;/span&gt; &lt;span class="nx"&gt;is&lt;/span&gt; &lt;span class="nx"&gt;empty&lt;/span&gt; &lt;span class="p"&gt;(&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;),&lt;/span&gt; &lt;span class="nx"&gt;you&lt;/span&gt; &lt;span class="nx"&gt;can&lt;/span&gt; &lt;span class="nx"&gt;close&lt;/span&gt; &lt;span class="nx"&gt;it&lt;/span&gt; &lt;span class="nx"&gt;immediately&lt;/span&gt; &lt;span class="nx"&gt;like&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Rendering React Elements
&lt;/h1&gt;

&lt;p&gt;Elements are the smallest building blocks of React. React Components are made up of Elements. Elements are immutable and represent the UI at a certain point in time.&lt;/p&gt;

&lt;h1&gt;
  
  
  Components and Props
&lt;/h1&gt;

&lt;p&gt;Components can feel like JS functions. They take an argument called "Props" and describe what an application element should look like. Users of React can define their own components. They will look like HTML but with custom names defined by the user.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="nx"&gt;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="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;MyCustomReactElement&lt;/span&gt; &lt;span class="p"&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;//The custom component can have custom "attributes", also defined by the user&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Always start component names with a capital letter.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  All React components must act like pure functions with respect to their props.
&lt;/h3&gt;

&lt;h1&gt;
  
  
  State and Lifecycle
&lt;/h1&gt;

&lt;p&gt;State is similar to props (short for properties of a React Element) except that it is PRIVATE and fully controlled by the component.&lt;/p&gt;

&lt;p&gt;State is an object declared inside the component with &lt;strong&gt;key: value&lt;/strong&gt; pairs.&lt;/p&gt;

&lt;h3&gt;
  
  
  Whenever a component is rendered for the first time, the term is "mounted"
&lt;/h3&gt;

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

                                                                           **👉ComponentDidMount(), or later...useEffect()** 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Special methods we can  declare inside the component to run some code after the component mounts are called Lifecycle methods.&lt;/p&gt;

&lt;h1&gt;
  
  
  Handling Events
&lt;/h1&gt;

&lt;p&gt;Pass camelCased functions inside curly brackets as React element event handlers. Like this...&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Button&lt;/span&gt; &lt;span class="na"&gt;onClick&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;doSomething&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt; &lt;span class="c1"&gt;//Notice no parenthases&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Keep in mind that preventDefault() must be explicitly called if you want to prevent default behavior of a component.&lt;/p&gt;

&lt;h1&gt;
  
  
  Lifting State Up
&lt;/h1&gt;

&lt;p&gt;If two or more components need to reflect shared data, "lift their state" up to their next common ancestor → parent possibly&lt;/p&gt;

&lt;p&gt;I think this can be explained best with an example...Lets try...&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;CustomComponentOne&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt; &lt;span class="c1"&gt;//I hold some state to display&lt;/span&gt;
&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;CustomComponentTwo&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt; &lt;span class="c1"&gt;//I also show the same state as CustomComponentOne&lt;/span&gt;

&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;CustomComponentHolder&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt; &lt;span class="c1"&gt;// I render the above two components, so I could hold their states&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title># Tools of the Trade</title>
      <dc:creator>dannohh</dc:creator>
      <pubDate>Mon, 27 Jul 2020 16:37:16 +0000</pubDate>
      <link>https://dev.to/dannohh/tools-of-the-trade-2ld7</link>
      <guid>https://dev.to/dannohh/tools-of-the-trade-2ld7</guid>
      <description>&lt;p&gt;A 'closure' is a function that has access to it's outer function's variables and methods. It can also access variables and methods within it's own scope and of course, the global ones as well! This means that JS callbacks are also closures.&lt;/p&gt;

&lt;p&gt;When using callbacks, I like to imagine that when the callback function is complete, it allows the higher-order function to close out. Much like when we're done using a saw to cut an angle in some wood, we close out the task of cutting when the wood is no longer whole and the saw has stopped moving, then we move on to the next promise of screwing it to another piece of wood 🛠️! ...or maybe painting is the next task 🎨. Either way, we've closed and are ready for the next!&lt;/p&gt;

</description>
      <category>closures</category>
    </item>
    <item>
      <title>filter() and map() vs. forEach()</title>
      <dc:creator>dannohh</dc:creator>
      <pubDate>Mon, 20 Jul 2020 16:35:44 +0000</pubDate>
      <link>https://dev.to/dannohh/filter-and-map-vs-foreach-528a</link>
      <guid>https://dev.to/dannohh/filter-and-map-vs-foreach-528a</guid>
      <description>&lt;p&gt;What are some of the advantages of using map() and filter() vs. using forEach() methods?&lt;/p&gt;

&lt;p&gt;Firstly, the forEach() array method always returns a value of undefined. This might be good for some scenarios, but not all. It also mutates our original array, discarding the return values.&lt;/p&gt;

&lt;h3&gt;
  
  
  To Be Clear~
&lt;/h3&gt;

&lt;p&gt;forEach() MUTATES the current array!&lt;/p&gt;

&lt;h1&gt;
  
  
  VS. map() and filter()
&lt;/h1&gt;

&lt;p&gt;map() and filter() methods both return new arrays that we can work with, without affecting the original array! Sweet! New Toys 👍 🎅&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Reading, Writing, and Arithmetic Operators :)</title>
      <dc:creator>dannohh</dc:creator>
      <pubDate>Mon, 13 Jul 2020 15:31:57 +0000</pubDate>
      <link>https://dev.to/dannohh/reading-writing-and-arithmetic-operators-j85</link>
      <guid>https://dev.to/dannohh/reading-writing-and-arithmetic-operators-j85</guid>
      <description>&lt;h3&gt;
  
  
  Reading Code~
&lt;/h3&gt;

&lt;p&gt;I think everyone would agree that the ability to read code is imperative to being able to write good code. It has been just recently that I personally have realized how "breaking down" code in my own words has helped me become a better aspiring developer and student.&lt;/p&gt;

&lt;h3&gt;
  
  
  How I read code~
&lt;/h3&gt;

&lt;p&gt;In the beginning, I had heard that before you begin to write code, you should at least know how to read it. I thought that maybe the syntax or keywords may be the most important part of that process. It turns out I was wrong 👎&lt;/p&gt;

&lt;p&gt;Don't get me wrong! Syntax and keywords are super important! However, the LOGIC behind syntax is what I really wanted to know...&lt;/p&gt;

&lt;p&gt;As a soldier, it was imperative that complex concepts be "broken down" into smaller, easy to digest concepts so that every other soldier could understand, regardless of their education level. So when I read code to myself or out loud to anyone else, it looks like this.. ⬇️&lt;/p&gt;

&lt;h3&gt;
  
  
  A simple example
&lt;/h3&gt;

&lt;p&gt;// a little JS&lt;/p&gt;

&lt;p&gt;document.querySelector('div').addEventListener('click', myFunction);&lt;/p&gt;

&lt;p&gt;In this short example code snippet, I try to take the entire idea into account and find myself asking the question&lt;/p&gt;

&lt;h3&gt;
  
  
  What does the dev want this code to do???
&lt;/h3&gt;

&lt;p&gt;Look at the elements Dannohhh! Looks like we're working with some HTML elemnts! Sweet! I know a div element is about to be manipulated in some way. because we're "grabbing" it with a querySelector() method. Perfect, now lets do something with the div! Maybe we want to addEventListener?? YUP! moving on, what are we going to listen for? A CLICK event. And finally, what's going to happen after that 'click'? Well, it turns out that myFunction is going to happen!&lt;/p&gt;

&lt;h3&gt;
  
  
  So in my 🧠~
&lt;/h3&gt;

&lt;p&gt;This says to me: Dannohhh, pay attention! This code is going to grab the 'div' element from the DOM, and listen for a click, when the div is clicked, myFunction will be executed! Likely causing AWESOMENESS to happen!&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Thank you so much for reading and hopefully this helps someone!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  How do YOU read code?
&lt;/h3&gt;

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