<?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: megcartr</title>
    <description>The latest articles on DEV Community by megcartr (@megcartr).</description>
    <link>https://dev.to/megcartr</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%2F1124641%2F3281a604-8363-4f51-bc13-46c2f9056a6c.png</url>
      <title>DEV Community: megcartr</title>
      <link>https://dev.to/megcartr</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/megcartr"/>
    <language>en</language>
    <item>
      <title>Components in React</title>
      <dc:creator>megcartr</dc:creator>
      <pubDate>Sat, 07 Oct 2023 17:37:09 +0000</pubDate>
      <link>https://dev.to/megcartr/components-in-react-19pe</link>
      <guid>https://dev.to/megcartr/components-in-react-19pe</guid>
      <description>&lt;p&gt;React is a popular framework used to build web applications. It is a JavaScript library developed by Facebook and has been used to create many applications such as Instagram, Netflix, Airbnb, and many more!&lt;/p&gt;

&lt;p&gt;One of the biggest advantages to using React is the ability to create components. Components are blocks of code in which can be separated and reused. Having separate blocks of code allows us to easily determine and fix bugs in our code. There are two types of components: Class and Functional. &lt;/p&gt;

&lt;p&gt;A Class component requires "extends React.Component" and "render" in order for the component to return HTML, thus making it more complex than functional components. Also known as the stateful component because they can hold or manage a local state.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Header extends React.Component {
 render() {
  return &amp;lt;h1&amp;gt;Header&amp;lt;/h1&amp;gt;;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Component name should always begin with an uppercase letter&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A Functional component is the preferred method as the code is cleaner. They are also known as the stateless component since they do not have their own state. Functional components are JavaScript functions that can receive data as parameters. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Function Header() {
    return &amp;lt;h1&amp;gt;Title&amp;lt;/h1&amp;gt;
} 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Components are an essential part of building a React application. They are separate pieces of code which are brought together under a parent component to create your masterpiece! &lt;/p&gt;

</description>
      <category>beginners</category>
      <category>react</category>
      <category>learning</category>
      <category>programming</category>
    </item>
    <item>
      <title>Learning JavaScript: "addEventListener"</title>
      <dc:creator>megcartr</dc:creator>
      <pubDate>Sat, 22 Jul 2023 13:02:28 +0000</pubDate>
      <link>https://dev.to/megcartr/learning-javascript-addeventlistener-i79</link>
      <guid>https://dev.to/megcartr/learning-javascript-addeventlistener-i79</guid>
      <description>&lt;p&gt;My name is Meghan and I have been working for Amazon for 2 years now. This job has been a positive experience as I have been able to pursue my education at no cost. I was first introduced to Software Engineering when I saw a post at work for a program that would train you to become a Software Engineer called ATA. &lt;/p&gt;

&lt;p&gt;I began doing research in SE and other careers in Tech and became fascinated with the field. I believe a career in Tech would be a perfect fit for me! Unfortunately, I was not able to pass the exam in order to be accepted into the program. Still determined, I looked into certifications through the Amazon Career Choice Program. I came across Flatiron School and decided to apply!&lt;/p&gt;

&lt;p&gt;I have enjoyed my experience learning how to code thus far. It has been challenging at times but when the solution finally comes through to me, it is such a rewarding feeling.&lt;/p&gt;

&lt;p&gt;The most interesting thing that I have learned so far is &lt;strong&gt;addEventListener&lt;/strong&gt;. This method allows for an event to happen that is called in a function. Events are actions made by the user or browser such as pressing play on a video or clicking a link which directs you to another page. There are so may events to choose from to make your browser interactive and entertaining! Below are just a few examples: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;click
&lt;/li&gt;
&lt;li&gt;blur
&lt;/li&gt;
&lt;li&gt;mouseover
&lt;/li&gt;
&lt;li&gt;keyup
&lt;/li&gt;
&lt;li&gt;keydown&lt;/li&gt;
&lt;li&gt;cut&lt;/li&gt;
&lt;li&gt;copy&lt;/li&gt;
&lt;li&gt;paste&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;addEventListener&lt;/strong&gt; consists of 2 parameters: the &lt;em&gt;event&lt;/em&gt; (defines the event name) and the &lt;em&gt;function&lt;/em&gt;(responds to the event). Lets take a look at an example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;document.addEventListener("click", sayHello);

function sayHello() {
    alert ("Hello!")
}

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

&lt;/div&gt;



&lt;p&gt;In this example, the event is "click" and the function is sayHello. When the function is called through the event, the results would be "Hello". Also, &lt;em&gt;document&lt;/em&gt; is a target parameter in which the event listener will be executed. These are typically HTML elements but can apply to any DOM object. This is just a simple explanation of how &lt;strong&gt;addEventListener&lt;/strong&gt; works. &lt;/p&gt;

&lt;p&gt;Resources: &lt;br&gt;
&lt;a href="https://developer.mozilla.org"&gt;https://developer.mozilla.org&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.w3schools.com"&gt;https://www.w3schools.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>javascript</category>
      <category>programming</category>
      <category>frontend</category>
    </item>
  </channel>
</rss>
