<?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: Ruben Salazar</title>
    <description>The latest articles on DEV Community by Ruben Salazar (@ruben_salazar_ea6982ebd94).</description>
    <link>https://dev.to/ruben_salazar_ea6982ebd94</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%2F1545351%2F27f6527a-a56b-479f-94a5-288c4ca70446.jpg</url>
      <title>DEV Community: Ruben Salazar</title>
      <link>https://dev.to/ruben_salazar_ea6982ebd94</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ruben_salazar_ea6982ebd94"/>
    <language>en</language>
    <item>
      <title>The Dreaded Headache of Recursion in Database Serialization — And How to Fix It</title>
      <dc:creator>Ruben Salazar</dc:creator>
      <pubDate>Wed, 11 Jun 2025 03:33:12 +0000</pubDate>
      <link>https://dev.to/ruben_salazar_ea6982ebd94/the-dreaded-headache-of-recursion-in-database-serialization-and-how-to-fix-it-ni5</link>
      <guid>https://dev.to/ruben_salazar_ea6982ebd94/the-dreaded-headache-of-recursion-in-database-serialization-and-how-to-fix-it-ni5</guid>
      <description>&lt;p&gt;If you’ve worked on building web applications that involve relational databases, you’ve probably faced a common and frustrating problem: recursive data serialization. It often rears its ugly head when you try to convert your database models into JSON for APIs or frontend consumption — and suddenly your app crashes, throws errors, or just spirals into an infinite loop.&lt;br&gt;
In this post, we’ll dive into why this happens, how to design your database and serialization logic to avoid it, and what to do if you hit a dead end.&lt;/p&gt;

&lt;p&gt;Why Recursion Happens in Serialization&lt;br&gt;
Relational databases inherently contain relationships. You might have tables like Users, Posts, and Comments, where:&lt;br&gt;
    • A User has many Posts&lt;br&gt;
    • A Post belongs to a User and has many Comments&lt;br&gt;
    • A Comment belongs to a Post and a User&lt;br&gt;
When you ask your ORM (Object-Relational Mapper) to serialize a User, it might include all their Posts — which in turn includes each Post’s Comments — which includes the Comment’s User — which again includes all that User’s Posts — and so on.&lt;br&gt;
This circular referencing causes recursive serialization, where the data tries to expand indefinitely.&lt;/p&gt;

&lt;p&gt;Mapping Out Your Database to Prevent Recursion&lt;br&gt;
The first step is careful planning of your relationships and how you serialize them:&lt;br&gt;
    • Know your relationship directions: Understand which relationships are one-way and which are bi-directional.&lt;br&gt;
    • Set clear serialization rules: Most ORMs allow you to exclude certain relationships from serialization to break the recursion loop.&lt;br&gt;
    • Use serialization mixins or tools: Libraries like SQLAlchemy’s SerializerMixin let you specify which relationships to include or exclude when converting to JSON.&lt;br&gt;
For example, in SQLAlchemy, if you have a User with a listings relationship and a Listing with a user relationship, serializing both fully can cause a loop. You can exclude Listing.user when serializing User.listings to avoid this.&lt;/p&gt;

&lt;p&gt;Targeted Serialization: Pick What You Really Need&lt;br&gt;
If excluding some relationships isn’t enough, or the structure is too complex, the safest bet is to serialize only the specific data fields or relationships your frontend actually needs. This approach:&lt;br&gt;
    • Reduces data size over the wire&lt;br&gt;
    • Avoids accidental recursive loops&lt;br&gt;
    • Gives you control over API output&lt;br&gt;
You can create custom serialization methods on your models that output plain dictionaries with only necessary fields, or use dedicated serializers like Marshmallow or Pydantic.&lt;/p&gt;

&lt;p&gt;When You’re Stuck: Tips to Untangle Serialization&lt;br&gt;
    • Trace your relationships: Draw your tables and their foreign keys. Visualizing the graph helps identify loops.&lt;br&gt;
    • Test serialization step by step: Serialize just one model at a time, then add relationships gradually.&lt;br&gt;
    • Use debugging tools: Many ORMs and serializers provide hooks or logging to see exactly what data is being traversed.&lt;br&gt;
    • Fallback to manual serialization: If your ORM’s automatic serialization is too complex, write explicit JSON-building code.&lt;/p&gt;

