<?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: cmccafferty96</title>
    <description>The latest articles on DEV Community by cmccafferty96 (@cmccafferty96).</description>
    <link>https://dev.to/cmccafferty96</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%2F1071625%2F45d58c90-f005-4732-b5fb-e04fe19053dd.png</url>
      <title>DEV Community: cmccafferty96</title>
      <link>https://dev.to/cmccafferty96</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/cmccafferty96"/>
    <language>en</language>
    <item>
      <title>Building A Full-Stack Application With Flask And React</title>
      <dc:creator>cmccafferty96</dc:creator>
      <pubDate>Wed, 19 Jul 2023 14:45:37 +0000</pubDate>
      <link>https://dev.to/cmccafferty96/building-a-full-stack-application-with-flask-and-react-1mkj</link>
      <guid>https://dev.to/cmccafferty96/building-a-full-stack-application-with-flask-and-react-1mkj</guid>
      <description>&lt;p&gt;In today's fast-paced world, web development has become an essential skill for tech enthusiasts and entrepreneurs alike. Full-stack development, which involves both front-end and back-end programming, allows you to create dynamic and interactive web applications. In this blog post, we'll explore the basics of building a full-stack application using Flask, a Python-based micro web framework, and React, a popular JavaScript library for building user interfaces.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prerequisites&lt;/strong&gt;&lt;br&gt;
Before diving into building a full-stack application, you should have a basic understanding of Python, JavaScript, and web development concepts. Familiarity with Flask and React will be beneficial but not mandatory. Make sure you have Python and Node.js installed on your computer. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Setting Up The Back-End With Flask&lt;/strong&gt;&lt;br&gt;
Step 1: Creating The Project Directory&lt;/p&gt;

&lt;p&gt;To start, let's create a new directory for our project. Open your terminal or command prompt and execute the following command:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Step 2: Setting Up A Virtual Environment:&lt;/p&gt;

&lt;p&gt;Next, we'll create a virtual environment to keep our project dependencies isolated. This step is crucial for managing package versions. Run the following commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;python -m venv venv
source venv/bin/activate # On Windows, use 'venv/Scripts/activate'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Step 3: Installing Flask&lt;/p&gt;

&lt;p&gt;With our virtual environment activated, let's install Flask using pip:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Step 4: Creating the Flask App&lt;/p&gt;

&lt;p&gt;Now create a a new file called 'app.py' and open it in your favorite code editor. We'll set up a basic Flask application:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from flask import Flask

app = Flask(__name__)

@app.route('/')
def hello_world():
    return 'Hello, World! This is our Flask backend.'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Step 5: Running the Flask App&lt;/p&gt;

&lt;p&gt;Save the 'app.py' file and run the Flask application&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;python app.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, if you visit '&lt;a href="http://localhost:5000"&gt;http://localhost:5000&lt;/a&gt;' in your web browser, you should see the message 'Hello, World! This is our Flask backend.'&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Setting Up the Front-End with React&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Step 1: Initializing a New React Project&lt;/p&gt;

&lt;p&gt;Now that our back-end is up and running, let's set up the front-end with React. In a new terminal or command prompt window, execute the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx create-react-app frontend
cd frontend
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Step 2: Starting the React Development Server&lt;/p&gt;

&lt;p&gt;React development server allows us to preview our application during development. Start the server with the following command:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Head over to '&lt;a href="http://localhost:3000"&gt;http://localhost:3000&lt;/a&gt;' in your browser, and you should see a basic React app. &lt;/p&gt;

&lt;p&gt;Step 3: Connecting React to the Flask Back-End&lt;/p&gt;

&lt;p&gt;Now, let's make our React app communicate with the Flask back-end. We'll use Axios, a popular HTTP client, to make API requests. First, install Axios:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Step 4: Creating a Simple API Request&lt;/p&gt;

&lt;p&gt;Open the 'src/App.js' file and import Axios at the top:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { useEffect, useState } from 'react';
import axios from 'axios';

