<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
    <channel>
        
        <title>
            <![CDATA[ Web Components - freeCodeCamp.org ]]>
        </title>
        <description>
            <![CDATA[ Browse thousands of programming tutorials written by experts. Learn Web Development, Data Science, DevOps, Security, and get developer career advice. ]]>
        </description>
        <link>https://www.freecodecamp.org/news/</link>
        <image>
            <url>https://cdn.freecodecamp.org/universal/favicons/favicon.png</url>
            <title>
                <![CDATA[ Web Components - freeCodeCamp.org ]]>
            </title>
            <link>https://www.freecodecamp.org/news/</link>
        </image>
        <generator>Eleventy</generator>
        <lastBuildDate>Mon, 25 May 2026 15:48:32 +0000</lastBuildDate>
        <atom:link href="https://www.freecodecamp.org/news/tag/web-components/rss.xml" rel="self" type="application/rss+xml" />
        <ttl>60</ttl>
        
            <item>
                <title>
                    <![CDATA[ An Animated Introduction to Web Development from Back to Front ]]>
                </title>
                <description>
                    <![CDATA[ Web development combines multiple technologies to create interactive applications that run in web servers and browsers. Modern web apps require understanding both the server-side (back end) and client-side (front end) and how they communicate with ea... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/an-animated-introduction-to-web-development-from-back-to-front/</link>
                <guid isPermaLink="false">685c658face24766313d6c64</guid>
                
                    <category>
                        <![CDATA[ Web Development ]]>
                    </category>
                
                    <category>
                        <![CDATA[ JavaScript ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Node.js ]]>
                    </category>
                
                    <category>
                        <![CDATA[ React ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Web Components ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Mark Mahoney ]]>
                </dc:creator>
                <pubDate>Wed, 25 Jun 2025 21:09:35 +0000</pubDate>
                <media:content url="https://cdn.hashnode.com/res/hashnode/image/upload/v1750883709276/9a8aeb7d-51f8-4412-9ead-e833f4577fde.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Web development combines multiple technologies to create interactive applications that run in web servers and browsers. Modern web apps require understanding both the server-side (back end) and client-side (front end) and how they communicate with each other. This involves learning languages along with tools and frameworks that streamline development.</p>
<p>Web development has evolved significantly over the past decade. Today's developers work with sophisticated frameworks, build APIs, manage databases, and create responsive user interfaces. The ecosystem continues to grow with new tools emerging regularly.</p>
<p>This tutorial will get you started learning some of the most used tools and technologies of the trade. You'll learn about JavaScript, HTTP, Node, Express, JSON, SQLite, Mongo, HTML, CSS, Web Components, React, and GraphQL.</p>
<p>Even though there are 35 different programs in it, there are a lot of cool technologies that I am not covering. Hopefully, this material sparks your interest and you begin a journey to learn about the wonderful ecosystem built around the web.</p>
<h2 id="heading-an-animated-introduction-to-web-development"><strong>An Animated Introduction to Web Development</strong></h2>
<p>To make learning web development more accessible, I have created an interactive tutorial called "An Introduction to Web Development from Back to Front." This 'book' uses annotated code playbacks to demonstrate how to build web applications step by step.</p>
<p>Unlike traditional tutorials that mix partial code snippets with partial explanations, code playbacks make all of the code visible with links to it in the explanation. You'll see exactly how I build up each program.</p>
<p>To view a code playback, click on the comments in the left panel. Each comment updates the code in the editor and highlights the change. Read the explanation, study the code, and use the built-in AI tutor if you have questions. For more information about code playbacks, you can watch a short demo here.</p>
<div class="embed-wrapper">
        <iframe width="560" height="315" src="https://www.youtube.com/embed/uYbHqCNjVDM" style="aspect-ratio: 16 / 9; width: 100%; height: auto;" title="YouTube video player" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen="" loading="lazy"></iframe></div>
<p> </p>
<p>You can access the free 'book' of code playbacks here: <a target="_blank" href="https://playbackpress.com/books/webdevbook">https://playbackpress.com/books/webdevbook</a></p>
<p><strong>Note on Prerequisites</strong>: This is not an introduction to programming. You should have some programming experience as I won't cover basics like if statements, loops, and functions. If you've programmed before in any language, you should be able to follow along.</p>
<p>If you are looking for an introduction to programming, I do have other books that introduce programming in <a target="_blank" href="https://playbackpress.com/books/cppbook">C++</a> and <a target="_blank" href="https://playbackpress.com/books/pybook">Python</a> along with others on the <a target="_blank" href="https://playbackpress.com/books">Playback Press</a> site.</p>
<h2 id="heading-table-of-contents"><strong>Table of Contents</strong></h2>
<h3 id="heading-1-javascript"><strong>1. JavaScript</strong></h3>
<ul>
<li><p><a target="_blank" href="https://playbackpress.com/books/webdevbook/chapter/1/1">Ancient JavaScript</a></p>
</li>
<li><p><a target="_blank" href="https://playbackpress.com/books/webdevbook/chapter/1/2">Modern JavaScript</a></p>
</li>
<li><p><a target="_blank" href="https://playbackpress.com/books/webdevbook/chapter/1/3">JavaScript and Types</a></p>
</li>
<li><p><a target="_blank" href="https://playbackpress.com/books/webdevbook/chapter/1/4">Closures</a></p>
</li>
<li><p><a target="_blank" href="https://playbackpress.com/books/webdevbook/chapter/1/5">Classes in JavaScript</a></p>
</li>
<li><p><a target="_blank" href="https://playbackpress.com/books/webdevbook/chapter/1/6">Promises and async/await</a></p>
</li>
<li><p><a target="_blank" href="https://playbackpress.com/books/webdevbook/chapter/1/7">More with async and await</a></p>
</li>
</ul>
<h3 id="heading-2-the-back-end-node-express-sqlite-and-mongo"><strong>2. The Back End: Node, Express, SQLite, and Mongo</strong></h3>
<ul>
<li><p><a target="_blank" href="https://playbackpress.com/books/webdevbook/chapter/2/1">Node Modules and npm</a></p>
</li>
<li><p><a target="_blank" href="https://playbackpress.com/books/webdevbook/chapter/2/2">Creating Your Own Modules</a></p>
</li>
<li><p><a target="_blank" href="https://playbackpress.com/books/webdevbook/chapter/2/3">The Http Module</a></p>
</li>
<li><p><a target="_blank" href="https://playbackpress.com/books/webdevbook/chapter/2/4">Express Basics</a></p>
</li>
<li><p><a target="_blank" href="https://playbackpress.com/books/webdevbook/chapter/2/5">Returning JSON Data</a></p>
</li>
<li><p><a target="_blank" href="https://playbackpress.com/books/webdevbook/chapter/2/6">Reading and Writing Data to a JSON File</a></p>
</li>
<li><p><a target="_blank" href="https://playbackpress.com/books/webdevbook/chapter/2/7">Express and SQLite</a></p>
</li>
<li><p><a target="_blank" href="https://playbackpress.com/books/webdevbook/chapter/2/8">Express and MongoDB</a></p>
</li>
</ul>
<h3 id="heading-3-the-front-end-html-css-bootstrap-and-express-views"><strong>3. The Front End: HTML, CSS, Bootstrap, and Express Views</strong></h3>
<ul>
<li><p><a target="_blank" href="https://playbackpress.com/books/webdevbook/chapter/3/1">Basic HTML and CSS</a></p>
</li>
<li><p><a target="_blank" href="https://playbackpress.com/books/webdevbook/chapter/3/2">HTML5 and More CSS</a></p>
</li>
<li><p><a target="_blank" href="https://playbackpress.com/books/webdevbook/chapter/3/3">Bootstrap</a></p>
</li>
<li><p><a target="_blank" href="https://playbackpress.com/books/webdevbook/chapter/3/4">Using Views in Express</a></p>
</li>
<li><p><a target="_blank" href="https://playbackpress.com/books/webdevbook/chapter/3/5">Dynamic JavaScript</a></p>
</li>
<li><p><a target="_blank" href="https://playbackpress.com/books/webdevbook/chapter/3/6">Sessions and Password Hashing</a></p>
</li>
<li><p><a target="_blank" href="https://playbackpress.com/books/webdevbook/chapter/3/7">A Very Brief Introduction to the Firebase Cloud Firestore</a></p>
</li>
<li><p><a target="_blank" href="https://playbackpress.com/books/webdevbook/chapter/3/8">Web Components Part 1: LegendHeader</a></p>
</li>
<li><p><a target="_blank" href="https://playbackpress.com/books/webdevbook/chapter/3/9">Web Components Part 2: LegendTable</a></p>
</li>
<li><p><a target="_blank" href="https://playbackpress.com/books/webdevbook/chapter/3/10">Web Components Part 3: NewLegendForm</a></p>
</li>
<li><p><a target="_blank" href="https://playbackpress.com/books/webdevbook/chapter/3/11">Web Components Part 4: AuthBox</a></p>
</li>
</ul>
<h3 id="heading-4-react"><strong>4. React</strong></h3>
<ul>
<li><p><a target="_blank" href="https://playbackpress.com/books/webdevbook/chapter/4/1">Basic React</a></p>
</li>
<li><p><a target="_blank" href="https://playbackpress.com/books/webdevbook/chapter/4/2">Using Vite to Create a React App</a></p>
</li>
<li><p><a target="_blank" href="https://playbackpress.com/books/webdevbook/chapter/4/3">Using React and Express Together</a></p>
</li>
</ul>
<h3 id="heading-5-graphql"><strong>5. GraphQL</strong></h3>
<ul>
<li><p><a target="_blank" href="https://playbackpress.com/books/webdevbook/chapter/5/1">A Traditional API</a></p>
</li>
<li><p><a target="_blank" href="https://playbackpress.com/books/webdevbook/chapter/5/2">GraphQL Query Syntax</a></p>
</li>
<li><p><a target="_blank" href="https://playbackpress.com/books/webdevbook/chapter/5/3">A GraphQL Server Without a Database</a></p>
</li>
<li><p><a target="_blank" href="https://playbackpress.com/books/webdevbook/chapter/5/4">A GraphQL Server that Uses a Database</a></p>
</li>
<li><p><a target="_blank" href="https://playbackpress.com/books/webdevbook/chapter/5/5">Accessing a GraphQL Server Using fetch() and graphql-request</a></p>
</li>
<li><p><a target="_blank" href="https://playbackpress.com/books/webdevbook/chapter/5/6">Using React to Access a GraphQL Server</a></p>
</li>
</ul>
<h2 id="heading-get-started"><strong>Get Started</strong></h2>
<p>I hope this animated introduction helps you grasp the fundamental concepts of web development and empowers you to start building your own web applications. Dive in, experiment, and let me know what you think!</p>
<p>If you have any questions or feedback, I'd love to hear it. Comments and thoughts are welcome anytime: <a target="_blank" href="mailto:mark@playbackpress.com">mark@playbackpress.com</a></p>
<p>If you'd like to support my work and help keep Playback Press free for all, consider donating using <a target="_blank" href="https://github.com/sponsors/markm208">GitHub Sponsors</a>. I use all of the donations for hosting costs. Your support helps me continue creating educational content like this. Thank you!</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ A Brief Introduction to Web Components ]]>
                </title>
                <description>
                    <![CDATA[ In a previous article, I gave a brief introduction to React. This tutorial introduces an alternative approach to building a component-based frontend. It covers the fundamentals of Web Components to build modular, reusable elements for your web applic... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/a-brief-introduction-to-web-components/</link>
                <guid isPermaLink="false">681cce7f505e2f4aa022069b</guid>
                
                    <category>
                        <![CDATA[ Web Components ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Web Development ]]>
                    </category>
                
                    <category>
                        <![CDATA[ React ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Mark Mahoney ]]>
                </dc:creator>
                <pubDate>Thu, 08 May 2025 15:32:15 +0000</pubDate>
                <media:content url="https://cdn.hashnode.com/res/hashnode/image/upload/v1746625674217/902b1ac1-f7c2-42cd-b12f-d9803e58739d.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>In a previous article, I gave a <a target="_blank" href="https://www.freecodecamp.org/news/a-brief-introduction-to-react/">brief introduction to React</a>. This tutorial introduces an alternative approach to building a component-based frontend. It covers the fundamentals of <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/API/Web_components">Web Components</a> to build modular, reusable elements for your web applications.</p>
<p>Web Components are a set of standardized browser APIs that allow you to create custom, reusable HTML elements with encapsulated functionality. They help developers create self-contained components that can be used across different frameworks or even without any framework at all.</p>
<p>This tutorial assumes you have some basic programming experience and are comfortable reading and writing JavaScript. You should understand variables, functions, loops, objects, classes, and how JavaScript works in the browser. You don’t need to know anything about Web Components to get started.</p>
<p>The four lessons presented here are taken from my free book of code playbacks:</p>
<blockquote>
<p><a target="_blank" href="https://playbackpress.com/books/webdevbook/">An Introduction to Web Development from Back to Front</a><br>By Mark Mahoney</p>
</blockquote>
<p>This book is available for free on <a target="_blank" href="https://playbackpress.com/books/">Playback Press</a>. The book is a hands-on guide to modern web development, covering everything from core JavaScript features to building full-stack apps with various tools and technologies.</p>
<p>Each lesson is presented as a <a target="_blank" href="https://markm208.github.io/">code playback</a>, which is an interactive code walkthrough that shows how a program changes over time along with my explanation about what's happening. This format helps you focus on the reasoning behind the code changes.</p>
<p>To view a playback, click on the comments in the left panel. Each comment updates the code in the editor and highlights the change. Read the explanation, study the code, and use the built-in AI tutor if you have questions. Here's a short video that shows how to use a code playback:</p>
<div class="embed-wrapper">
        <iframe width="560" height="315" src="https://www.youtube.com/embed/uYbHqCNjVDM" style="aspect-ratio: 16 / 9; width: 100%; height: auto;" title="YouTube video player" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen="" loading="lazy"></iframe></div>
<p> </p>
<p>After this introduction, you might want to explore the official Web Components resources: <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/API/Web_components">MDN Web Components Guide</a>.</p>
<h2 id="heading-table-of-contents"><strong>Table of Contents</strong></h2>
<ul>
<li><p><a class="post-section-overview" href="#heading-web-components-part-1-your-first-custom-element">Web Components Part 1: Your First Custom Element</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-web-components-part-2-data-communication">Web Components Part 2: Data Communication</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-web-components-part-3-custom-events">Web Components Part 3: Custom Events</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-web-components-part-4-building-a-complete-app">Web Components Part 4: Building a Complete App</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-react-vs-web-components-comparison">React vs Web Components Comparison</a></p>
</li>
</ul>
<h2 id="heading-web-components-part-1-your-first-custom-element"><strong>Web Components Part 1: Your First Custom Element</strong></h2>
<p>This first lesson introduces building user interfaces using Web Components, which let you bundle together HTML, CSS, and JavaScript into a single reusable element.</p>
<p>These elements can be treated just like built-in HTML elements such as <code>h1</code>, <code>div</code>, and <code>img</code>. They're particularly useful when you want to break a page into smaller, self-contained, and reusable parts like headers, tables, or forms, while keeping the code for each organized and isolated.</p>
<p>In this playback, you'll learn:</p>
<ul>
<li><p>How to create a JavaScript class that represents a custom HTML element</p>
</li>
<li><p>How to access the attributes of the web component</p>
</li>
<li><p>How to create and use a web component in HTML</p>
</li>
</ul>
<p>The lesson focuses on creating a <code>LegendHeader</code> component that can be reused throughout a web application. You'll see how custom elements can have attributes just like regular HTML elements (such as <code>src</code> in an <code>img</code> tag), and how these attributes can be changed from JavaScript code, triggering methods in response.</p>
<p><strong>View the playback here:</strong> <a target="_blank" href="https://playbackpress.com/books/webdevbook/chapter/3/8"><strong>Web Components Part 1- LegendHeader</strong></a></p>
<h2 id="heading-web-components-part-2-data-communication"><strong>Web Components Part 2: Data Communication</strong></h2>
<p>Building on the previous lesson, this playback demonstrates how to create multiple components that share data. I'll enhance the <code>LegendHeader</code> component to display the count of legends being tracked, and add a new <code>LegendTable</code> component that displays all the CS legends in a database using an HTML table.</p>
<p>A key concept introduced in this lesson is having a top-level element hold the web app's data and letting it communicate changes to the components that rely on it. This approach makes component management more organized and maintainable.</p>
<p>In this playback, you'll learn:</p>
<ul>
<li><p>How to create and work with multiple components</p>
</li>
<li><p>How to set up and use 'observable attributes' in a web component</p>
</li>
<li><p>How a top-level element can manage data and inform components when data changes</p>
</li>
</ul>
<p><strong>View the playback here:</strong> <a target="_blank" href="https://playbackpress.com/books/webdevbook/chapter/3/9"><strong>Web Components Part 2- LegendTable</strong></a></p>
<h2 id="heading-web-components-part-3-custom-events"><strong>Web Components Part 3: Custom Events</strong></h2>
<p>This lesson expands the application by adding a <code>NewLegendForm</code> component that allows users to add new legends to the database. The playback introduces the concept of custom events that 'bubble' up through the DOM, enabling top-level elements to control requests for data.</p>
<p>You'll learn why it's often better for components not to manage app-wide data themselves. Having a top-level element manage the entire web app's data makes components simpler and more reusable, as they don't need to know about each other or communicate directly.</p>
<p>In this playback, you'll learn:</p>
<ul>
<li><p>How components can generate custom events to request data instead of managing it themselves</p>
</li>
<li><p>How a top-level element can listen for events and handle them</p>
</li>
<li><p>How a top-level element accesses data and passes it to components that need it</p>
</li>
</ul>
<p><strong>View the playback here:</strong> <a target="_blank" href="https://playbackpress.com/books/webdevbook/chapter/3/10"><strong>Web Components Part 3- NewLegendForm</strong></a></p>
<h2 id="heading-web-components-part-4-building-a-complete-app"><strong>Web Components Part 4: Building a Complete App</strong></h2>
<p>In this final lesson, I bring everything together to create a complete application with authentication. I'll add a new <code>AuthBox</code> component and implement a light authentication system so that only registered, logged-in users can add new legends to the database.</p>
<p>The playback uses sessions on the server to control user access and reinforces the importance of centralized data management in component-based architecture.</p>
<p>In this playback, you'll learn:</p>
<ul>
<li><p>How to implement user authentication with a web component</p>
</li>
<li><p>How to integrate all components into a complete, functional application</p>
</li>
<li><p>Best practices for data management in component-based web applications</p>
</li>
</ul>
<p><strong>View the playback here:</strong> <a target="_blank" href="https://playbackpress.com/books/webdevbook/chapter/3/11"><strong>Web Components Part 4- AuthBox</strong></a></p>
<h2 id="heading-react-vs-web-components-comparison"><strong>React vs Web Components Comparison</strong></h2>
<p>Some of the main differences between React and web components can be summarized like this:</p>
<div class="hn-table">
<table>
<thead>
<tr>
<td>Key Property</td><td>React</td><td>Web Components</td></tr>
</thead>
<tbody>
<tr>
<td><strong>Component Definition</strong></td><td>Uses functions (typically) to define components</td><td>Uses JavaScript classes that extend HTMLElement</td></tr>
<tr>
<td><strong>Tooling Requirements</strong></td><td>Requires tools for installation, transpilation, bundling (npm, webpack, babel, and so on)</td><td>Native browser support with no build tools or installation required</td></tr>
<tr>
<td><strong>Template Syntax</strong></td><td>Uses JSX, an HTML-like syntax within JavaScript</td><td>Uses standard HTML in strings or HTML templates</td></tr>
<tr>
<td><strong>DOM Updates</strong></td><td>Uses Virtual DOM to efficiently batch and minimize actual DOM manipulations</td><td>Directly manipulates the DOM, typically less optimized for frequent updates</td></tr>
<tr>
<td><strong>Property Types</strong></td><td>Accepts various data types as props (strings, arrays, objects, functions)</td><td>Only accepts strings as attributes in HTML</td></tr>
<tr>
<td><strong>Rendering Model</strong></td><td>Declarative: describe what the UI should look like, React handles updates</td><td>More imperative: directly manipulate the DOM in response to changes</td></tr>
<tr>
<td><strong>Style Encapsulation</strong></td><td>No built-in style encapsulation (requires CSS-in-JS or CSS Modules)</td><td>Built-in style encapsulation with Shadow DOM</td></tr>
<tr>
<td><strong>Browser Support</strong></td><td>Works in all browsers via polyfills</td><td>Modern browsers only (may require polyfills for older browsers)</td></tr>
<tr>
<td><strong>Ecosystem</strong></td><td>Large ecosystem with many libraries and tools</td><td>Smaller ecosystem, but growing</td></tr>
</tbody>
</table>
</div><h2 id="heading-wrapping-up">Wrapping Up</h2>
<p>These four lessons cover the fundamentals of Web Components, but there's much more to explore. Web Components provide a standards-based way to create reusable elements without the need for external libraries or frameworks, making them particularly valuable for building maintainable and portable code.</p>
<p>If you found this format helpful, explore the rest of the book to see how full web apps are built from scratch using modern tools and approaches.</p>
<p>Web Components represent just one approach to component-based web development. Keep building, keep reading, and try out the other playbacks when you're ready to go further.</p>
<p>If you have feedback about the playbacks I'd love to hear from you. You can reach me here <a target="_blank" href="mailto:mark@playbackpress.com">mark@playbackpress.com</a>.</p>
<p>If you'd like to support my work and help keep Playback Press free for all, consider donating using <a target="_blank" href="https://github.com/sponsors/markm208">GitHub Sponsors</a>. I use all of the donations for hosting costs. Your support helps me continue creating educational content like this. Thank you!</p>
 ]]>
                </content:encoded>
            </item>
        
    </channel>
</rss>