&lt;p&gt;Final Thoughts&lt;br&gt;
Recursive serialization headaches are common in complex apps, but they’re manageable with the right approach:&lt;br&gt;
    1   Plan your database relationships carefully to minimize cycles.&lt;br&gt;
    2   Use serialization rules or mixins to exclude or limit nested data.&lt;br&gt;
    3   Explicitly serialize only the data your UI needs.&lt;br&gt;
If you take these steps, your API responses will be efficient, safe from infinite loops, and easier to maintain.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>[Boost]</title>
      <dc:creator>Ruben Salazar</dc:creator>
      <pubDate>Wed, 11 Jun 2025 02:43:52 +0000</pubDate>
      <link>https://dev.to/ruben_salazar_ea6982ebd94/-3kpc</link>
      <guid>https://dev.to/ruben_salazar_ea6982ebd94/-3kpc</guid>
      <description></description>
      <category>productivity</category>
      <category>career</category>
      <category>discuss</category>
    </item>
    <item>
      <title>🎵 Building Many-to-Many Relationships in Flask: A Music Shed Case Study</title>
      <dc:creator>Ruben Salazar</dc:creator>
      <pubDate>Thu, 01 May 2025 17:24:15 +0000</pubDate>
      <link>https://dev.to/ruben_salazar_ea6982ebd94/building-many-to-many-relationships-in-flask-a-music-shed-case-study-190e</link>
      <guid>https://dev.to/ruben_salazar_ea6982ebd94/building-many-to-many-relationships-in-flask-a-music-shed-case-study-190e</guid>
      <description>&lt;p&gt;Flask is a lightweight Python web framework that makes building RESTful APIs fast and intuitive. One of the common patterns you'll encounter when building applications with Flask and SQLAlchemy is the many-to-many relationship. In my project, Music Shed, I used Flask to build the backend for a lesson booking platform where students can connect with teachers for music lessons.&lt;/p&gt;

&lt;p&gt;Let’s walk through how Flask and SQLAlchemy helped bring this relationship to life.&lt;/p&gt;

&lt;p&gt;What Is a Many-to-Many Relationship?&lt;br&gt;
In a typical many-to-many setup, one item can be associated with many other items — and vice versa. In Music Shed, a student can book lessons with multiple teachers, and a teacher can teach multiple students. This relationship is best represented with a join table — in our case, it’s called appointments.&lt;/p&gt;

&lt;p&gt;How We Built It with Flask + SQLAlchemy&lt;br&gt;
In models.py, we define three key models: Student, Teacher, and Appointment. Here's the simplified version:&lt;/p&gt;

&lt;p&gt;python&lt;br&gt;
Copy&lt;br&gt;
Edit&lt;br&gt;
class Student(db.Model):&lt;br&gt;
    # ...&lt;br&gt;
    appointments = db.relationship("Appointment", back_populates="student")&lt;br&gt;
    teachers = db.relationship("Teacher", secondary="appointments", back_populates="students")&lt;/p&gt;

&lt;p&gt;class Teacher(db.Model):&lt;br&gt;
    # ...&lt;br&gt;
    appointments = db.relationship("Appointment", back_populates="teacher")&lt;br&gt;
    students = db.relationship("Student", secondary="appointments", back_populates="teachers")&lt;/p&gt;

&lt;p&gt;class Appointment(db.Model):&lt;br&gt;
    # ...&lt;br&gt;
    student_id = db.Column(db.Integer, db.ForeignKey('students.id'))&lt;br&gt;
    teacher_id = db.Column(db.Integer, db.ForeignKey('teachers.id'))&lt;br&gt;
    lesson_datetime = db.Column(db.DateTime)&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;student = db.relationship("Student", back_populates="appointments")
teacher = db.relationship("Teacher", back_populates="appointments")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The appointments table acts as the bridge between students and teachers, holding additional info like lesson_datetime.&lt;/p&gt;

&lt;p&gt;Flask Routes That Use the Relationship&lt;br&gt;
Using Flask-RESTful, I created a POST /appointments route to let a student book a lesson:&lt;/p&gt;

&lt;p&gt;python&lt;br&gt;
Copy&lt;br&gt;
Edit&lt;br&gt;
class AppointmentList(Resource):&lt;br&gt;
    def post(self):&lt;br&gt;
        data = request.get_json()&lt;br&gt;
        new_appointment = Appointment(&lt;br&gt;
            student_id=data['student_id'],&lt;br&gt;
            teacher_id=data['teacher_id'],&lt;br&gt;
            lesson_datetime=datetime.fromisoformat(data['lesson_datetime'])&lt;br&gt;
        )&lt;br&gt;
        db.session.add(new_appointment)&lt;br&gt;
        db.session.commit()&lt;br&gt;
        return new_appointment.to_dict(), 201&lt;br&gt;