const App = () =&amp;gt; {
  const [message, setMessage] = useState('');

useEffect(() =&amp;gt; {
   axios.get('http://localhost:5000/')
   .then((response) =&amp;gt;
setMessage(response.data)
   .catch((error) =&amp;gt; console.error(error));
}, []);

return (
 &amp;lt;div&amp;gt;
  &amp;lt;h1&amp;gt;{message}&amp;lt;/h1&amp;gt;
 &amp;lt;/div&amp;gt;
);
};

export default App;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this code, we use React's 'useEffect' hook to fetch data from our Flask back-end when the component mounts. The message returned from the API is then displayed on the page. &lt;/p&gt;

&lt;p&gt;Congratulations! You've successfully built a basic full-stack application using Flask and React. You've learned how to set up a Flask back-end and a React front-end, as well as how to connect the two using API requests. From here, you can explore further and add more features to your application, such as database integration, user authentication, and more complex React components. &lt;/p&gt;

&lt;p&gt;Remember that this is just the beginning, and there's so much more you can achieve with Flask and React. Keep exploring, building, and honing your web development skills to create even more powerful and sophisticated applications. &lt;/p&gt;

&lt;p&gt;Happy coding! :)&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Building A Restful API With Flask</title>
      <dc:creator>cmccafferty96</dc:creator>
      <pubDate>Fri, 30 Jun 2023 12:38:30 +0000</pubDate>
      <link>https://dev.to/cmccafferty96/building-a-restful-api-with-flask-36gm</link>
      <guid>https://dev.to/cmccafferty96/building-a-restful-api-with-flask-36gm</guid>
      <description>&lt;p&gt;Flask is a popular Python web framework that provides a simple and flexible way to build web applications. In this blog post, we'll explore how to create a RESTful API using Flask. RESTful APIs are a common way to expose data and functionality over the web, allowing other applications to interact with your application programmatically. Let's dive into the process of building a Flask-powered RESTful API.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Setting Up Flask&lt;/strong&gt;&lt;br&gt;
To get started, let's set up a basic Flask application. First, make sure you have Flask installed. You can install it using pip:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ pip install flask
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, crate a new Python file, for example, 'app.py', and import the necessary modules:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from flask import Flask

app = Flask(__name__)

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Creating API Endpoints:&lt;/strong&gt;&lt;br&gt;
API endpoints define the different routes that our API will expose. For example, let's create an endpoint that returns a list of users. Add the following code to the 'app.py':&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@app.route('/users', methods=['GET'])
def get_users():
    users = [
         {'id': 1, 'name': 'John'},
         {'id': 2, 'name':, 'Jane'},
         {'id': 3, 'name':, 'Bob'}
    ]
    return jsonify(users)

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

&lt;/div&gt;



&lt;p&gt;In this code snippet, we define an endpoint at '/users' that responds to HTTP GET requests. Inside the function, we create a list of user objects and return them as a JSON response using the 'jsonify' function. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Handling Request Parameters:&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;Often, APIs need to accept parameters to perform specific actions. Let's modify our '/users' endpoint to accept a query parameter for filtering the list of users by name:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from flask import request

@app.route('/users', methods=['GET'])
def get_users():
    name = request.args.get('name')
    filtered_users = [user for user in users if 
    user['name'] == name] if name else users 
    return jsonify(filtered_users)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now when calling '/users?name=John', the API will only return users whose name is 'John'. We use 'request.args.get('name')' to retrieve the value of the 'name' query parameter form the request URL.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Handling POST Requests:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To handle data creation, we can add a new endpoint that accepts POST requests to create a new user:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@app.route('/users', methods=['POST'])
def create_user():
    new_user = request.get_json()
    users.append(new_user)
    return jsonify(new_user), 201
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this code snippet, we retrieve the JSON payload from the request using 'request.get_json()', append the new user to the list of users, and return the new user with a 201 code indicating successful creation. &lt;/p&gt;

&lt;p&gt;In this post, we've explored the process of building a RESTful API using Flask. We covered setting up a basic Flask application, creating API endpoints, handling request parameters, and handling POST requests for data creation. Flask provides a straightforward and flexible framework for building APIs, and its simplicity makes it an excellent choice for small to medium-sized projects.&lt;/p&gt;