When a student logs in, the frontend uses /students/:id/appointments to display all upcoming lessons — each joined with the teacher's info.&lt;/p&gt;

&lt;p&gt;Wrapping Up&lt;br&gt;
Flask and SQLAlchemy make it simple to model complex relationships like many-to-many. In Music Shed, we used this pattern to power a real-world booking system between students and music teachers.&lt;/p&gt;

&lt;p&gt;If you're building your own Flask app, understanding how to model these connections will unlock a lot of flexibility in your design. 🎶&lt;/p&gt;

</description>
    </item>
    <item>
      <title>SQLite! Works Great! Less Filing! Why SQLite is an Easy and Efficient Way to Store Data in a Database</title>
      <dc:creator>Ruben Salazar</dc:creator>
      <pubDate>Wed, 26 Feb 2025 16:41:03 +0000</pubDate>
      <link>https://dev.to/ruben_salazar_ea6982ebd94/sqlite-works-great-less-filing-why-sqlite-is-an-easy-and-efficient-way-to-store-data-in-a-39c5</link>
      <guid>https://dev.to/ruben_salazar_ea6982ebd94/sqlite-works-great-less-filing-why-sqlite-is-an-easy-and-efficient-way-to-store-data-in-a-39c5</guid>
      <description>&lt;p&gt;&lt;strong&gt;Why SQLite is Great for Storing Data in a Database&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you're new to coding and you're wondering how to store data, you're probably thinking about databases. A database is a place where you can store, manage, and retrieve data efficiently. But when you're just starting out, managing a database can seem overwhelming. That's where &lt;strong&gt;SQLite&lt;/strong&gt; comes in—it’s an easy-to-use, lightweight database that’s perfect for beginners. In this blog, let’s dive into why SQLite is a great choice for storing data, especially when you're just starting your coding journey.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is SQLite?
&lt;/h3&gt;

&lt;p&gt;At its core, SQLite is a &lt;strong&gt;relational database management system (RDBMS)&lt;/strong&gt;, which means it stores data in tables that can be related to each other. The key feature of SQLite is that it doesn’t require a separate server to run. This makes it super easy to set up and use. You don’t need to worry about installing and configuring complex software or maintaining an entire database server like with other databases (think MySQL or PostgreSQL). SQLite is embedded directly into your application, meaning everything is stored in a single file on your computer or device. &lt;/p&gt;

&lt;h3&gt;
  
  
  Simple Setup and No Server Required
&lt;/h3&gt;

&lt;p&gt;One of the most attractive things about SQLite is how simple it is to get started. All you need is the SQLite software installed (which comes by default with Python and other programming languages). You don’t need to set up a server or worry about network connections—SQLite does everything locally in a single file. This means you can quickly start creating and manipulating databases without worrying about complicated setup procedures.&lt;/p&gt;

&lt;p&gt;For example, you can use SQLite to create a database that stores the list of contacts, tasks, or even records of users in an application. It’s all about simplicity and convenience.&lt;/p&gt;

&lt;h3&gt;
  
  
  Ideal for Small to Medium Projects
&lt;/h3&gt;

&lt;p&gt;If you’re building a small project or even a personal application, SQLite is perfect. Think about making an app where you need to save user data, or perhaps an app for tracking your expenses. SQLite is small, fast, and efficient for such use cases. You won’t need a large, complex system to handle data. SQLite is lightweight and does a fantastic job for apps that don’t need the overhead of a full-scale database server.&lt;/p&gt;

&lt;h3&gt;
  
  
  Easy to Learn
&lt;/h3&gt;

&lt;p&gt;One of the best things about SQLite is that it’s a great learning tool for beginners. The database is based on SQL (Structured Query Language), which is the most popular language used to manage data in databases. SQL is simple to learn, and you can start writing queries to insert, update, or retrieve data from your database with just a few commands. &lt;/p&gt;

&lt;p&gt;Here’s an example of creating a table and inserting data in SQLite:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;sqlite3&lt;/span&gt;

&lt;span class="c1"&gt;# Create a connection to a new database
&lt;/span&gt;&lt;span class="n"&gt;conn&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;sqlite3&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;connect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;example.db&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;cursor&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;conn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="c1"&gt;# Create a table
&lt;/span&gt;&lt;span class="n"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'''&lt;/span&gt;&lt;span class="s"&gt;CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY, name TEXT, age INTEGER)&lt;/span&gt;&lt;span class="sh"&gt;'''&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Insert some data
&lt;/span&gt;&lt;span class="n"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'''&lt;/span&gt;&lt;span class="s"&gt;INSERT INTO users (name, age) VALUES (&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Alice&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;, 30)&lt;/span&gt;&lt;span class="sh"&gt;'''&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Commit the transaction and close
&lt;/span&gt;&lt;span class="n"&gt;conn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;commit&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;conn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;close&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In just a few lines of code, you’ve created a table and inserted data into it. It's that simple!&lt;/p&gt;

&lt;h3&gt;
  
  
  Portable and Flexible
&lt;/h3&gt;

&lt;p&gt;SQLite databases are stored in a single file, making them incredibly portable. If you want to move your data from one computer to another, you just need to copy the file. There’s no need to worry about data migration or complex setups. If you decide to change your project or even develop a mobile app, SQLite databases can easily be integrated into mobile platforms (like iOS and Android).&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;SQLite is a fantastic choice for those new to coding, and here's why: it’s simple to set up, easy to learn, lightweight, and perfect for small to medium-sized projects. You don’t need to deal with a complex database server or complicated setup steps. If you’re just starting out with databases, SQLite is the perfect tool to learn and grow your skills, all while storing data efficiently. So, give it a try in your next project—you’ll quickly see why it’s one of the most popular databases out there for beginners!&lt;/p&gt;

</description>
      <category>sqlite</category>
      <category>database</category>
    </item>
    <item>
      <title>useEffect to Fetch and Go GET'em!</title>
      <dc:creator>Ruben Salazar</dc:creator>
      <pubDate>Tue, 17 Dec 2024 00:12:23 +0000</pubDate>
      <link>https://dev.to/ruben_salazar_ea6982ebd94/useeffect-to-fetch-and-go-getem-44g7</link>
      <guid>https://dev.to/ruben_salazar_ea6982ebd94/useeffect-to-fetch-and-go-getem-44g7</guid>
      <description>&lt;p&gt;Hey Y'all! &lt;br&gt;
In this episode of React, What's That?!, We'll be discussing the simple use of a hook known as useEffect to help us run a side effect that will fetch us data from an API. &lt;/p&gt;

&lt;p&gt;The fetch request that we will be using is called a GET request and it is used to simply get data from an API. The setup for a GET request is simple and straightforward. But before we "gets to GET'n", let's talk about useEffect. &lt;/p&gt;

&lt;p&gt;First, what is useEffect. If you search the definition, you will find that useEffect is a Hook that allows you to perform side effects in your functional components. Ah, but what is a side effect, you ask? Well, side effects are, according to the internet, actions that affect something outside the scope of your component, like: Fetching data from an API, Updating the DOM directly, Setting up subscriptions or timers, and Interacting with browser APIs. Great!!&lt;/p&gt;

&lt;p&gt;So first, let's establish what we want to do. How about render data from an API to the DOM. Simple yet elegant. &lt;/p&gt;

&lt;p&gt;Step 1. import { useEffect, useState } from 'react'&lt;/p&gt;