&lt;p&gt;Remember that these are just the basics, and Flask offers many more features and capabilities for building powerful APIs. Whether you're building a simple API or a complex application, Flask has you covered. &lt;/p&gt;

&lt;p&gt;Happy coding! &lt;/p&gt;

</description>
      <category>blog</category>
    </item>
    <item>
      <title>The Importance of Testing and Debugging in Python</title>
      <dc:creator>cmccafferty96</dc:creator>
      <pubDate>Fri, 09 Jun 2023 13:41:03 +0000</pubDate>
      <link>https://dev.to/cmccafferty96/the-importance-of-testing-and-debugging-in-python-1a7n</link>
      <guid>https://dev.to/cmccafferty96/the-importance-of-testing-and-debugging-in-python-1a7n</guid>
      <description>&lt;p&gt;Testing and debugging are crucial aspects of software development that ensure code reliability and correctness. In Python, there are several powerful tools and frameworks available to help developers write effective tests and debug their programs. In this blog post, we will explore the fundamentals of testing and debugging in Python and showcase practical examples using popular testing frameworks and debugging techniques. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Importance of Testing&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Testing plays a vital role in ensuring that our code behaves as expected and meets the specified requirements. By writing tests, we can catch bugs early, validate our code's functionality, and facilitate code maintenance and refactoring. Python provides several testing frameworks, including the built-in &lt;strong&gt;"unittest"&lt;/strong&gt; module and the third-party &lt;strong&gt;"pytest"&lt;/strong&gt; library, which offers various features to make testing efficient and comprehensive. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Getting Started with "unittest"&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;"unittest"&lt;/strong&gt; module is part of Python's standard library and provides a framework for writing and running tests. We can create test cases by subclassing the &lt;strong&gt;"unittest.TestCase"&lt;/strong&gt; class, which provides useful assertion methods for checking the expected behavior of our code. Let's consider an example where we want to test a function that adds two numbers:&lt;br&gt;
&lt;/p&gt;

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

def add_numbers(a, b):
    return a + b

class TestAddNumbers(unittest.TestCase):
    def test_add_numbers(self):
    result = add_numbers(2, 3)
    self.assertEqual(result, 5)

if __name__ == "__main__":
    unittest.main()

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

&lt;/div&gt;



&lt;p&gt;In this example, we define a test case &lt;strong&gt;"TestAddNumbers"&lt;/strong&gt; that inherits from &lt;strong&gt;"unittest.TestCase"&lt;/strong&gt;. The &lt;strong&gt;"test_add_numbers"&lt;/strong&gt; method tests that &lt;strong&gt;"add_numbers"&lt;/strong&gt; function by asserting that the result of adding 2 and 3 should be equal to 5. We run the tests by executing &lt;strong&gt;"unittest.main()"&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Advanced Testing with "pytest"&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;"pytest"&lt;/strong&gt; is a popular third-party testing framework that provides a more concise and flexible approach to writing tests. It offers powerful features such as fixture management, test parametrization, and test discovery. Let's extend our previous example using &lt;strong&gt;"pytest"&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

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

def add_numbers(a, b):
    return a + b 

def test_add_numbers():
    result = add_numbers(2, 3)
    assert result == 5 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this &lt;strong&gt;"pytest"&lt;/strong&gt; example, we define a simple test function &lt;strong&gt;"test_add_numbers"&lt;/strong&gt;. We use the &lt;strong&gt;"assert"&lt;/strong&gt; statement to check if the result of adding 2 and 3 is equal to 5. To run the tests, we can execute &lt;strong&gt;"pytest"&lt;/strong&gt; in the command line, and it will automatically discover and execute our test function. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Debugging Techniques&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Debugging is the process of identifying and fixing issues in our code. Python provides several tools and techniques to help with debugging. One of the most common approaches is using the &lt;strong&gt;"print"&lt;/strong&gt; statement to inspect variables and trace the flow of the program. However, Python also offers more advanced debugging tools like &lt;strong&gt;"pdb"&lt;/strong&gt;, the built in debugger.&lt;br&gt;
&lt;/p&gt;

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

def divide_numbers(a, b):
    pdb.set_trace()
    result = a / b
    return result

divide_numbers(10, 0)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, we use &lt;strong&gt;"pdb.set_trace()"&lt;/strong&gt; to set a breakpoint in our code. When executed, the program will pause at this line, allowing us to interactively inspect variables, execute code step by step, and diagnose the issue. We can navigate through the code using commands such as &lt;strong&gt;"n"&lt;/strong&gt; (next line) and &lt;strong&gt;"p"&lt;/strong&gt; (print variable value).&lt;/p&gt;

&lt;p&gt;Testing and debugging are essential practices in Python development. By writing tests, we can ensure the correctness and reliability of our code, while debugging techniques help us identify and fix issues efficiently. In this blog post, we explored the basics of testing using the &lt;strong&gt;"unittest"&lt;/strong&gt; module and the more flexible &lt;strong&gt;"pytest"&lt;/strong&gt; framework. Additionally, we discussed debugging techniques using the &lt;strong&gt;"pdb"&lt;/strong&gt; debugger. With these tools and techniques at your disposal, you'll be equipped to write robust, bug-free Python code. &lt;/p&gt;

&lt;p&gt;Remember, testing and debugging are iterative processes, and continuous improvement is key. Happy testing and debugging in Python! &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Unleashing The Power of .map in React</title>
      <dc:creator>cmccafferty96</dc:creator>
      <pubDate>Wed, 17 May 2023 13:57:38 +0000</pubDate>
      <link>https://dev.to/cmccafferty96/unleashing-the-power-of-map-in-react-4njn</link>
      <guid>https://dev.to/cmccafferty96/unleashing-the-power-of-map-in-react-4njn</guid>
      <description>&lt;p&gt;React, the widely used JavaScript library for building user interfaces, offers a plethora of powerful features that streamline the development process. One such feature is the .map method, a versatile tool to iterate over arrays and manipulate data effortlessly. By mastering this fundamental technique, you can enhance your coding experience and create dynamic and more efficient React applications. &lt;/p&gt;

&lt;p&gt;The .map method is an indispensable function in React that simplifies the manipulation of arrays. It applies a provided function to each item and returns a new array comprising the results. This flexibility enables developers to transform data, generate dynamic content, and render lists with remarkable ease. &lt;/p&gt;

&lt;p&gt;One of the primary use cases for .map in React is rendering lists. Take a look at the following where we have a an array of user objects and want to display their names in a list:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const users = [
{id: 1, name: 'John Doe'},
{ id: 2, name: 'Jane Smith' },
{ id: 3, name: 'Mike Johnson' },
];

const UserList = () =&amp;gt; {
  return (
    &amp;lt;ul&amp;gt;
      {users.map((user) =&amp;gt; (
        &amp;lt;li key={user.id}&amp;gt;{user.name}&amp;lt;/li&amp;gt;
      ))}
    &amp;lt;/ul&amp;gt;
  );
};

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

&lt;/div&gt;



&lt;p&gt;In this code snippet we define an array of user objects and use the .map method to iterate over each user, generating a corresponding &lt;strong&gt;'li'&lt;/strong&gt; element with their name. The &lt;strong&gt;'key'&lt;/strong&gt; prop is crucial to ensure efficient rendering and proper component reconciliation. &lt;/p&gt;

&lt;p&gt;.map also empowers developers to generate dynamic content based on array data. Let's say we have an array of posts, and we want to display them dynamically.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const posts = [
  { id: 1, title: 'React Hooks', content: 'Learn about React Hooks.' },
  { id: 2, title: 'State Management', content: 'Managing state in React.' },
  { id: 3, title: 'Testing in React', content: 'Write effective tests for React apps.' },
];

const PostList = () =&amp;gt; {
  return (
    &amp;lt;div&amp;gt;
      {posts.map((post) =&amp;gt; (
        &amp;lt;div key={post.id}&amp;gt;
          &amp;lt;h2&amp;gt;{post.title}&amp;lt;/h2&amp;gt;
          &amp;lt;p&amp;gt;{post.content}&amp;lt;/p&amp;gt;
        &amp;lt;/div&amp;gt;
      ))}
    &amp;lt;/div&amp;gt;
  );
};

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