&lt;p&gt;Step 2. create your function.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function MyComponent() {
    return()
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Step 3. create the variables that will set the state.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;       function MyComponent() {
         const [data, setData] = useState([])
           return()
            }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Step 4. useEffect!&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;     function MyComponent() {
       const [data, setData] = useState([])

     useEffect(() =&amp;gt; {
       const fetch('example https://api')
                  .then((response)=&amp;gt; 
                     response.json())
                  .then((data)=&amp;gt; setData(data)
                   }, [])
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;How does useEffect work?&lt;br&gt;
It takes two arguments:&lt;br&gt;
A function that contains the side effect logic.&lt;br&gt;
An optional dependency array.&lt;br&gt;
The function runs after every render by default, but you can control when it runs using the dependency array.&lt;br&gt;
If the dependency array is empty, the effect runs only once after the initial render.&lt;br&gt;
If the dependency array contains values, the effect runs whenever one of those values changes.&lt;/p&gt;

&lt;p&gt;In React, when you call a function like setData, you're typically using a state setter function provided by the useState hook. This function updates the state of a component, and React re-renders the component to reflect the new state.&lt;/p&gt;

&lt;p&gt;Once that data has been fetched, then you will want to render the data to your DOM by using the Map() method within the return(). &lt;/p&gt;

&lt;p&gt;Step 5.  Render to the DOM. &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;       return(
         &amp;lt;div&amp;gt;
           {data.map(item =&amp;gt; (
              &amp;lt;p key={item.id}&amp;gt;{item.name}&amp;lt;/p&amp;gt;
           ))}
         &amp;lt;/div&amp;gt;
        )
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;If the data from the API has different key:value pairs, then you can render those different values using the, "item" object. Item.description, if there is a description, item.price, if there is a price, and so on. &lt;/p&gt;

&lt;p&gt;This basic setup will render the data that was fetched from the API to your DOM. You can then use CSS to style it how you would like. &lt;/p&gt;

&lt;p&gt;Rendering data to your DOM from an API really can't be simpler.&lt;/p&gt;

&lt;p&gt;Cheers!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Hyperlinks: Quick and easy.</title>
      <dc:creator>Ruben Salazar</dc:creator>
      <pubDate>Fri, 13 Dec 2024 20:08:17 +0000</pubDate>
      <link>https://dev.to/ruben_salazar_ea6982ebd94/hyperlinks-quick-and-easy-2gmj</link>
      <guid>https://dev.to/ruben_salazar_ea6982ebd94/hyperlinks-quick-and-easy-2gmj</guid>
      <description>&lt;p&gt;In a world where so much of life is lived online, a sleek and efficient user experience is crucial.&lt;br&gt;
It is important to get a user what they need as quickly and efficiently as possible. One of the ways this can be done is through Javascript's capability allowing for a user to append hyperlinks to the DOM without having to first build the &lt;a&gt; tag in HTML.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For example, let's say that you have created a submit event that returns a web address from an API after a form has been submitted. In this instance, I created a search event which allowed users to enter a State in order to view a list of Breweries within that state. If all the user wanted was a list of returned web addresses appended to the DOM, that's great but what if you didn't want to have to make the client copy the returned web address and then go through the anguish of pasting it into the search bar. What if multiple values were returned and the client was on a phone and didn't have time to stop, copy and paste multiple values one at at time? &lt;/p&gt;

&lt;p&gt;What if, you wanted to make the clients life even easier by returning an address that would take them to their destination with the click of a mouse. "Make the clients life even easier?!", you ask. YES!&lt;/p&gt;

&lt;p&gt;I was able to improve the client experience with the return of a single click web address.  &lt;/p&gt;

&lt;p&gt;Initially I had built a submit event that returned the web address to a list a breweries in any given state in the U.S.A. However, initially what I was able to return was an address but it was not  hyperlinked, which wasn't bad but it wasn't great either. Because it is the developer's job to create the best client experience within a given scope, within my function that made it possible to submit a form, I created the beloved &lt;a&gt; tag. &lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Below is a function that allows a user to submit a state, Texas, California, etc, and return a hyperlink to a website of a brewery located within that particular state.&lt;/p&gt;

&lt;p&gt;function submitState(breweryUrl){&lt;br&gt;
    const div = document.createElement('div')&lt;/p&gt;

&lt;p&gt;I already had the submit event created and appending to the DOM but without the &lt;a&gt; tag, I wasn't getting back what I needed and that is a hyperlink. A functional &lt;/a&gt;&lt;/p&gt;

&lt;p&gt;hyperlink cannot exist without an &lt;a&gt; tag in Javascript.&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;item 1 
let aTag = document.createElement('a')&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;let btn = document.createElement('button')&lt;br&gt;
btn.addEventListener('click', handleDelete)&lt;br&gt;
btn.textContent = 'x'&lt;/p&gt;

&lt;p&gt;Once I created the the &lt;a&gt; tag element, I needed to make the textContent of the aTag, dynamic because I would be returning any number of web addresses from many different breweries.&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;item 2 
aTag.textContent = &lt;code&gt;${breweryUrl}&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then, in order for the &lt;a&gt; tag to function properly, an href (hyperlink reference) element needed to be created and appended to the div that housed the Url Container.&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;item 3 
aTag.href = breweryUrl&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once all that was done, then I used appendChild to append the aTag to the div since the &lt;a&gt; tag would be a child to the parent element, div.&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;item 4 
div.appendChild(aTag)
div.appendChild(btn)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Last but not least, using a querySelector to find the Url Container, I was able to then append the div that contains the &lt;a&gt; tag to the div with an id of url_conatiner. &lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;item 5 document.querySelector('#url_container').append(div)
}&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After that, returning a hyperlink to the web sites of various breweries was then possible and the brewery locating world was a better place. &lt;/p&gt;

&lt;p&gt;This is my first blog and I'm new to the community. I would greatly appreciate any feedback/constructive criticism so that I can better participate and contribute to the culture.  &lt;/p&gt;

&lt;p&gt;CHEERS!&lt;/p&gt;

&lt;p&gt;Ruben Salazar&lt;/p&gt;

</description>
      <category>hyperlinks</category>
    </item>
    <item>
      <title>Hyperlinks: Quick and easy.</title>
      <dc:creator>Ruben Salazar</dc:creator>
      <pubDate>Wed, 11 Sep 2024 19:11:35 +0000</pubDate>
      <link>https://dev.to/ruben_salazar_ea6982ebd94/hyperlinks-quick-and-easy-45j8</link>
      <guid>https://dev.to/ruben_salazar_ea6982ebd94/hyperlinks-quick-and-easy-45j8</guid>
      <description>&lt;p&gt;In a world where so much of life is lived online, a sleek and efficient user experience is crucial.&lt;br&gt;
It is important to get a user what they need as quickly and efficiently as possible. One of the ways this can be done is through Javascript's capability allowing for a user to append hyperlinks to the DOM without having to first build the &lt;a&gt; tag in HTML.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For example, let's say that you have created a submit event that returns a web address from an API after a form has been submitted. In this instance, I created a search event which allowed users to enter a State in order to view a list of Breweries within that state. If all the user wanted was a list of returned web addresses appended to the DOM, that's great but what if you didn't want to have to make the client copy the returned web address and then go through the anguish of pasting it into the search bar. What if multiple values were returned and the client was on a phone and didn't have time to stop, copy and paste multiple values one at at time? &lt;/p&gt;

&lt;p&gt;What if, you wanted to make the clients life even easier by returning an address that would take them to their destination with the click of a mouse. "Make the clients life even easier?!", you ask. YES!&lt;/p&gt;

&lt;p&gt;I was able to improve the client experience with the return of a single click web address.  &lt;/p&gt;

&lt;p&gt;Initially I had built a submit event that returned the web address to a list a breweries in any given state in the U.S.A. However, initially what I was able to return was an address but it was not  hyperlinked, which wasn't bad but it wasn't great either. Because it is the developer's job to create the best client experience within a given scope, within my function that made it possible to submit a form, I created the beloved &lt;a&gt; tag. &lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Below is a function that allows a user to submit a state, Texas, California, etc, and return a hyperlink to a website of a brewery located within that particular state.&lt;/p&gt;

&lt;p&gt;function submitState(breweryUrl){&lt;br&gt;
    const div = document.createElement('div')&lt;/p&gt;

&lt;p&gt;I already had the submit event created and appending to the DOM but without the &lt;a&gt; tag, I wasn't getting back what I needed and that is a hyperlink. A functional &lt;/a&gt;&lt;/p&gt;

&lt;p&gt;hyperlink cannot exist without an &lt;a&gt; tag in Javascript.&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;item 1 
let aTag = document.createElement('a')&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;let btn = document.createElement('button')&lt;br&gt;
btn.addEventListener('click', handleDelete)&lt;br&gt;
btn.textContent = 'x'&lt;/p&gt;

&lt;p&gt;Once I created the the &lt;a&gt; tag element, I needed to make the textContent of the aTag, dynamic because I would be returning any number of web addresses from many different breweries.&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;item 2 
aTag.textContent = &lt;code&gt;${breweryUrl}&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then, in order for the &lt;a&gt; tag to function properly, an href (hyperlink reference) element needed to be created and appended to the div that housed the Url Container.&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;item 3 
aTag.href = breweryUrl&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once all that was done, then I used appendChild to append the aTag to the div since the &lt;a&gt; tag would be a child to the parent element, div.&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;item 4 
div.appendChild(aTag)
div.appendChild(btn)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Last but not least, using a querySelector to find the Url Container, I was able to then append the div that contains the &lt;a&gt; tag to the div with an id of url_conatiner. &lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;item 5 document.querySelector('#url_container').append(div)
}&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After that, returning a hyperlink to the web sites of various breweries was then possible and the brewery locating world was a better place. &lt;/p&gt;

&lt;p&gt;This is my first blog and I'm new to the community. I would greatly appreciate any feedback/constructive criticism so that I can better participate and contribute to the culture.  &lt;/p&gt;

&lt;p&gt;CHEERS!&lt;/p&gt;

&lt;p&gt;Ruben Salazar&lt;/p&gt;

</description>
      <category>hyperlinks</category>
    </item>
  </channel>
</rss>