&lt;/div&gt;



&lt;p&gt;In this example, the .map method iterates over each post object in the array, generating a &lt;strong&gt;'div'&lt;/strong&gt; element for each post. The title and content are then dynamically rendered with each div, offering a seamless and efficient way to display dynamic content. &lt;/p&gt;

&lt;p&gt;.map can also be combined with conditional logic to conditionally render components. Let's consider this example where we want to render different elements based on a user's role:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const users = [
  { id: 1, name: 'John Doe', role: 'admin' },
  { id: 2, name: 'Jane Smith', role: 'user' },
  { id: 3, name: 'Mike Johnson', role: 'admin' },
];

const UserList = () =&amp;gt; {
  return (
    &amp;lt;ul&amp;gt;
      {users.map((user) =&amp;gt; (
        &amp;lt;li key={user.id}&amp;gt;
          {user.name} - {user.role === 'admin' ? 'Admin' : 'User'}
        &amp;lt;/li&amp;gt;
      ))}
    &amp;lt;/ul&amp;gt;
  );
};

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

&lt;/div&gt;



&lt;p&gt;In this example, the .map method is used to iterate over the users array. Within each &lt;strong&gt;'li'&lt;/strong&gt; element, we conditionally render either 'Admin' or 'User' based on the user's role. This allows for dynamic rendering and customization based on different data conditions. &lt;/p&gt;

&lt;p&gt;The .map method in React is a powerful and versatile tool that simplifies iteration and manipulation of arrays. By leveraging .map, you can streamline list rendering, generate dynamic content, and implement conditional rendering with ease. Understanding utilizing this fundamental technique will enable you to write cleaner, more concise, and highly maintainable code. &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Learning to love JavaScript Event Listeners</title>
      <dc:creator>cmccafferty96</dc:creator>
      <pubDate>Tue, 25 Apr 2023 20:46:11 +0000</pubDate>
      <link>https://dev.to/cmccafferty96/learning-to-love-javascript-event-listeners-5co</link>
      <guid>https://dev.to/cmccafferty96/learning-to-love-javascript-event-listeners-5co</guid>
      <description>&lt;p&gt;My name is Claire and I'm currently a student at Flatiron studying software engineering. I'll admit, coming into this I considered myself a "tech savvy" individual, but after completing the first week I was very overwhelmed by the amount of information I didn't know or understand. I truly had no idea just how much is going on behind the scenes of even a simple wikipedia page. It changed my perspective on coding in general, as I realized just how much thought goes into creating, whether it's a webpage, an app, or a video game. Which leads me to the main topic of this blog post, event listeners! &lt;/p&gt;

&lt;p&gt;I remember when I first read about event listeners in the pre-work, the concept really confused me. I didn't understand how you could write a simple line of code, and then like magic, change something on a webpage. It was after getting through week-one that the concept started to become less abstract and more applicable. I've learned to really love event listeners, specifically because they can make a pretty boring webpage more interactive and/or dynamic, and the fact that there are so many event listeners you can choose from. &lt;/p&gt;

&lt;p&gt;The most common example is a "click" event. I'm going to be honest, I was humbled learning that every time you are able to click on something on a website, it's because a developer put it there intentionally. I know that might sounds kind of funny to someone who has experience coding, but as a beginner, I truly thought that the website just &lt;em&gt;knew&lt;/em&gt; to do that. &lt;/p&gt;

&lt;p&gt;Here is an example of a "click" event in action: &lt;/p&gt;

&lt;p&gt;const button = document.getElementById("button")&lt;/p&gt;

&lt;p&gt;button.addEventListener("click", () =&amp;gt; {&lt;br&gt;
    console.log("I was clicked")&lt;br&gt;
})&lt;/p&gt;

&lt;p&gt;In this example, we have selected the HTML element with an ID of "button", and added an event listener to it so that when that button is clicked, it will display the message "I was clicked".&lt;br&gt;
This is a very basic example of a click event, but gives you the general idea of how they work. As you continue to develop your programming skills, the functionality of event listeners becomes way more dynamic, and in my opinion, really fun! &lt;/p&gt;

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