<?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[ Rufai Mustapha - 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[ Rufai Mustapha - freeCodeCamp.org ]]>
            </title>
            <link>https://www.freecodecamp.org/news/</link>
        </image>
        <generator>Eleventy</generator>
        <lastBuildDate>Sun, 24 May 2026 22:23:58 +0000</lastBuildDate>
        <atom:link href="https://www.freecodecamp.org/news/author/mrufai/rss.xml" rel="self" type="application/rss+xml" />
        <ttl>60</ttl>
        
            <item>
                <title>
                    <![CDATA[ How I Landed 20+ Conference Talks – and How You Can, Too ]]>
                </title>
                <description>
                    <![CDATA[ I’ve never been the loudest person in the room. In fact, the first time I submitted a conference talk, I hovered over the submit button for nearly an hour. I was convinced someone else had more experience, a better résumé, or more impressive GitHub s... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-i-landed-20-conference-talks-and-how-you-can-too/</link>
                <guid isPermaLink="false">685ae4b9a78289a7005020d4</guid>
                
                    <category>
                        <![CDATA[ conference ]]>
                    </category>
                
                    <category>
                        <![CDATA[ talk ]]>
                    </category>
                
                    <category>
                        <![CDATA[ speaking  ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Expert ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Rufai Mustapha ]]>
                </dc:creator>
                <pubDate>Tue, 24 Jun 2025 17:47:37 +0000</pubDate>
                <media:content url="https://cdn.hashnode.com/res/hashnode/image/upload/v1750787232225/b812c4b4-aeea-4398-b74a-8f16f5ef1c13.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>I’ve never been the loudest person in the room.</p>
<p>In fact, the first time I submitted a conference talk, I hovered over the submit button for nearly an hour. I was convinced someone else had more experience, a better résumé, or more impressive GitHub stars. But I submitted anyway. And to my surprise, it was accepted.</p>
<p>Since then, I’ve spoken at more than 20 conferences including API Conf Lagos, Indabax Nigeria, multiple DevFests, and Write the Docs Prague. Some of my talks include:</p>
<ul>
<li><p>Leveraging Open Banking APIs for Innovation at API Conf Lagos</p>
</li>
<li><p>Optimizing Your JavaScript Code for Speed, <a target="_blank" href="https://www.youtube.com/watch?v=Cx62plGRDmQ&amp;t=1210s&amp;ab_channel=Sailscasts">Sailsconf AF 2024</a></p>
</li>
<li><p>Creating Documentation for the African Audience at <a target="_blank" href="https://www.youtube.com/watch?v=w2L3QoTnYbE&amp;t=8s&amp;ab_channel=WritetheDocs">Write the Docs Prague</a></p>
</li>
</ul>
<h3 id="heading-table-of-contents"><strong>Table of Contents</strong></h3>
<ol>
<li><p><a class="post-section-overview" href="#heading-dont-wait-until-you-feel-ready">Don’t Wait Until You Feel Ready</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-where-to-find-calls-for-proposals-cfp">Where to Find Calls for Proposals (CFP)</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-start-with-a-story-not-just-a-topic">Start With a Story, Not Just a Topic</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-how-to-write-strong-proposals-that-get-noticed">How to Write Strong Proposals That Get Noticed</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-tailor-your-proposal-for-each-event">Tailor Your Proposal for Each Event</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-how-to-get-better-at-giving-a-presentation">How to Get Better at Giving a Presentation</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-keep-going-after-you-speak">Keep Going After You Speak</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-expect-rejections-and-keep-submitting">Expect Rejections — and Keep Submitting</a></p>
</li>
</ol>
<p>I have three more talks lined up for the second half of 2025.</p>
<p>Along the way, I have developed a system that works. Whether you’re preparing your first CFP or aiming for bigger events, here is how I approach it and what I’ve learned.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1749632233591/5407cb4a-8437-49b6-af6f-6933779b381c.png" alt="Some of my conference talk acceptance emails" class="image--center mx-auto" width="1217" height="131" loading="lazy"></p>
<h2 id="heading-1-dont-wait-until-you-feel-ready">1. Don’t Wait Until You Feel Ready</h2>
<p>If you want to submit conference talks, you’re going to have to overcome your hesitation and start where you are.</p>
<p>In 2022, I co-submitted a talk to <a target="_blank" href="https://www.writethedocs.org/">Write the Docs</a> Prague with my friend Benny Ifeanyi Iheagwara. The talk was titled “<a target="_blank" href="https://www.youtube.com/watch?v=w2L3QoTnYbE&amp;t=8s&amp;ab_channel=WritetheDocs">Creating Documentation for the African Audience</a>.”</p>
<p>It focused on challenges like language diversity, cultural assumptions, and inconsistent internet access.</p>
<p>We weren’t sure a European audience would care. But we believed the message was important, so we submitted it.</p>
<p>It was accepted.</p>
<p>That session gave us a platform to discuss issues that affect millions of African developers and users. We delivered it virtually, and the feedback showed us how much it resonated.</p>
<p>What I learned was simple: you don’t need to be perfect. You just need to be useful and timely.</p>
<div class="embed-wrapper">
        <iframe width="560" height="315" src="https://www.youtube.com/embed/w2L3QoTnYbE" 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>
<h2 id="heading-2-where-to-find-calls-for-proposals-cfp">2. Where to Find Calls for Proposals (CFP)</h2>
<p>This might seem obvious, but many people don’t know where to start. I find most of my CFPs through platforms like:</p>
<ul>
<li><p><a target="_blank" href="https://sessionize.com">Sessionize</a></p>
</li>
<li><p><a target="_blank" href="https://papercall.io">Papercall.io</a></p>
</li>
<li><p><a target="_blank" href="https://cfp.land">cfp.land</a></p>
</li>
<li><p>LinkedIn posts by organizers</p>
</li>
<li><p>Community Slack or Discord channels</p>
</li>
</ul>
<p>Some CFPs are hidden in newsletters or tucked away on event websites. If there’s a conference you admire, follow it and check in regularly. Keep a calendar of deadlines. The earlier you plan, the better your submissions will be.</p>
<h2 id="heading-3-start-with-a-story-not-just-a-topic">3. Start With a Story, Not Just a Topic</h2>
<p>Craft a compelling narrative that resonates with audiences.</p>
<p>The organizers have requirements to meet. Figure out what they are looking for and build your story around it.</p>
<p>For example, here are some submission guidelines from a conference that outline what the conference organizers are expecting and looking for:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1749841308214/3a2c485d-17f2-4802-814e-1b9b00573e2a.png" alt="Submission guidelines and criteria" class="image--center mx-auto" width="650" height="643" loading="lazy"></p>
<p>When I pitched “Leveraging Open Banking APIs for Innovation” to <a target="_blank" href="https://apiconf.net/">API Conf Lagos</a>, I didn’t open with code. I started with the story of a Nigerian fintech startup struggling with outdated bank systems. That story gave the session weight.</p>
<p>The technical content mattered, but the narrative made it relatable.</p>
<p>Start by studying the Call for Proposals (CFP) carefully. Most CFPs will tell you the themes, skill levels, and audience types the event caters to. Look for phrasing like <em>“we’re looking for real-world stories,”</em> <em>“new voices,”</em> or <em>“hands-on technical depth.”</em> That language is a blueprint for what the organizers want.</p>
<p>Beyond that, look at previous years’ talks. What kind of speakers did they feature? Were the sessions deeply technical, more inspirational, or a mix?</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1749840615705/5c9a8e8e-ca8e-4712-8377-16574f310c2d.png" alt="5c9a8e8e-ca8e-4712-8377-16574f310c2d" class="image--center mx-auto" width="588" height="189" loading="lazy"></p>
<p>Finally, don’t be afraid to reach out to the organizers directly. A quick message like, <em>“Hey, I’m thinking of submitting something about open banking and fintech devs in West Africa – would that be a good fit?”</em> can give you early feedback that steers your proposal in the right direction.</p>
<h2 id="heading-4-how-to-write-strong-proposals-that-get-noticed">4. How to Write Strong Proposals That Get Noticed</h2>
<p>Learn how to make your submission stand out.</p>
<p>A strong proposal does a few things well:</p>
<ul>
<li><p>It starts with a clear, relevant problem</p>
</li>
<li><p>It explains why this topic matters now</p>
</li>
<li><p>It outlines what the talk will cover</p>
</li>
<li><p>It describes what attendees will gain</p>
</li>
</ul>
<p>Here’s an example from my “Banking without Banks” talk that got accepted for a conference just this past May:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1749837811564/cf5023bd-f9f6-4ee1-8aea-3dfecab52732.png" alt="cf5023bd-f9f6-4ee1-8aea-3dfecab52732" class="image--center mx-auto" width="774" height="898" loading="lazy"></p>
<p>When you’re writing these proposalas, keep the <strong>5 W questions</strong> (Who, What, Where, When, Why) plus the story in mind. It’s a clear and effective way to communicate the purpose and value of your talk.</p>
<p><code>1. Who is this talk for?</code></p>
<p>This talk is for developers, tech leads, and product managers building or exploring financial technology solutions. It is especially valuable for startups embedding financial services like payments, lending, or account insights into their applications. It’s also for anyone interested in API-driven innovation in emerging markets, with a particular focus on financial inclusion.</p>
<p><code>2. What is this talk about?</code></p>
<p>This talk explores how open banking APIs are creating new opportunities for innovation in financial services. It features practical strategies, technical demos, and real-world case studies that show how developers can build robust, secure, and user-centric applications – even in regions with infrastructure challenges.</p>
<p><code>3. Where is this knowledge coming from?</code></p>
<p>The talk is grounded in firsthand experience from working with fintech startups in Nigeria and across emerging markets. These insights are based on real projects, real companies, and real challenges – with live examples of how open banking APIs are already being used to solve meaningful problems.</p>
<p><code>4. When is this talk relevant?</code></p>
<p>Right now. In March 2023, the Central Bank of Nigeria (CBN) formally approved open banking regulations, making Nigeria the first African country with a legal framework for it. As more countries adopt similar regulations, the demand for embedded finance is growing. Developers must be prepared to navigate this rapidly evolving space.</p>
<p><code>5. Why Should People Care?</code></p>
<p>Open banking presents an unprecedented opportunity to unlock financial innovation. Also, brings technical, compliance, and design complexity. Developers must understand:</p>
<ul>
<li><p>What the framework enables and limits</p>
</li>
<li><p>How to work with standardized APIs from banks and third parties</p>
</li>
<li><p>How to manage security, compliance, and user experience in sensitive financial applications</p>
</li>
</ul>
<h2 id="heading-5-tailor-your-proposal-for-each-event">5. Tailor Your Proposal for Each Event</h2>
<p>Even if I’m presenting similar material, I never use the same exact abstract twice. DevFest Ajah and Google I/O Extended Ibadan have different audiences and energy.</p>
<p>I always reframe the content to fit the event.</p>
<p>Show that you understand the community and what they care about. Event organizers notice when you’ve taken time to customize your submission.</p>
<h2 id="heading-6-how-to-get-better-at-giving-a-presentation">6. How to Get Better at Giving a Presentation</h2>
<p>Your first talk may be terrible. But it’s ok – with practice and effort, you’ll get better.</p>
<p>Want to improve your delivery? Here's a method that works for me:</p>
<ol>
<li><p>Pick a great talk from a past conference – something close to your topic or style.</p>
</li>
<li><p>Download the transcript and slides, if they’re available.</p>
</li>
<li><p>Record yourself delivering that exact talk as if it were your own.</p>
</li>
<li><p>Compare: Watch your version next to the original. Notice what works and what doesn’t – pacing, tone, energy, clarity.</p>
</li>
<li><p>Share your recordings with friends and ask for feedback.</p>
</li>
</ol>
<p>This kind of deliberate mimicry isn’t copying – you’re not sharing it publicly. It’s training. Just like athletes study match footage, great speakers study other speakers. Over time, you’ll develop your own rhythm, voice, and presence.</p>
<div class="embed-wrapper">
        <iframe width="560" height="315" src="https://www.youtube.com/embed/71qr4PmW8s8" 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>Presenting is a skill. And like any skill, it improves with practice, feedback, and repetition.</p>
<h2 id="heading-7-keep-going-after-you-speak">7. Keep Going After You Speak</h2>
<p>Leverage each talk to grow your influence and connections.</p>
<p>Speaking at a conference is only the beginning. After each session, I usually:</p>
<ul>
<li><p>Share my slides online. You can find mine on <a target="_blank" href="https://speakerdeck.com/rufai">SpeakerDeck</a>.</p>
</li>
<li><p>Post a recap on LinkedIn or Twitter</p>
</li>
<li><p>Thank the organizers publicly</p>
</li>
<li><p>Connect with attendees who reach out</p>
</li>
</ul>
<p>This helps you build momentum and expand your network. After my TensorFlow talk at Indabax, I posted a follow-up summary. That single post led to an invitation to speak at another community event.</p>
<h2 id="heading-8-expect-rejections-and-keep-submitting">8. Expect Rejections — and Keep Submitting</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1749632792903/e2976576-0529-491f-a738-c110fe0ad373.png" alt="e2976576-0529-491f-a738-c110fe0ad373" class="image--center mx-auto" width="433" height="30" loading="lazy"></p>
<p>Not every submission gets accepted. I’ve had proposals sit in “in evaluation” forever and never hear back. Some were outright rejected. My talk on using SVGs to visualize election data was one I believed in deeply. Still, it never made it into any lineup.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1750637435192/4c197c3b-0ac5-481f-adbe-e15717dd5068.png" alt="4c197c3b-0ac5-481f-adbe-e15717dd5068" class="image--center mx-auto" width="142" height="417" loading="lazy"></p>
<p>That’s normal.</p>
<p>Rejection is not a judgment of your worth. It doesn’t mean your idea is weak or your voice is not needed. Conferences have limited slots, and even strong proposals get turned down.</p>
<p>But here’s the truth:</p>
<p>If your talk was rejected, accept yourself anyway. 😊</p>
<ul>
<li><p>You already have the speaker – you</p>
</li>
<li><p>You already have the content – your proposal</p>
</li>
<li><p>You may not have the audience yet – create one</p>
</li>
<li><p>Set your own stage – YouTube, LinkedIn, Twitter, Dev.to</p>
</li>
</ul>
<p>That talk you prepared? Present it.</p>
<p>Publish the content. Record a video. Host a Twitter Space. Turn it into a blog post or a mini-course. Accept your own talk. And then try again.</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>Sharing your ideas on stage can feel intimidating, but it’s also one of the most rewarding ways to grow. You don’t need to be the most experienced speaker to make an impact. You just need to start.</p>
<p>So take that first step. Hit submit. Your story might be exactly what someone in the audience needs to hear.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ What is HTTP? Protocol Overview for Beginners ]]>
                </title>
                <description>
                    <![CDATA[ Without HTTP (Hypertext Transfer Protocol), the World Wide Web as we know it today would not exist. HTTP is the protocol that enables the transfer of data over the internet, allowing users to access websites and other online resources.   There are va... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/what-is-http/</link>
                <guid isPermaLink="false">66c17cd08c83c36e8b078726</guid>
                
                    <category>
                        <![CDATA[ http ]]>
                    </category>
                
                    <category>
                        <![CDATA[ web ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Rufai Mustapha ]]>
                </dc:creator>
                <pubDate>Thu, 06 Apr 2023 16:53:26 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2023/04/http--5-.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Without HTTP (Hypertext Transfer Protocol), the World Wide Web as we know it today would not exist. HTTP is the protocol that enables the transfer of data over the internet, allowing users to access websites and other online resources.  </p>
<p>There are various ways to design web applications, including GraphQL, SOAP, Falcor, gRPC, WebSockets, and Serverless Functions, with REST being the most popular (according to the <a target="_blank" href="https://www.postman.com/state-of-api/2021/">2021 State-of-API</a> survey by Postman). And at the heart of all these architectures is HTTP.</p>
<h2 id="heading-what-to-learn-along-with-http">What to Learn Along with HTTP</h2>
<p>To understand HTTP, it is helpful to have a basic understanding of the following concepts:</p>
<ol>
<li>Networking: Knowledge of how computers communicate with each other over networks is essential for understanding HTTP. This includes concepts such as IP addresses, DNS, and routing.</li>
<li>Web architecture: HTTP is a key part of web architecture, so understanding how web applications and websites are built can help you understand HTTP better. This includes concepts such as HTML, CSS, and JavaScript.</li>
<li>Server-side programming: HTTP is used to communicate between web browsers and servers, so understanding how servers work and how to build server-side applications can help you understand how HTTP works.</li>
<li>Client-side programming: HTTP is also used to communicate between web browsers and client-side applications, so understanding how to build client-side applications using JavaScript can also be helpful.</li>
</ol>
<h3 id="heading-what-to-expect-in-this-article">What to Expect in This Article</h3>
<ul>
<li>How the HTTP protocol works.</li>
<li>How to make network requests with Chrome and Postman.</li>
<li>How to upload data with the HTTP POST method in Postman.</li>
</ul>
<p>By the end of the article, readers should have a basic understanding of HTTP, as well as the tools and resources available for testing and troubleshooting applications.</p>
<h2 id="heading-table-of-contents">Table of Contents</h2>
<ul>
<li><a class="post-section-overview" href="#heading-introduction-to-http">Introduction to HTTP</a></li>
<li><a class="post-section-overview" href="#heading-what-is-the-http-request-response-cycle">What is the HTTP Request-Response Cycle?</a></li>
<li><a class="post-section-overview" href="#heading-how-to-create-http-requests">How to Create HTTP Requests</a></li>
<li><a class="post-section-overview" href="#heading-what-is-an-http-request-url">What is an HTTP Request URL?</a></li>
<li><a class="post-section-overview" href="#heading-what-are-http-request-methods">What Are HTTP Request Methods?</a></li>
<li><a class="post-section-overview" href="#heading-what-are-http-request-headers">What Are HTTP Request Headers?</a></li>
<li><a class="post-section-overview" href="#heading-what-is-an-http-request-body">What is an HTTP Request Body?</a></li>
<li><a class="post-section-overview" href="#heading-what-is-an-http-response">What is an HTTP Response?</a></li>
</ul>
<h2 id="heading-introduction-to-http">Introduction to HTTP</h2>
<p>HTTP (Hypertext Transfer Protocol) is a protocol used for exchanging information over the internet. HTTP is like the delivery system for information on the internet. It makes sure information goes from one place to another, like how ships carry goods across the ocean. It's the foundation of the World Wide Web.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/04/http-client-server.jpg" alt="Image" width="600" height="400" loading="lazy"></p>
<p>HTTP is what makes the internet work. It's a way for web browsers and servers to talk to each other and send things like web pages back and forth. It's important for people who build websites and web applications to know how it works.  </p>
<p>Without HTTP, it would be difficult to imagine how the internet would work. There would be no web pages, no URLs, and no hyperlinks. Instead, users would need to know the exact IP address of the server hosting the information they want to access, and they would need to use a low-level protocol like TCP/IP to transfer data.</p>
<h2 id="heading-what-is-the-http-request-response-cycle">What is the HTTP Request-Response Cycle?</h2>
<p>Communication in HTTP centers around a concept called the Request-Response Cycle. </p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/04/http-client-server-RR.jpg" alt="Image" width="600" height="400" loading="lazy"></p>
<p>The request-response cycle is the process by which a client (such as a web browser or a mobile app) communicates with a server to retrieve resources or perform actions. The cycle involves several steps:</p>
<ol>
<li>The client initiates a request to the server by sending an HTTP request message, which contains information such as the requested resource and any additional parameters.</li>
<li>The server receives the request message and processes it, using its resources to generate a response message.</li>
<li>The server sends the response message back to the client, which typically contains the requested resource (such as a web page) and any additional information or metadata.</li>
<li>The client receives the response message and processes it, usually by rendering the content in a web browser or displaying it in an app.</li>
<li>The client may initiate additional requests to the server, repeating the cycle as needed.</li>
</ol>
<h2 id="heading-how-to-create-http-requests">How to Create HTTP Requests</h2>
<p>To create a valid HTTP request, you need the following:</p>
<ul>
<li>A URL.</li>
<li>The HTTP method.</li>
<li>A list of headers (request headers).</li>
<li>The request body.</li>
</ul>
<p>Here's an example of an HTTP request header, with three lines:</p>
<pre><code class="lang-http"><span class="hljs-keyword">GET</span> <span class="hljs-string">/watch?v=8PoQpnlBXD0</span> HTTP/1.1
<span class="hljs-attribute">Host</span>: www.youtube.com
<span class="hljs-attribute">Cookie</span>: GPS=1; VISITOR_INFO1_LIVE=kOe2UTUyPmw; YSC=Jt6s9YVWMd4
</code></pre>
<ol>
<li>The first line specifies the HTTP method, path, and protocol version. In this case, it is a <code>GET</code> request for the video located at the path <code>/watch?v=8PoQpnlBXD0</code> using the HTTP/1.1 protocol.</li>
<li>The second line specifies the host of the website, which is <a target="_blank" href="http://www.youtube.com/"><code>www.youtube.com</code></a>.</li>
<li>The third line contains a cookie header, which is used for sending and storing small pieces of data on the client side. In this case, the cookie header contains three values: <code>GPS=1, VISITOR_INFO1_LIVE=kOe2UTUyPmw</code>, and <code>YSC=Jt6s9YVWMd4</code>. These values can be used by YouTube to track and personalize the user's experience.</li>
</ol>
<h2 id="heading-what-is-an-http-request-url">What is an HTTP Request URL?</h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/04/url.jpg" alt="Image" width="600" height="400" loading="lazy"></p>
<p>When a web browser attempts to access an image on the internet, it sends a request to the server using a URL. This URL is <em>unique</em> and points to a specific <em>resource</em> on the server.  </p>
<p>A resource can be anything that has a name and can be accessed with a unique identifier like a user, product, article, document, or image. You can think of resources as <em>nouns</em>.</p>
<h2 id="heading-what-are-http-request-methods">What Are HTTP Request Methods?</h2>
<p>The request method tells the server what kind of action the client wants the server to take. The most common methods are:</p>
<table>
<thead>
<tr>
<th>HTTP Methods</th>
<th>Definition</th>
</tr>
</thead>
<tbody>
<tr>
<td>HEAD</td>
<td>Asks the server for status (size, availability)  of a resource.</td>
</tr>
<tr>
<td>GET</td>
<td>Asks the server to retrieve a resource.</td>
</tr>
<tr>
<td>POST</td>
<td>Asks the server to create a new resource.</td>
</tr>
<tr>
<td>PUT</td>
<td>Asks the server to edit/update an existing resource.</td>
</tr>
<tr>
<td>DELETE</td>
<td>Asks the server to delete a resource.</td>
</tr>
</tbody>
</table>

<h2 id="heading-what-are-http-request-headers">What Are HTTP Request Headers?</h2>
<p>HTTP request headers are additional pieces of information that are sent by the client as part of an HTTP request. They have a name/value format. That is:</p>
<pre><code class="lang-txt">Name: Value
</code></pre>
<p>These headers provide context and additional instructions to the server, which can be used to process the request or customize the response.</p>
<div class="embed-wrapper">
        <iframe width="560" height="315" src="https://www.youtube.com/embed/hqQR1O2H_ck" 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>Here's an example of an HTTP request header:</p>
<pre><code class="lang-http"><span class="hljs-keyword">GET</span> <span class="hljs-string">/api/data</span> HTTP/1.1
<span class="hljs-attribute">Host</span>: example.com
<span class="hljs-attribute">User-Agent</span>: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.82 Safari/537.36
<span class="hljs-attribute">Accept</span>: application/json
<span class="hljs-attribute">Accept-Language</span>: en-US,en;q=0.5
<span class="hljs-attribute">Authorization</span>: Token abc123
<span class="hljs-attribute">Cache-Control</span>: no-cache
<span class="hljs-attribute">Connection</span>: keep-alive
<span class="hljs-attribute">Referer</span>: https://www.google.com/
<span class="hljs-attribute">Pragma</span>: no-cache
</code></pre>
<p>In this example, the <code>GET</code> method is used to send a request to the <code>/api/data</code> endpoint on the <code>example.com</code> server using HTTP/1.1 protocol. The request includes ten headers:</p>
<div class="hn-table">
<table>
<thead>
<tr>
<td>Headers</td><td>Definition</td></tr>
</thead>
<tbody>
<tr>
<td>Host</td><td>This header specifies the hostname of the server that the client is trying to connect to.</td></tr>
<tr>
<td>User-Agent</td><td>This header provides information about the client that is making the request (in this case, a version of the Chrome browser).</td></tr>
<tr>
<td>Accept</td><td>This header specifies the MIME types of data that the client is willing to accept in the response.</td></tr>
<tr>
<td>Accept-Language</td><td>This header specifies the preferred language(s) for the response.</td></tr>
<tr>
<td>Authorization</td><td>This header provides an access token (in this case, Token abc123) for authentication purposes.</td></tr>
<tr>
<td>Cache-Control</td><td>This header specifies caching directives for both requests and responses.</td></tr>
<tr>
<td>Connection</td><td>This header specifies options for the connection handling between client and server.</td></tr>
<tr>
<td>Referer</td><td>This header specifies the URL of the page that linked to the current page.</td></tr>
<tr>
<td>Pragma</td><td>This header specifies implementation-specific directives that might apply to any agent along the request-response chain.</td></tr>
<tr>
<td>Content-Type</td><td>This header specifies the MIME type of the data that is being sent in the body of the request, but it is not used in this example because this is a GET request without a request body.</td></tr>
</tbody>
</table>
</div><div class="embed-wrapper">
        <iframe width="560" height="315" src="https://www.youtube.com/embed/Pjok-1Q6MOs" 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>
<h2 id="heading-what-is-an-http-request-body">What is an HTTP Request Body?</h2>
<p>In HTTP, the request body is the data that is sent from the client to the server as part of an HTTP request. The example below shows how to upload an image to the <a target="_blank" href="https://documenter.getpostman.com/view/5578104/RWgqUxxh#5a07d324-155b-487e-80a5-b1b9c1775339">Cat API Server</a>:</p>
<div class="embed-wrapper">
        <iframe width="560" height="315" src="https://www.youtube.com/embed/zAVCD0nLnjg" 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>And here's what the request looks like:</p>
<pre><code class="lang-http"><span class="hljs-keyword">POST</span> <span class="hljs-string">/v1/images/upload</span> HTTP/1.1
<span class="hljs-attribute">Host</span>: api.thecatapi.com
<span class="hljs-attribute">x-api-key</span>: API_KEY
<span class="hljs-attribute">Content-Length</span>: 232
<span class="hljs-attribute">Content-Type</span>: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW

<span class="solidity"><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span>WebKitFormBoundary7MA4YWxkTrZu0gW
Content<span class="hljs-operator">-</span>Disposition: form<span class="hljs-operator">-</span>data; name<span class="hljs-operator">=</span><span class="hljs-string">"file"</span>; filename<span class="hljs-operator">=</span><span class="hljs-string">"/C:/Users/USER/Downloads/cat1.jpg"</span>
Content<span class="hljs-operator">-</span>Type: image<span class="hljs-operator">/</span>jpeg

(data)
<span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span><span class="hljs-operator">-</span>WebKitFormBoundary7MA4YWxkTrZu0gW<span class="hljs-operator">-</span><span class="hljs-operator">-</span></span>
</code></pre>
<p>The request includes these headers:</p>
<ol>
<li><code>Host</code>: This header specifies the hostname of the server that the client is trying to connect to.</li>
<li><code>Content-Type</code>: The request is uploading an image file named <code>cat1.jpg</code> using a type of data called <code>multipart/form-data</code>. The image is in JPEG format and its content is included in the request body.</li>
<li><code>x-api-key</code>: This header provides an API key for authentication purposes.</li>
<li><code>Content-Length</code>: This header specifies the length of the request body in bytes. The value of this field is 232.</li>
</ol>
<p>When the server receives this request, it will parse the request body and use it to create a new entry in the Cat API database. The server will then return a response that includes information about the new entry, such as the image URL and the database ID.</p>
<h2 id="heading-what-is-an-http-response">What is an HTTP Response?</h2>
<p>An HTTP response is the message that a server sends back to a client in response to an HTTP request. It usually consists of a status line, headers, and a message body:</p>
<pre><code class="lang-http">HTTP/1.1 <span class="hljs-number">200</span> OK
<span class="hljs-attribute">Date</span>: Sun, 28 Mar 2023 10:15:00 GMT
<span class="hljs-attribute">Content-Type</span>: application/json
<span class="hljs-attribute">Server</span>: Apache/2.4.39 (Unix) OpenSSL/1.1.1c PHP/7.3.6
<span class="hljs-attribute">Content-Length</span>: 1024

<span class="json">{
    <span class="hljs-attr">"name"</span>: <span class="hljs-string">"John Doe"</span>,
    <span class="hljs-attr">"email"</span>: <span class="hljs-string">"johndoe@example.com"</span>,
    <span class="hljs-attr">"age"</span>: <span class="hljs-number">30</span>,
    <span class="hljs-attr">"address"</span>: {
        <span class="hljs-attr">"street"</span>: <span class="hljs-string">"123 Main St"</span>,
        <span class="hljs-attr">"city"</span>: <span class="hljs-string">"Anytown"</span>,
        <span class="hljs-attr">"state"</span>: <span class="hljs-string">"CA"</span>,
        <span class="hljs-attr">"zip"</span>: <span class="hljs-string">"12345"</span>
    }
}</span>
</code></pre>
<p>The status line contains the HTTP version, a status code indicating the outcome of the request, and a corresponding message.</p>
<p>The headers provide additional information about the response, such as the content type of the message body or the date and time that the response was sent.</p>
<p>The message body contains the actual response data, such as HTML, JSON, or XML content.</p>
<p>Some common HTTP status codes include:</p>
<div class="hn-table">
<table>
<thead>
<tr>
<td>Code</td><td>Meaning</td></tr>
</thead>
<tbody>
<tr>
<td>100</td><td>Continue</td></tr>
<tr>
<td>101</td><td>Switching Protocols</td></tr>
<tr>
<td>200</td><td>OK</td></tr>
<tr>
<td>201</td><td>Created</td></tr>
<tr>
<td>202</td><td>Accepted</td></tr>
<tr>
<td>203</td><td>Non-Authoritative Information</td></tr>
<tr>
<td>404</td><td>Not Found : The requested resource was not found on the server.</td></tr>
<tr>
<td>500</td><td>Internal Server Error : The server encountered an error while processing the request.</td></tr>
<tr>
<td>301</td><td>Moved Permanently: The requested resource has been permanently moved to a new URL.</td></tr>
</tbody>
</table>
</div><p>Here's an example of a JSON response from the Cat API:</p>
<pre><code class="lang-json">{
    <span class="hljs-attr">"id"</span>: <span class="hljs-string">"ErDd1JRRT"</span>,
    <span class="hljs-attr">"url"</span>: <span class="hljs-string">"https://cdn2.thecatapi.com/images/ErDd1JRRT.jpg"</span>,
    <span class="hljs-attr">"width"</span>: <span class="hljs-number">4282</span>,
    <span class="hljs-attr">"height"</span>: <span class="hljs-number">6424</span>,
    <span class="hljs-attr">"original_filename"</span>: <span class="hljs-string">"cat1.jpg"</span>,
    <span class="hljs-attr">"pending"</span>: <span class="hljs-number">0</span>,
    <span class="hljs-attr">"approved"</span>: <span class="hljs-number">1</span>
}
</code></pre>
<p>This is a JSON response from a Cat API request that appears to provide metadata about an image that has been uploaded or retrieved from the API. Here's what each field means:</p>
<ul>
<li><code>id</code>: A unique identifier for the image.</li>
<li><code>url</code>: The URL where the image can be accessed.</li>
<li><code>width</code>: The width of the image in pixels.</li>
<li><code>height</code>: The height of the image in pixels.</li>
<li><code>original_filename</code>: The original name of the file that was uploaded.</li>
<li><code>pending</code>: A flag indicating whether the image is still being processed by the API.</li>
<li><code>approved</code>: A flag indicating whether the image has been approved for public use by the API.</li>
</ul>
<h2 id="heading-conclusion">Conclusion</h2>
<p>HTTP (Hypertext Transfer Protocol) is a protocol used for exchanging information over the internet. It forms the foundation of the World Wide Web and allows communication between web browsers and servers.   </p>
<p>This article is a short introduction to HTTP. If you are interested in learning more, check out these textbook recommendations:</p>
<ul>
<li>"HTTP: The Definitive Guide" by David Gourley and Brian Totty - This book is widely regarded as the authoritative guide to HTTP. It covers the protocol in-depth and provides detailed information on its features and implementation.</li>
<li>"HTTP Pocket Reference" by Clinton Wong - This book provides a concise and portable reference to the HTTP protocol. It covers the essentials of the protocol and is a great resource for developers who need quick access to HTTP information.</li>
<li>"Web Performance Daybook Volume 2: Techniques and Tips for Optimizing Web Site Performance" edited by Stoyan Stefanov - This book is a collection of essays and articles on web performance, including a section on HTTP optimization. It provides practical advice on how to optimize HTTP for faster and more efficient web performance.</li>
</ul>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ React Conditional Rendering –  Explained with Examples From BBC Sports ]]>
                </title>
                <description>
                    <![CDATA[ Conditional rendering is a powerful tool for creating dynamic and engaging user interfaces in React applications.  You can use it to control what content is rendered and when, and it improves user experience, simplifies your code, and helps you creat... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/react-conditional-rendering/</link>
                <guid isPermaLink="false">66c17ccc32867815f7100b66</guid>
                
                    <category>
                        <![CDATA[ React ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Rufai Mustapha ]]>
                </dc:creator>
                <pubDate>Tue, 04 Apr 2023 00:23:29 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2023/04/poster--1-.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Conditional rendering is a powerful tool for creating dynamic and engaging user interfaces in React applications. </p>
<p>You can use it to control what content is rendered and when, and it improves user experience, simplifies your code, and helps you create more flexible and adaptable components.</p>
<h3 id="heading-code-sample">Code Sample</h3>
<ul>
<li>The code in this article can be found <a target="_blank" href="https://github.com/rufai/bbcquiz/tree/master/src">here</a>.</li>
<li>The examples used in this article are inspired by <a target="_blank" href="https://bbc.com/sport/football/61202500">The 100 Premier League Goals Quiz</a> on the BBC. </li>
</ul>
<h3 id="heading-prerequisites">Prerequisites</h3>
<p>Before learning about React component rendering, it is important to have a basic understanding of HTML, CSS, and JavaScript.</p>
<ul>
<li>You should also have a basic understanding of React itself, including its fundamental concepts such as state, props, and lifecycle methods.</li>
<li>Additionally, it is important to understand the concept of virtual DOM and how it works in React, as it is closely related to component rendering.</li>
</ul>
<h3 id="heading-what-you-will-learn-in-this-article">What You Will Learn In This Article</h3>
<ul>
<li>How to return different JSX depending on a condition.</li>
<li>How to conditionally include or exclude a piece of JSX.</li>
<li>Common conditional syntax shortcuts you’ll encounter in React codebase.</li>
</ul>
<h3 id="heading-about-the-demos">About The Demos</h3>
<p>In each demo that you'll see below:</p>
<ul>
<li>I show the demo video of what I'll show you how to create,</li>
<li>then I show the code that achieves what is in the video,</li>
<li>and finally, I explain the code.</li>
</ul>
<h2 id="heading-table-of-contents">Table of Contents</h2>
<ol>
<li><p><a class="post-section-overview" href="#heading-what-is-react-conditional-rendering">What is React conditional rendering</a>?</p>
</li>
<li><p>Define React conditional rendering and how it works</p>
</li>
<li><p>Why conditional rendering is necessary in React applications</p>
</li>
<li><p><a class="post-section-overview" href="#heading-how-to-implement-react-conditional-rendering">How to implement React conditional rendering</a></p>
</li>
<li><p>The ternary operator and the <code>&amp;&amp;</code> operator</p>
</li>
<li><p>Code examples for each method</p>
</li>
<li><p><a class="post-section-overview" href="#heading-how-to-manage-application-state-for-conditional-rendering">How to manage application state for conditional rendering</a></p>
</li>
<li><p>How application state can be used to control when content is rendered.</p>
</li>
<li>How to use the <code>useState</code> hook to manage state for conditional rendering.</li>
<li>Demo 1 - Login Logout</li>
<li><p>Demo 2 - How To Play Button</p>
</li>
<li><p><a class="post-section-overview" href="#heading-advanced-how-to-use-props-to-cause-react-conditional-rendering">Advanced: How to Use Props to Cause React Conditional Rendering</a></p>
</li>
<li><p>Rendering components based on props</p>
</li>
<li>Demo 3 - Component ABC</li>
<li><p>Demo 4 - Start Quiz</p>
</li>
<li><p><a class="post-section-overview" href="#heading-further-reading">Further Reading</a></p>
</li>
</ol>
<h2 id="heading-what-is-react-conditional-rendering">What Is React Conditional Rendering?</h2>
<p>In React, conditional rendering is the process of displaying different content based on certain conditions or states. It allows you to create dynamic user interfaces that can adapt to changes in data and user interactions. </p>
<p>In this process, you can use conditional statements to decide what content should be rendered.</p>
<h3 id="heading-why-conditional-rendering-is-necessary-in-react-applications">Why Conditional Rendering is Necessary in React Applications</h3>
<p>There are several reasons why you might want to use conditional rendering in your React applications:</p>
<ol>
<li>Improved User Experience: Conditional rendering allows you to create dynamic user interfaces that adapt to changes in data and user interactions. By showing and hiding content based on the user's actions or the application state, you can create a more intuitive and engaging user experience.</li>
<li>Improved Performance: By conditionally rendering content, you can avoid rendering unnecessary components and improve the performance of your application. This is particularly important in larger applications where unnecessary rendering can lead to performance issues.</li>
<li>Simplified Code: Conditional rendering can help you simplify your code and make it more readable. By using conditional statements to decide what content should be rendered, you can avoid duplicating code and create more modular components.</li>
<li>Flexibility: Conditional rendering allows you to create more flexible and customizable components. By rendering different content based on the application state, you can create components that can be used in different contexts and adapt to different user interactions.</li>
</ol>
<h2 id="heading-how-to-implement-react-conditional-rendering">How to Implement React Conditional Rendering</h2>
<p>In React, there are different ways to conditionally render content based on the state of a component or other conditions. Two common ways are using the ternary operator and the <code>&amp;&amp;</code> operator.</p>
<pre><code class="lang-js"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">Greeting</span>(<span class="hljs-params">props</span>) </span>{
  <span class="hljs-keyword">const</span> isLoggedIn = props.isLoggedIn;
  <span class="hljs-keyword">return</span> (
    <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span>
      {isLoggedIn ? (
        <span class="hljs-tag">&lt;<span class="hljs-name">h1</span>&gt;</span>Welcome back!<span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span>
      ) : (
        <span class="hljs-tag">&lt;<span class="hljs-name">h1</span>&gt;</span>Please sign up.<span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span>
      )}
    <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span></span>
  );
}
</code></pre>
<p>In the above code, we used the ternary operator <code>isLoggedIn ? ... : ...</code> to conditionally render the message depending on whether the user is logged in or not.    </p>
<pre><code class="lang-js"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">Greeting</span>(<span class="hljs-params">props</span>) </span>{
  <span class="hljs-keyword">const</span> isLoggedIn = props.isLoggedIn;
  <span class="hljs-keyword">return</span> (
    <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span>
      {isLoggedIn &amp;&amp; <span class="hljs-tag">&lt;<span class="hljs-name">h1</span>&gt;</span>Welcome back!<span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span>}
    <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span></span>
  );
}
</code></pre>
<p>In the above code, we used the <code>&amp;&amp;</code> operator to conditionally render the message if <code>isLoggedIn</code> is <code>true</code>.</p>
<p>Both of these methods are effective for conditionally rendering content in React. Which one to use often comes down to personal preference or the specific use case.</p>
<p>The ternary operator may be more useful when there are multiple conditions to check, while the <code>&amp;&amp;</code> operator can be simpler and more concise when there is only one condition.</p>
<h2 id="heading-how-to-manage-application-state-for-conditional-rendering">How to Manage Application State For Conditional Rendering</h2>
<p>In React, the application state can be used to control when and how content is rendered. The application state is a central repository of data that is used by the application to render the user interface. When the application state changes, React re-renders the components that depend on that state.</p>
<p>One way to use the application state to control rendering is to conditionally render components based on the state. For example, if you have a component that should only be displayed when a certain condition is met, you can use the application state to control when the component is rendered.</p>
<p>Another way to use the application state to control rendering is to pass state variables down to child components as props. This allows child components to render content based on the state of the parent component.</p>
<p>Here is an example of how you can use the application state to control rendering in React:</p>
<h3 id="heading-demo-1-login-logout">Demo 1 - Login Logout</h3>
<div class="embed-wrapper">
        <iframe width="560" height="315" src="https://www.youtube.com/embed/y0Dpte_sDKU" 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>
<pre><code class="lang-js"><span class="hljs-keyword">import</span> React, { useState } <span class="hljs-keyword">from</span> <span class="hljs-string">"react"</span>;

<span class="hljs-keyword">const</span> App = <span class="hljs-function">() =&gt;</span> {
  <span class="hljs-keyword">const</span> [isLoggedIn, setIsLoggedIn] = useState(<span class="hljs-literal">false</span>);

  <span class="hljs-keyword">const</span> handleLogin = <span class="hljs-function">() =&gt;</span> {
    setIsLoggedIn(<span class="hljs-literal">true</span>);
  };

  <span class="hljs-keyword">const</span> handleLogout = <span class="hljs-function">() =&gt;</span> {
    setIsLoggedIn(<span class="hljs-literal">false</span>);
  };

  <span class="hljs-keyword">return</span> (
    <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span>
      {isLoggedIn ? (
        <span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span>
          <span class="hljs-tag">&lt;<span class="hljs-name">h1</span>&gt;</span>Welcome Back!<span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span>
          <span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">onClick</span>=<span class="hljs-string">{handleLogout}</span>&gt;</span>Logout<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
        <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
      ) : (
        <span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span>
          <span class="hljs-tag">&lt;<span class="hljs-name">h1</span>&gt;</span>Please Login<span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span>
          <span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">onClick</span>=<span class="hljs-string">{handleLogin}</span>&gt;</span>Login<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
        <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
      )}
    <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span></span>
  );
};

<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> App;
</code></pre>
<p>In this example, we have a component <code>App</code> that renders different content based on the isLoggedIn state. Initially, <code>isLoggedIn</code> is set to false using the useState hook.</p>
<p>When the user clicks on the "Login" button, the <code>handleLogin</code> function is called, which sets the <code>isLoggedIn</code> state to <code>true</code>. Similarly, when the user clicks on the "Logout" button, the <code>handleLogout</code> function is called, which sets the <code>isLoggedIn</code> state to <code>false</code>.</p>
<p>The <code>return</code> statement of the <code>App</code> component uses a ternary operator to render different content based on the value of <code>isLoggedIn</code>. If <code>isLoggedIn</code> is <code>true</code>, it renders a welcome message and a "Logout" button. If <code>isLoggedIn</code> is <code>false</code>, it renders a message asking the user to login along with a "Login" button.</p>
<p>This example demonstrates how you can use conditional rendering to create dynamic user interfaces that can adapt to changes in the application state. </p>
<p>By using the <code>useState</code> hook to manage the <code>isLoggedIn</code> state and conditional statements to decide what content should be rendered, we can create a simple login/logout system that changes the content of the page based on the user's authentication status.</p>
<h3 id="heading-demo-2-build-a-how-to-play-button">Demo 2 - Build a How to Play Button</h3>
<div class="embed-wrapper">
        <iframe width="560" height="315" src="https://www.youtube.com/embed/0dGhpmNAb8A" 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><img src="https://www.freecodecamp.org/news/content/images/2023/04/toplay.JPG" alt="Image" width="600" height="400" loading="lazy">
<em>Folder Structure for How To Play Component</em></p>
<pre><code class="lang-js"><span class="hljs-keyword">import</span> React, { useState } <span class="hljs-keyword">from</span> <span class="hljs-string">"react"</span>;

<span class="hljs-keyword">import</span> <span class="hljs-string">"./style.css"</span>;

<span class="hljs-keyword">const</span> HowToPlay = <span class="hljs-function">() =&gt;</span> {
  <span class="hljs-keyword">const</span> [showRules, setShowRules] = useState(<span class="hljs-literal">false</span>);

  <span class="hljs-keyword">const</span> toggleRules = <span class="hljs-function">() =&gt;</span> {
    setShowRules(!showRules);
  };

  <span class="hljs-keyword">return</span> (
    <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">className</span>=<span class="hljs-string">"flat-black-button"</span> <span class="hljs-attr">onClick</span>=<span class="hljs-string">{toggleRules}</span>&gt;</span>
        How to Play
      <span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
      {showRules ? (
        <span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span>
          <span class="hljs-tag">&lt;<span class="hljs-name">p</span> <span class="hljs-attr">className</span>=<span class="hljs-string">"flat-black-button-content"</span>&gt;</span>
            To get under way, click 'Start'. Once you have started the quiz,
            type an answer into the box and either hit enter or click the submit
            button. If you are right, it will fill in the correct slot in the
            table. Keep entering more answers until you've successfully
            completed the quiz - or the timer runs out. If you do not want to
            play any more, just hit the 'Give up!' button. You can then reveal
            the answers you missed - or have another go.
          <span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
        <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
      ) : null}
    <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span></span>
  );
};

<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> HowToPlay;
</code></pre>
<p>This component displays a "How to Play" button and shows the game instructions when the button is clicked.   </p>
<p>Let's break down the code:</p>
<ul>
<li>We use the <code>useState</code> hook to create a state variable <code>showRules</code> and its setter function <code>setShowRules</code>, initialized to <code>false</code>. This state toggles the display of the game instructions when the button is clicked.</li>
<li>The <code>toggleRules</code> function is called when the "How to Play" button is clicked, which toggles the <code>showRules</code> state using <code>setShowRules</code>.</li>
<li>The <code>return</code> statement displays the "How to Play" button using a button element, which has a class name of "flat-black-button". It also conditionally displays the game instructions if <code>showRules</code> is <code>true</code>.</li>
<li>We display the game instructions using a paragraph element, which has a class name of "flat-black-button-content".</li>
<li>Finally, we export the <code>HowToPlay</code> component as the default export of the module.</li>
</ul>
<p>You can use this component in other parts of the application where the "How to Play" button is needed. When the button is clicked, the game instructions will be displayed or hidden based on the current state of <code>showRules</code>.</p>
<h2 id="heading-advanced-how-to-use-props-to-cause-react-conditional-rendering">Advanced: How to Use Props to Cause React Conditional Rendering</h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/04/Group-8.jpg" alt="Image" width="600" height="400" loading="lazy">
<em>Component A,B, and C are children of App</em></p>
<p>The above diagram shows how a parent component named "App" communicates, indicated with a black line, with its child components, A, B, and C. </p>
<p>Component A needs to talk to components B and C, so it sends a message, indicated by the red line, to App using "props". App then passes that message down to B and C using their own "props".</p>
<h3 id="heading-demo-3-component-abc">Demo 3 - Component ABC</h3>
<div class="embed-wrapper">
        <iframe width="560" height="315" src="https://www.youtube.com/embed/nAv0ksWYfls" 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>
<pre><code class="lang-js"><span class="hljs-keyword">import</span> <span class="hljs-string">"./App.css"</span>;

<span class="hljs-keyword">import</span> React, { useState } <span class="hljs-keyword">from</span> <span class="hljs-string">"react"</span>;

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">App</span>(<span class="hljs-params"></span>) </span>{
  <span class="hljs-keyword">return</span> (
    <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">A</span> /&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span></span>
  );
}

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">A</span>(<span class="hljs-params"></span>) </span>{
  <span class="hljs-keyword">const</span> [showB, setShowB] = useState(<span class="hljs-literal">false</span>);
  <span class="hljs-keyword">const</span> [showC, setShowC] = useState(<span class="hljs-literal">false</span>);
  <span class="hljs-keyword">const</span> [text, setText] = useState(<span class="hljs-string">""</span>);

  <span class="hljs-keyword">const</span> handleInputChange = <span class="hljs-function">(<span class="hljs-params">event</span>) =&gt;</span> {
    setText(event.target.value);
    setShowB(<span class="hljs-literal">true</span>);
    setShowC(<span class="hljs-literal">true</span>);
  };

  <span class="hljs-keyword">return</span> (
    <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">className</span>=<span class="hljs-string">"App"</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"text"</span> <span class="hljs-attr">onChange</span>=<span class="hljs-string">{handleInputChange}</span> /&gt;</span>
      {showB &amp;&amp; <span class="hljs-tag">&lt;<span class="hljs-name">B</span> <span class="hljs-attr">text</span>=<span class="hljs-string">{text}</span> /&gt;</span>}
      {showC &amp;&amp; <span class="hljs-tag">&lt;<span class="hljs-name">C</span> <span class="hljs-attr">text</span>=<span class="hljs-string">{text}</span> /&gt;</span>}
    <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span></span>
  );
}

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">B</span>(<span class="hljs-params">props</span>) </span>{
  <span class="hljs-keyword">const</span> { text } = props;
  <span class="hljs-keyword">return</span> <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">h1</span>&gt;</span>Component B - {text.toUpperCase()}<span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span></span>;
}

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">C</span>(<span class="hljs-params">props</span>) </span>{
  <span class="hljs-keyword">const</span> { text } = props;
  <span class="hljs-keyword">return</span> <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">h1</span>&gt;</span>Component C - {text.toLowerCase()}<span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span></span>;
}

<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> App;
</code></pre>
<p>In this example, the <code>A</code> component has three state variables: <code>showB</code>, <code>showC</code>, and <code>text</code>. When the input field value changes, the <code>handleInputChange</code> function is called and based on the input field value, the <code>text</code> state variable is updated and <code>showB</code> and <code>showC</code> state variables are set to <code>true</code>.</p>
<p>The <code>B</code> and <code>C</code> components are functional components that receive the <code>text</code> prop as input and render the text in different ways – <code>B</code> component renders the text in uppercase, while <code>C</code> component renders the text in lowercase.</p>
<p>The <code>&amp;&amp;</code> operator is used to conditionally render the components based on their respective state variables.  </p>
<p>Let see how this concepts is used in a product app.</p>
<h3 id="heading-demo-4-start-quiz">Demo 4 - Start Quiz</h3>
<p> Demo 4 is another version of the last example.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/04/Group-9.jpg" alt="Image" width="600" height="400" loading="lazy">
<em>Clicking the StartQuiz's button will trigger the Timer and populate the PlayerNameTable</em></p>
<p>When the user clicks the "StartQuiz" button, a Timer begins counting down, and a signal is sent to populate the PlayerNameTable.</p>
<div class="embed-wrapper">
        <iframe width="560" height="315" src="https://www.youtube.com/embed/QM9b69PfVjE" 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>
<h3 id="heading-timer-component">Timer Component</h3>
<pre><code class="lang-js"><span class="hljs-keyword">import</span> React, { useEffect } <span class="hljs-keyword">from</span> <span class="hljs-string">"react"</span>;
<span class="hljs-keyword">import</span> { useTimer } <span class="hljs-keyword">from</span> <span class="hljs-string">"react-timer-hook"</span>;

<span class="hljs-keyword">const</span> Timer = <span class="hljs-function">(<span class="hljs-params">{ expiryTimestamp, shouldTimerStart }</span>) =&gt;</span> {
  <span class="hljs-keyword">const</span> { seconds, minutes, start, reset } = useTimer({
    expiryTimestamp,
    <span class="hljs-attr">autoStart</span>: <span class="hljs-literal">false</span>,
  });
  useEffect(<span class="hljs-function">() =&gt;</span> {
    <span class="hljs-keyword">if</span> (shouldTimerStart) {
      start();
    }
  }, [shouldTimerStart]);

  <span class="hljs-keyword">return</span> (
    <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span>
      {minutes}:{seconds <span class="hljs-tag">&lt; <span class="hljs-attr">10</span> ? `<span class="hljs-attr">0</span>${<span class="hljs-attr">seconds</span>}` <span class="hljs-attr">:</span> <span class="hljs-attr">seconds</span>}
    &lt;/<span class="hljs-attr">div</span>&gt;</span></span>
  );
};

<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> Timer;
</code></pre>
<p>This is a React component that uses the <code>useTimer</code> hook from the <code>react-timer-hook</code> library to create a countdown timer. Let's break it down:</p>
<ol>
<li>Import the necessary dependencies: <code>React</code> and <code>useTimer</code> from the <code>react-timer-hook</code> library.</li>
<li>Define the <code>Timer</code> component, which takes two props: <code>expiryTimestamp</code> and <code>shouldTimerStart</code>.</li>
<li>Destructure the <code>seconds</code>, <code>minutes</code>, <code>start</code>, and <code>reset</code> properties from the <code>useTimer</code> hook. The <code>useTimer</code> hook takes an options object with an <code>expiryTimestamp</code> property that specifies the time at which the timer should expire, and an <code>autoStart</code> property that specifies whether the timer should start automatically when the component mounts.</li>
<li>Use the <code>useEffect</code> hook to start the timer when <code>shouldTimerStart</code> changes. The <code>useEffect</code> hook takes a callback function that runs after every render, and an array of dependencies that determines when the callback should run. In this case, the callback runs whenever <code>shouldTimerStart</code> changes.</li>
<li>Render the timer using the <code>minutes</code> and <code>seconds</code> properties, with a conditional statement that adds a leading zero to the seconds when they are less than 1o.</li>
<li>Export the Timer component as the default export of the module.</li>
</ol>
<h3 id="heading-playernametable">PlayerNameTable</h3>
<pre><code class="lang-js"><span class="hljs-keyword">import</span> React, { useState, useEffect } <span class="hljs-keyword">from</span> <span class="hljs-string">"react"</span>;

<span class="hljs-keyword">import</span> <span class="hljs-string">"./style.css"</span>;

<span class="hljs-keyword">const</span> PlayerNameTable = <span class="hljs-function">(<span class="hljs-params">{ trigger }</span>) =&gt;</span> {
  <span class="hljs-keyword">const</span> data = <span class="hljs-built_in">require</span>(<span class="hljs-string">"../data/League100.json"</span>);
  <span class="hljs-built_in">console</span>.log(data);

  <span class="hljs-keyword">const</span> [shouldShowData, updateShouldShowData] = useState(<span class="hljs-literal">false</span>);

  useEffect(<span class="hljs-function">() =&gt;</span> {
    <span class="hljs-keyword">if</span> (trigger) {
      updateShouldShowData(trigger);
    }
  }, [trigger]);

  <span class="hljs-keyword">return</span> (
    <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">table</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">thead</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">tr</span>&gt;</span>
          <span class="hljs-tag">&lt;<span class="hljs-name">th</span>&gt;</span>Rank<span class="hljs-tag">&lt;/<span class="hljs-name">th</span>&gt;</span>
          <span class="hljs-tag">&lt;<span class="hljs-name">th</span>&gt;</span>Goals<span class="hljs-tag">&lt;/<span class="hljs-name">th</span>&gt;</span>
          <span class="hljs-tag">&lt;<span class="hljs-name">th</span>&gt;</span>Clubs<span class="hljs-tag">&lt;/<span class="hljs-name">th</span>&gt;</span>
          <span class="hljs-tag">&lt;<span class="hljs-name">th</span>&gt;</span>Player<span class="hljs-tag">&lt;/<span class="hljs-name">th</span>&gt;</span>
        <span class="hljs-tag">&lt;/<span class="hljs-name">tr</span>&gt;</span>
      <span class="hljs-tag">&lt;/<span class="hljs-name">thead</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">tbody</span>&gt;</span>
        {shouldShowData ? (
          data.sort().map((player, index) =&gt; (
            <span class="hljs-tag">&lt;<span class="hljs-name">tr</span> <span class="hljs-attr">key</span>=<span class="hljs-string">{index}</span>&gt;</span>
              <span class="hljs-tag">&lt;<span class="hljs-name">td</span>&gt;</span>{index + 1}<span class="hljs-tag">&lt;/<span class="hljs-name">td</span>&gt;</span>
              <span class="hljs-tag">&lt;<span class="hljs-name">td</span>&gt;</span>{player.goals}<span class="hljs-tag">&lt;/<span class="hljs-name">td</span>&gt;</span>
              <span class="hljs-tag">&lt;<span class="hljs-name">td</span>&gt;</span>{player.clubs}<span class="hljs-tag">&lt;/<span class="hljs-name">td</span>&gt;</span>
              {/* <span class="hljs-tag">&lt;<span class="hljs-name">td</span>&gt;</span>{player.name || player.player}<span class="hljs-tag">&lt;/<span class="hljs-name">td</span>&gt;</span> */}
            <span class="hljs-tag">&lt;/<span class="hljs-name">tr</span>&gt;</span>
          ))
        ) : (
          <span class="hljs-tag">&lt;<span class="hljs-name">tr</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">td</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">td</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">td</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">td</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">td</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">td</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">td</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">td</span>&gt;</span>
          <span class="hljs-tag">&lt;/<span class="hljs-name">tr</span>&gt;</span>
        )}
      <span class="hljs-tag">&lt;/<span class="hljs-name">tbody</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">table</span>&gt;</span></span>
  );
};

<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> PlayerNameTable;
</code></pre>
<p>This is a React component that renders a Premier League table. Let's break it down:</p>
<ol>
<li>Import the necessary dependencies: <code>React</code>, <code>useState</code>, and <code>useEffect</code>.</li>
<li>Import the <code>style.css</code> file, which presumably contains CSS styles for the table.</li>
<li>Define the <code>PlayerNameTable</code> component, which takes one prop: <code>trigger</code>.</li>
<li>Load the data for the Premier League table from a JSON file using <code>require</code>. The JSON data contains information about players, including their rank, number of goals, club, and name.</li>
<li>Use the <code>useState</code> hook to define a state variable <code>shouldShowData</code>, which determines whether the data should be shown in the table or not. By default, it is set to <code>false</code>.</li>
<li>Use the <code>useEffect</code> hook to update the <code>shouldShowData</code> state variable whenever the <code>trigger</code> prop changes. This allows the parent component to control when the data is shown in the table.</li>
<li>Render the table using the <code>table</code>, <code>thead</code>, <code>tbody</code>, and <code>tr</code> HTML elements, along with the <code>th</code> and <code>td</code> elements for the table headers and data cells.</li>
<li>Use a conditional statement to determine whether to show the data or an empty table. If <code>shouldShowData</code> is <code>true</code>, sort the <code>data</code> array by rank and map over it to render each player's data as a table row. If <code>shouldShowData</code> is <code>false</code>, render an empty table row.</li>
<li>Export the <code>PlayerNameTable</code> component as the default export of the module.</li>
</ol>
<h3 id="heading-startquiz">StartQuiz</h3>
<pre><code class="lang-js"><span class="hljs-keyword">import</span> React, { useState } <span class="hljs-keyword">from</span> <span class="hljs-string">"react"</span>;
<span class="hljs-keyword">import</span> <span class="hljs-string">"./style.css"</span>;

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">Quiz</span>(<span class="hljs-params">{ trigger }</span>) </span>{
  <span class="hljs-keyword">const</span> [isStarted, setIsStarted] = useState(<span class="hljs-literal">false</span>);
  <span class="hljs-keyword">const</span> [answer, setAnswer] = useState(<span class="hljs-string">""</span>);

  <span class="hljs-keyword">const</span> handleStartClick = <span class="hljs-function">() =&gt;</span> {
    setIsStarted(<span class="hljs-literal">true</span>);
    trigger(<span class="hljs-literal">true</span>);
  };

  <span class="hljs-keyword">const</span> handleResetClick = <span class="hljs-function">() =&gt;</span> {
    setIsStarted(<span class="hljs-literal">false</span>);
    trigger(<span class="hljs-literal">false</span>);
  };

  <span class="hljs-keyword">const</span> handleSubmitClick = <span class="hljs-function">() =&gt;</span> {
    <span class="hljs-comment">// Do something with the answer, e.g. validate it</span>
  };

  <span class="hljs-keyword">return</span> (
    <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span>
      {isStarted ? (
        <span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span>
          <span class="hljs-tag">&lt;<span class="hljs-name">input</span>
            <span class="hljs-attr">type</span>=<span class="hljs-string">"text"</span>
            <span class="hljs-attr">value</span>=<span class="hljs-string">{answer}</span>
            <span class="hljs-attr">onChange</span>=<span class="hljs-string">{(e)</span> =&gt;</span> setAnswer(e.target.value)}
          /&gt;
          <span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">className</span>=<span class="hljs-string">"submit-button"</span> <span class="hljs-attr">onClick</span>=<span class="hljs-string">{handleSubmitClick}</span>&gt;</span>
            Submit
          <span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
          <span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">className</span>=<span class="hljs-string">"reset-button"</span> <span class="hljs-attr">onClick</span>=<span class="hljs-string">{handleResetClick}</span>&gt;</span>
            Reset
          <span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
        <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
      ) : (
        <span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">className</span>=<span class="hljs-string">"start-button"</span> <span class="hljs-attr">onClick</span>=<span class="hljs-string">{handleStartClick}</span>&gt;</span>
          Start Quiz
        <span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
      )}
    <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span></span>
  );
}

<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> Quiz;
</code></pre>
<p>This is a React component that represents a simple quiz. Here's what it does:</p>
<ol>
<li>Import the necessary dependencies: <code>React</code> and <code>useState</code>.</li>
<li>Import the <code>style.css</code> file, which presumably contains CSS styles for the quiz.</li>
<li>Define the <code>Quiz</code> component, which takes one prop: <code>trigger</code>.</li>
<li>Use the <code>useState</code> hook to define two state variables: <code>isStarted</code>, which determines whether the quiz has been started or not, and <code>answer</code>, which stores the user's answer to the quiz question.</li>
<li>Define three functions to handle user events: <code>handleStartClick</code>, <code>handleResetClick</code>, and <code>handleSubmitClick</code>.</li>
<li>In the <code>handleStartClick</code> function, set the <code>isStarted</code> state variable to <code>true</code> and trigger the <code>trigger</code> prop to inform the parent component that the quiz has started.</li>
<li>In the <code>handleResetClick</code> function, set the <code>isStarted</code> state variable to <code>false</code> and trigger the <code>trigger</code> prop to inform the parent component that the quiz has been reset.</li>
<li>In the <code>handleSubmitClick</code> function, do something with the user's answer, such as validating it against the correct answer.</li>
<li>In the <code>return</code> statement, render the quiz based on whether it has been started or not. If <code>isStarted</code> is <code>true</code>, render an input field for the user's answer, along with a "Submit" button and a "Reset" button. If <code>isStarted</code> is <code>false</code>, render a "Start Quiz" button.</li>
<li>Export the <code>Quiz</code> component as the default export of the module.</li>
</ol>
<h3 id="heading-parent-app-component">Parent App Component</h3>
<pre><code class="lang-js"><span class="hljs-keyword">import</span> <span class="hljs-string">"./App.css"</span>;

<span class="hljs-keyword">import</span> HowToPlay <span class="hljs-keyword">from</span> <span class="hljs-string">"./HowToPlay"</span>;
<span class="hljs-keyword">import</span> ScoreCounter <span class="hljs-keyword">from</span> <span class="hljs-string">"./ScoreCounter"</span>;
<span class="hljs-keyword">import</span> Timer <span class="hljs-keyword">from</span> <span class="hljs-string">"./Timer"</span>;
<span class="hljs-keyword">import</span> Table <span class="hljs-keyword">from</span> <span class="hljs-string">"./Rank"</span>;
<span class="hljs-keyword">import</span> PremierLeagueTable <span class="hljs-keyword">from</span> <span class="hljs-string">"./Rank/index2"</span>;
<span class="hljs-keyword">import</span> Quiz <span class="hljs-keyword">from</span> <span class="hljs-string">"./Quiz"</span>;

<span class="hljs-keyword">import</span> { useState, useEffect } <span class="hljs-keyword">from</span> <span class="hljs-string">"react"</span>;

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">App</span>(<span class="hljs-params"></span>) </span>{
  <span class="hljs-keyword">const</span> [hasQuizStarted, updateHasQuizStarted] = useState(<span class="hljs-literal">null</span>);

  <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">startTimer</span>(<span class="hljs-params">status</span>) </span>{
    updateHasQuizStarted(status);
  }

  <span class="hljs-keyword">const</span> time = <span class="hljs-keyword">new</span> <span class="hljs-built_in">Date</span>();
  time.setSeconds(time.getSeconds() + <span class="hljs-number">300</span>);
  <span class="hljs-keyword">return</span> (
    <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">className</span>=<span class="hljs-string">"App"</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">h1</span>&gt;</span>Can you name the players with 100 Premier League goals?<span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">HowToPlay</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">HowToPlay</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">className</span>=<span class="hljs-string">"place_edges"</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">ScoreCounter</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">ScoreCounter</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">Timer</span> <span class="hljs-attr">expiryTimestamp</span>=<span class="hljs-string">{time}</span> <span class="hljs-attr">shouldTimerStart</span>=<span class="hljs-string">{hasQuizStarted}</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">Timer</span>&gt;</span>
      <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">Quiz</span> <span class="hljs-attr">trigger</span>=<span class="hljs-string">{startTimer}</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">Quiz</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">PremierLeagueTable</span> <span class="hljs-attr">trigger</span>=<span class="hljs-string">{hasQuizStarted}</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">PremierLeagueTable</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span></span>
  );
}

<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> App;
</code></pre>
<p>React application that renders a quiz for Premier League players with 100 goals. The application includes components for displaying instructions, keeping track of the score and time, and rendering the quiz and the Premier League player table.</p>
<p>The startTimer function is passed as a prop to the Quiz component, which is called when the user starts the quiz. This updates the state of the hasQuizStarted variable, which is then passed to the Timer and PremierLeagueTable components to start the timer and render the player table.</p>
<h2 id="heading-further-reading">Further Reading</h2>
<p>Conditional rendering is an important concept in React that allows you to render different content based on a certain condition. Here are some resources that can help you further understand conditional rendering in React:</p>
<ol>
<li>Official React documentation on conditional rendering: <a target="_blank" href="https://react.dev/learn/conditional-rendering">https://react.dev/learn/conditional-rendering</a></li>
<li>"Conditional Rendering in React" by Robin Wieruch: <a target="_blank" href="https://www.robinwieruch.de/conditional-rendering-react">https://www.robinwieruch.de/conditional-rendering-react</a></li>
</ol>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Make a Clickable SVG Map With HTML and CSS ]]>
                </title>
                <description>
                    <![CDATA[ SVG, or Scalable Vector Graphics, is a versatile image format that you can use in a wide range of applications, from web design to print media and data visualization.  The scalability, small file size, and accessibility of SVG images make this format... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-make-clickable-svg-map-html-css/</link>
                <guid isPermaLink="false">66c17cc831d965ba683261bb</guid>
                
                    <category>
                        <![CDATA[ CSS ]]>
                    </category>
                
                    <category>
                        <![CDATA[ HTML ]]>
                    </category>
                
                    <category>
                        <![CDATA[ SVG ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Rufai Mustapha ]]>
                </dc:creator>
                <pubDate>Thu, 09 Mar 2023 19:43:56 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2023/03/amy-youtube--1-.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>SVG, or Scalable Vector Graphics, is a versatile image format that you can use in a wide range of applications, from web design to print media and data visualization. </p>
<p>The scalability, small file size, and accessibility of SVG images make this format a popular choice among designers and developers. </p>
<p>Maps are a powerful tool for data visualization, providing a visual representation of data that can help viewers understand patterns and relationships that may not be evident in other types of visualizations.  </p>
<p>In this article, you will learn how to make interactive maps using HTML and CSS. These maps will remain light-weight because we'll be using SVGs.</p>
<p>If you have basic knowledge of HTML and CSS you'll be able to understand this tutorial.</p>
<h3 id="heading-heres-what-well-cover">Here's what we'll cover:</h3>
<p>I. Introduction</p>
<ul>
<li>What Is an SVG Map?</li>
<li>What Are the Benefits of an SVG Map?</li>
</ul>
<p>II. How to Set Up the HTML File</p>
<ul>
<li>How to Create the Basic HTML Structure</li>
<li>How to Import the SVG Map File</li>
<li>How to Set Up the <code>div</code> Container for the Map</li>
</ul>
<p>III. How to Add Interactivity with CSS</p>
<ul>
<li>How to Style the SVG Map</li>
<li>How to Add Hover Effects</li>
<li>How to Add Click Effects</li>
</ul>
<p>IV. How to Add Functionality</p>
<ul>
<li>How to Link Areas of the Map to External Webpages</li>
</ul>
<p>V. Conclusion</p>
<ul>
<li>Recap of Steps to Make a Clickable SVG Map</li>
<li>Final Thoughts and Suggestions for Further Customization</li>
</ul>
<h2 id="heading-what-is-an-svg-map">What Is an SVG Map?</h2>
<p>SVG maps are vector-based, meaning that the map elements are defined by mathematical equations rather than pixels. This allows you to scale them up or down without losing quality.</p>
<h2 id="heading-what-are-the-benefits-of-an-svg-map">What Are the Benefits of an SVG Map?</h2>
<p>Some benefits of using SVG maps include:</p>
<ol>
<li>Scalability: SVG maps can be scaled up or down without losing quality, which makes them ideal for use in responsive web design or for printing at different sizes.</li>
<li>Customizability: SVG maps can be easily customized to suit specific needs, such as changing colors, adding labels, or modifying the size and shape of map elements.</li>
<li>Interactivity: SVG maps can be made interactive through the use of JavaScript and CSS, allowing viewers to hover over or click on specific elements to see more detailed information.</li>
<li>Accessibility: SVG maps can be read by assistive technologies such as screen readers, making them more accessible to people with disabilities.</li>
<li>Cross-platform compatibility: SVG maps can be displayed on a wide range of devices and browsers, making them a versatile choice for web-based applications.</li>
</ol>
<h3 id="heading-example-of-svg-maps-in-the-wild">Example Of SVG Maps In the Wild</h3>
<p>Stears and The BBC used SVG Maps to visualize election data. Users can click on a region to see the distribution of ballots cast. See <a target="_blank" href="https://www.stears.co/elections/2023/president/">here</a> for more info.</p>
<div class="embed-wrapper">
        <iframe width="560" height="315" src="https://www.youtube.com/embed/RCUkQhGGxxM" 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>
<h3 id="heading-what-are-we-building">What  Are We Building?</h3>
<p>In this tutorial, we are building <code>Tour Afrique</code>, an interactive map of Africa.</p>
<p>It has 2 features:</p>
<ul>
<li>Users can hover to see the name of a country.</li>
<li>Users can click on a country to see more information on Wikipedia. </li>
</ul>
<h2 id="heading-how-to-build-our-interactive-map-of-africa">How to Build Our Interactive Map of Africa</h2>
<h3 id="heading-1-get-the-svg-map-of-africa">1. Get the SVG Map of Africa</h3>
<p>You can create an SVG map using vector graphics software such as <a target="_blank" href="https://www.youtube.com/watch?v=GsojLuJpe_0">Adobe Illustrator</a> or Inkscape, or with code using libraries such as D3.js or Leaflet.    </p>
<p>You can also download SVG maps from Wikipedia using a creative-commons license. Click <a target="_blank" href="https://upload.wikimedia.org/wikipedia/commons/2/24/West-Africa.svg">here</a> for the map we'll use in this tutorial.  </p>
<h3 id="heading-2-create-the-basic-html-structure">2. Create the basic HTML structure</h3>
<p>We need a basic HTML structure, which will look like this:</p>
<pre><code class="lang-html"><span class="hljs-meta">&lt;!DOCTYPE <span class="hljs-meta-keyword">html</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">html</span> <span class="hljs-attr">lang</span>=<span class="hljs-string">"en"</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">head</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">meta</span> <span class="hljs-attr">charset</span>=<span class="hljs-string">"UTF-8"</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">meta</span> <span class="hljs-attr">http-equiv</span>=<span class="hljs-string">"X-UA-Compatible"</span> <span class="hljs-attr">content</span>=<span class="hljs-string">"IE=edge"</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">meta</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"viewport"</span> <span class="hljs-attr">content</span>=<span class="hljs-string">"width=device-width, initial-scale=1.0"</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">title</span>&gt;</span>Document<span class="hljs-tag">&lt;/<span class="hljs-name">title</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">head</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">body</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">span</span>&gt;</span> Tour Afrique <span class="hljs-tag">&lt;/<span class="hljs-name">span</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">body</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">html</span>&gt;</span>
</code></pre>
<p>This HTML will give us the following result so far:</p>
<p>&lt;!DOCTYPE html&gt;</p>


    
    
    
    Document


    <span> Tour Afrique </span>



<h3 id="heading-3-import-the-svg-map-file">3. Import the SVG map file</h3>
<p>To import an SVG map file to an HTML document, you can use the <code>&lt;object&gt;</code>, <code>&lt;img&gt;</code>, or <code>&lt;svg&gt;</code> tag.  </p>
<p>We'll do so using the <code>&lt;svg&gt;</code> tag:</p>
<p>First, open your HTML file in a text editor. Then add the downloaded SVG map to the section where you want it to appear:</p>
<pre><code class="lang-html"><span class="hljs-meta">&lt;!DOCTYPE <span class="hljs-meta-keyword">html</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">html</span> <span class="hljs-attr">lang</span>=<span class="hljs-string">"en"</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">head</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">meta</span> <span class="hljs-attr">charset</span>=<span class="hljs-string">"UTF-8"</span> /&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">meta</span> <span class="hljs-attr">http-equiv</span>=<span class="hljs-string">"X-UA-Compatible"</span> <span class="hljs-attr">content</span>=<span class="hljs-string">"IE=edge"</span> /&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">meta</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"viewport"</span> <span class="hljs-attr">content</span>=<span class="hljs-string">"width=device-width, initial-scale=1.0"</span> /&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">title</span>&gt;</span>Document<span class="hljs-tag">&lt;/<span class="hljs-name">title</span>&gt;</span>
  <span class="hljs-tag">&lt;/<span class="hljs-name">head</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">body</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">section</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">svg</span>
        <span class="hljs-attr">xmlns:dc</span>=<span class="hljs-string">"http://purl.org/dc/elements/1.1/"</span>
        <span class="hljs-attr">xmlns:cc</span>=<span class="hljs-string">"http://creativecommons.org/ns#"</span>
        <span class="hljs-attr">xmlns:rdf</span>=<span class="hljs-string">"http://www.w3.org/1999/02/22-rdf-syntax-ns#"</span>
      &gt;</span>
        ... all the country paths are here ...
      <span class="hljs-tag">&lt;/<span class="hljs-name">svg</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">section</span>&gt;</span>
  <span class="hljs-tag">&lt;/<span class="hljs-name">body</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">html</span>&gt;</span>
</code></pre>
<p>&lt;!DOCTYPE html&gt;</p>

  
    
    
    
    Document
  
  
    <section>
      
        
          image/svg+xml
        
        
        
        
          
            
            
            
            

            

            
              1000 km
            

            
              1000 km
            

            

            

            

            

            
              1000 mi
            

            
              1000 mi
            

            

            

            

            

            
              0
            

            
              0
            

            

            

            

            

            
              0
            

            
              0
            

            

            
          
          
          
            
            
            
          
          
          
          
            
            
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
        
      
    </section>
  



<h3 id="heading-4-nest-each-path-in-an-anchor-tag">4. Nest each path in an anchor tag</h3>
<p>There are several <code>path</code> tags in our SVG. Each of them describes a country. We want to hover on each country to see the name of the country. And on clicking that country, we should be taken to its Wikipedia page.</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">a</span> <span class="hljs-attr">xlink:title</span>=<span class="hljs-string">"Mali"</span> <span class="hljs-attr">xlink:href</span>=<span class="hljs-string">"https://en.wikipedia.org/wiki/Mali"</span> <span class="hljs-attr">target</span>=<span class="hljs-string">"_blank"</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"malic"</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">path</span>
          <span class="hljs-attr">inkscape:connector-curvature</span>=<span class="hljs-string">"0"</span>
          <span class="hljs-attr">d</span>=<span class="hljs-string">"..."</span>
          <span class="hljs-attr">id</span>=<span class="hljs-string">"Mali"</span>
          /&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">a</span>&gt;</span>
</code></pre>
<p>In the code above, we've nested the <code>path</code> into an <code>anchor</code> tag. The <code>anchor</code> tag has the attribute <code>title</code> which shows the country name on-hover. Also, it has <code>href</code> which allows us to visit the Wikipedia page on clicking that link. <code>target="_blank"</code> makes sure that the link opens in a new tab.  </p>
<p>You may notice the <code>xlink</code> prefix on the attributes. This supports earlier browser versions. You can use the deprecated <code>xlink:href</code> attribute as a fallback in addition to the href attribute. See more info <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/xlink:href">here</a>.</p>
<h3 id="heading-5-how-to-style-the-svg-map">5. How to style the SVG map</h3>
<p>We can style our SVG map using CSS. </p>
<p>The common attributes in SVG path styles are <code>fill</code>, <code>stroke</code>, and <code>stroke-width</code>. For example, if you draw a rectangular path, then you can use <code>fill</code> to make it blue.</p>
<pre><code class="lang-cs">&lt;svg&gt;
  &lt;style&gt;
    rect {
      fill: blue;
    }
  &lt;/style&gt;
  &lt;rect x=<span class="hljs-string">"10"</span> y=<span class="hljs-string">"10"</span> width=<span class="hljs-string">"500"</span> height=<span class="hljs-string">"100"</span>&gt;&lt;/rect&gt;
&lt;/svg&gt;
</code></pre>

  
  



<p>Now, we can give select countries different colors. Also, we should have some sort of visual feedback when hovering over a country. </p>
<pre><code class="lang-css"> &lt;<span class="hljs-selector-tag">style</span>&gt;
      <span class="hljs-selector-id">#mapsection</span> {
        <span class="hljs-attribute">width</span>: <span class="hljs-number">50%</span>;
        <span class="hljs-attribute">height</span>: auto;
        <span class="hljs-attribute">fill</span>: <span class="hljs-number">#ccc</span>;
        <span class="hljs-attribute">stroke</span>: <span class="hljs-number">#333</span>;
        <span class="hljs-attribute">stroke-width</span>: <span class="hljs-number">2</span>;
      }
      <span class="hljs-selector-id">#mali</span> {
        <span class="hljs-attribute">fill</span>: brown;
      }

      <span class="hljs-selector-id">#Benin</span> {
        <span class="hljs-attribute">fill</span>: <span class="hljs-number">#00baba</span>;
      }

      <span class="hljs-selector-id">#Nigeria</span> {
        <span class="hljs-attribute">fill</span>: yellow;
      }

      <span class="hljs-selector-id">#Zimbabwe</span> {
        <span class="hljs-attribute">fill</span>: brown;
      }

      <span class="hljs-selector-id">#Zambia</span> {
        <span class="hljs-attribute">fill</span>: green;
      }

      <span class="hljs-selector-id">#Somalia</span> {
        <span class="hljs-attribute">fill</span>: darkseagreen;
      }

      <span class="hljs-selector-id">#Mali</span> {
        <span class="hljs-attribute">fill</span>: gray;
      }

      <span class="hljs-selector-tag">path</span> {
        <span class="hljs-attribute">fill</span>: <span class="hljs-number">#1da1f2</span>;
      }
      <span class="hljs-selector-tag">path</span><span class="hljs-selector-pseudo">:hover</span> {
        <span class="hljs-attribute">fill</span>: purple;
        <span class="hljs-attribute">stroke</span>: red;
        <span class="hljs-attribute">stroke-width</span>: <span class="hljs-number">3px</span>;
        <span class="hljs-attribute">transition</span>: fill <span class="hljs-number">0.4s</span>;
      }
    &lt;/<span class="hljs-selector-tag">style</span>&gt;
</code></pre>
<p>The above block of CSS code styles elements on our map. Here is an explanation of each rule:</p>
<ul>
<li><code>#mapsection</code>: This targets SVG elements with the ID <em>mapsection</em>. It sets the width to 50%, height to auto, and stroke properties for the element.</li>
<li><code>#mali</code>, <code>#Benin</code>, <code>#Nigeria</code>, <code>#Zimbabwe</code>, <code>#Zambia</code>, and <code>#Somalia</code>: These target specific <code>path</code> elements with IDs corresponding to their country names. They set the <em>fill</em> color for each country.</li>
<li><code>path</code>: This targets all <code>path</code> elements on the webpage. It sets the fill color to #1da1f2.</li>
<li><code>path:hover</code>: This targets all <code>path</code> elements on the webpage when they are hovered over with the mouse. It sets the fill color to purple, stroke color to red, and stroke width to 3px. It also sets a transition effect for the fill color change.</li>
</ul>
<p>&lt;!DOCTYPE html&gt;</p>

  
    
    
    
    Document
    
  
  
    
      

      
        
          
          
          
          

          

          
            1000 km
          

          
            1000 km
          

          

          

          

          

          
            1000 mi
          

          
            1000 mi
          

          

          

          

          

          
            0
          

          
            0
          

          

          

          

          

          
            0
          

          
            0
          

          

          
        

        
        
          

          

          
        

        
        
        
          
          
        
        <a href="https://en.wikipedia.org/wiki/Benin" id="Benin" target="_blank">
          
        </a>
        <a href="https://en.wikipedia.org/wiki/Botsuana" id="Botsuana" target="_blank">
          
        </a>
        <a href="https://en.wikipedia.org/wiki/Burundi" id="Burundi" target="_blank">
          
        </a>
        <a href="https://en.wikipedia.org/wiki/Burkina_Faso" id="Burkina_Faso" target="_blank">
          
        </a>
        <a href="https://en.wikipedia.org/wiki/Democratic_Republic_of_the_Congo" id="Demokratische_Republik_Kongolic" target="_blank">
          
        </a>
        <a href="https://en.wikipedia.org/wiki/Dschibuti" id="Dschibuti" target="_blank">
          
        </a>
        <a href="https://en.wikipedia.org/wiki/Ivory_Coast" id="Ivory_Coast" target="_blank">
          
        </a>
        <a href="https://en.wikipedia.org/wiki/Eritrea" id="Eritrea" target="_blank">
          
        </a>
        <a href="https://en.wikipedia.org/wiki/Gabon" id="Gabun" target="_blank">
          
        </a>
        <a href="https://en.wikipedia.org/wiki/Gambia" target="_blank" id="Gambia">
          
        </a>
        <a href="https://en.wikipedia.org/wiki/Ghana" target="_blank" id="Ghana">
          
        </a>
        <a href="https://en.wikipedia.org/wiki/Guinea" target="_blank" id="Guinea">
          
        </a>
        <a href="https://en.wikipedia.org/wiki/Guinea-Bissau" target="_blank" id="Guinea-Bissau">
          
        </a>
        <a href="https://en.wikipedia.org/wiki/Cameroon" target="_blank" id="Cameroon">
          
        </a>
        <a href="https://en.wikipedia.org/wiki/Kenya" target="_blank" id="Kenya">
          
        </a>
        <a href="https://en.wikipedia.org/wiki/Libya" target="_blank" id="Libya">
          
        </a>
        <a href="https://en.wikipedia.org/wiki/Liberia" target="_blank" id="Liberia">
          
        </a>
        <a href="https://en.wikipedia.org/wiki/Madagaskar" target="_blank" id="Madagaskar">
          
        </a>

        <a href="https://en.wikipedia.org/wiki/Mali" id="malic" target="_blank">
          
        </a>
        <a href="https://en.wikipedia.org/wiki/Malawi" id="Malawi" target="_blank">
          
        </a>
        <a href="https://en.wikipedia.org/wiki/Morocco" id="Morocco" target="_blank">
          
        </a>
        <a href="https://en.wikipedia.org/wiki/Mauretanien" id="Mauretanien" target="_blank">
          
        </a>
        <a href="https://en.wikipedia.org/wiki/Mozambique" id="Mozambique" target="_blank">
          
        </a>
        <a href="https://en.wikipedia.org/wiki/Namibia" id="Namibia" target="_blank">
          
        </a>
        <a href="https://en.wikipedia.org/wiki/Niger" id="malic" target="_blank">
          
        </a>
        <a href="https://en.wikipedia.org/wiki/Nigeria" id="Nigeria" target="_blank">
          
        </a>
        <a href="https://en.wikipedia.org/wiki/Republic_of_the_Congo" id="Republic_of_the_Congo" target="_blank">
          
        </a>
        <a href="https://en.wikipedia.org/wiki/Rwanda" id="Rwanda" target="_blank">
          
        </a>
        <a href="https://en.wikipedia.org/wiki/Zambia" id="Zambia" target="_blank">
          
        </a>
        <a href="https://en.wikipedia.org/wiki/Senegal" id="Senegal" target="_blank">
          
        </a>
        <a href="https://en.wikipedia.org/wiki/Sierra_Leone" id="Sierra_Leone" target="_blank">
          
        </a>
        <a href="https://en.wikipedia.org/wiki/Zimbabwe" id="Zimbabwe" target="_blank">
          
        </a>
        <a href="https://en.wikipedia.org/wiki/Somalia" id="Somalia" target="_blank">
          
        </a>
        
        <a href="https://en.wikipedia.org/wiki/Sudan" id="Sudan" target="_blank">
          
        </a>
        <a href="https://en.wikipedia.org/wiki/South Africa" id="South Africa" target="_blank">
          
        </a>
        <a href="https://en.wikipedia.org/wiki/Swasiland" id="Swasiland" target="_blank">
          
        </a>
        <a href="https://en.wikipedia.org/wiki/Tanzania" id="Tanzania" target="_blank">
          
        </a>
        <a href="https://en.wikipedia.org/wiki/Togo" id="Togo" target="_blank">
          
        </a>
        <a href="https://en.wikipedia.org/wiki/Tunisia" id="Tunisia" target="_blank">
          
        </a>
        <a href="https://en.wikipedia.org/wiki/Chad" id="Chad" target="_blank">
          
        </a>
        <a href="https://en.wikipedia.org/wiki/Uganda" id="Uganda" target="_blank">
          
        </a>
        <a href="https://en.wikipedia.org/wiki/Western_Sahara" id="Western_Sahara" target="_blank">
          
        </a>
        <a href="https://en.wikipedia.org/wiki/Central_African_Republic" id="Central_African_Republic" target="_blank">
          
        </a>
        <a href="https://en.wikipedia.org/wiki/Lesotho" id="Lesotho" target="_blank">
          
        </a>
      
    
  



<p>Try clicking on each country. The anchor tag will open a new page and show more information.</p>
<p>Click here to see the live <a target="_blank" href="https://rufai.github.io/buildingx/TourAfrique/">demo</a>.   </p>
<p>Find the complete code <a target="_blank" href="https://github.com/rufai/rufai.github.io/tree/master/buildingx/TourAfrique">here</a>.</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>This tutorial explained how to create a clickable SVG map by setting up the HTML file, adding interactivity with CSS (including hover and click effects), and adding functionality by linking areas of the map to external web pages. We also discussed the benefits of using SVG maps.</p>
<h3 id="heading-references">References</h3>
<p>There are plenty of resources available to learn more about SVGs. Here are some resources you can look up:</p>
<ol>
<li>MDN Web Docs - SVG: MDN Web Docs is a great resource for learning about web development, including SVG. The SVG section covers everything from basic concepts to advanced topics.</li>
<li>SVG on CSS-Tricks: CSS-Tricks is a popular blog about web development and design. The SVG section covers a range of topics, including how to create SVG graphics, animation, and interactivity.</li>
<li>Xutini Tutorials: the fun way to learn web digital skills. </li>
<li>SVG Pocket Guide: SVG Pocket Guide is a book by Joni Trythall that covers the basics of SVG, including shapes, paths, text, and filters. It's a concise guide that's easy to read and follow.</li>
<li>SVG Animations: SVG Animations is a book by Sarah Drasner that covers the basics of SVG animations, including how to create and control animations using CSS and JavaScript.</li>
</ol>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Generate Colors in JavaScript ]]>
                </title>
                <description>
                    <![CDATA[ In this article, we'll build a random color generator in JavaScript. Along the way, we will explore general topics in programming like functions and randomization.  We will build a project called Change The Background Color to illustrate these concep... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/generate-colors-in-javascript/</link>
                <guid isPermaLink="false">66c17cc531d965ba683261b9</guid>
                
                    <category>
                        <![CDATA[ JavaScript ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Rufai Mustapha ]]>
                </dc:creator>
                <pubDate>Tue, 07 Mar 2023 22:11:32 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2023/03/colotd--2-.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>In this article, we'll build a random color generator in JavaScript. Along the way, we will explore general topics in programming like functions and randomization. </p>
<p>We will build a project called <em>Change The Background Color</em> to illustrate these concepts. You can see the demo <a target="_blank" href="http://rufai.github.io/buildingx/random_bg_color.html">here</a>. </p>
<p>In this tutorial, we will:</p>
<ul>
<li>learn how computers understand the concept of colors</li>
<li>learn about the hexadecimal system and its usefulness to computers</li>
<li>learn how to separate concerns in your code</li>
<li>explore to the world of loops, arrays, and functions as used in JavaScript</li>
<li>use this new knowledge to generate colors in hexadecimal</li>
<li>introduce events in JavaScript</li>
<li>click a button in our HTML code to call our functions</li>
<li>change the body style <em>background-color</em> when the button is clicked</li>
</ul>
<p>This article should be accessible to anyone who is familiar with variables and how to create them in any programming language.  </p>
<h2 id="heading-what-well-cover">What We'll Cover</h2>
<ol>
<li>How Computers Understand Colors</li>
<li>What is the Hexadecimal System?</li>
<li>How Hexadecimal Is Used In Color Spaces</li>
<li>How to Generate Colors With Hexadecimals</li>
</ol>
<h2 id="heading-how-computers-understand-colors">How Computers Understand Colors</h2>
<p>Computer displays use tiny dots called pixels to display colors by mixing red, green, and blue light. </p>
<p>To interpret and manipulate colors, computers use mathematical models called color spaces. By converting colors into a specific color space, computers can modify and adjust them before displaying them on the screen.   </p>
<p>There are many different types of color spaces, each with its own way of representing colors. Here are some examples:</p>
<ol>
<li>RGB (Red, Green, Blue): This is the most common color space used in computer graphics, and it represents colors by mixing different amounts of red, green, and blue components.</li>
<li>CMYK (Cyan, Magenta, Yellow, Black): This is a color space used in printing, where colors are created by overlaying dots of different colors on top of each other.</li>
<li>HSL (Hue, Saturation, Lightness): This color space represents colors based on their hue (which color they are), saturation (how intense the color is), and lightness (how bright or dark the color is).</li>
<li>LAB (Lightness, A, B): This color space is used in digital imaging and represents colors based on their lightness, as well as their position on two color axes: A (from green to red) and B (from blue to yellow).</li>
<li>XYZ: This color space represents colors based on the amount of light that they reflect or emit, and is often used in color matching applications.</li>
</ol>
<h2 id="heading-what-is-the-hexadecimal-system">What is the Hexadecimal System?</h2>
<p>Hexadecimal (or simply "hex") is a base-16 numbering system that is commonly used in computing and digital electronics. </p>
<p>In this system, numbers are represented using 16 digits: the regular decimal digits 0 through 9, plus the letters A through F which represent values 10 through 15.</p>
<pre><code class="lang-[0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F]```">
Hexadecimal is often used in computing because it provides a compact and easy-to-read way to represent binary numbers. Each hex digit corresponds to four binary digits, or bits, which means that two hexadecimal digits can represent a byte of data (8 bits).

### How Hexadecimal Is Used In Color Spaces

Hexadecimal is commonly used to represent colors in various color spaces, particularly in digital media. 

Each component in RGB can have a value between 0 and 255, and these values can be converted to hexadecimal notation using a [base-16 numbering system](https://www.colorhexa.com/11eb11).

In RGB hexadecimal notation, each component is represented by a two-digit hexadecimal number, which can range from 00 to FF.   

For example, 

| Color      | RGB | Hexadecimal  | 
| ----------- | ----------- |  ----------- |
| Black   | 0,0,0        | #000000        |
| Teal | 0,186,186 | #00BABA |
| Green | 17,235,17 | #11EB11 |
| Musterd-Yellow   | 250,194,134 | #FAC286 |
| White     | 255,255,255       | #FFFFFF       |




![Image](https://lh4.googleusercontent.com/X4ES_ppBld_5qGeavLFSlvSwyXHREWoFaO9WBIp3mV4psy-FNbZV6hXD5_eES4gdzpAXIS8uv1qdFeAyKCwPMgXaZnmlTpBBpw4X2Z8_pyP426g_RSLtipKJsid-e4lNy8D9cmgqE3EtDo3wnVnhC68)
_Hexadecimal color system illulstration_

## How to Generate Colors With Hexadecimals

Our goal in this section is to build the demo project. The demo project is a button. On clicking this button, a color is generated that changes the background of the HTML webpage.

There are the 6 steps to building the project. We'll walk through them one by one.

### 1. Represent hexadecimals using an array

```js

const hexCharacters = [0,1,2,3,4,5,6,7,8,9,"A","B","C","D","E","F"]
</code></pre>
<p>The first step is to hold our characters in a structure. I have picked an array for simplicity. The way arrays work in JavaScript allows us to <a target="_blank" href="https://www.freecodecamp.org/news/the-javascript-array-handbook/">select any item by providing its index</a>.</p>
<h3 id="heading-2-create-a-function-to-extract-items-from-this-array">2. Create a function to extract items from this array</h3>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> hexCharacters = [<span class="hljs-number">0</span>,<span class="hljs-number">1</span>,<span class="hljs-number">2</span>,<span class="hljs-number">3</span>,<span class="hljs-number">4</span>,<span class="hljs-number">5</span>,<span class="hljs-number">6</span>,<span class="hljs-number">7</span>,<span class="hljs-number">8</span>,<span class="hljs-number">9</span>,<span class="hljs-string">"A"</span>,<span class="hljs-string">"B"</span>,<span class="hljs-string">"C"</span>,<span class="hljs-string">"D"</span>,<span class="hljs-string">"E"</span>,<span class="hljs-string">"F"</span>]

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">getCharacter</span>(<span class="hljs-params">index</span>) </span>{
    <span class="hljs-keyword">return</span> hexCharacters[index]
}
</code></pre>
<p>The function <code>getCharacter</code> will take the index and return the hexademical-character stored in that place. This helps us as we pick our colors.</p>
<h3 id="heading-3-represent-colors-using-the-extracted-value">3. Represent colors using the extracted value</h3>
<p>A hexadecimal representation of RGB starts with <code>#</code> followed by 6 characters selected from our array. Thus, the function <code>getCharacters</code> will be called 6 times. We can employ a <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for">for-loop</a> to call our function faster. </p>
<pre><code class="lang-js">
<span class="hljs-keyword">const</span> hexCharacters = [<span class="hljs-number">0</span>,<span class="hljs-number">1</span>,<span class="hljs-number">2</span>,<span class="hljs-number">3</span>,<span class="hljs-number">4</span>,<span class="hljs-number">5</span>,<span class="hljs-number">6</span>,<span class="hljs-number">7</span>,<span class="hljs-number">8</span>,<span class="hljs-number">9</span>,<span class="hljs-string">"A"</span>,<span class="hljs-string">"B"</span>,<span class="hljs-string">"C"</span>,<span class="hljs-string">"D"</span>,<span class="hljs-string">"E"</span>,<span class="hljs-string">"F"</span>]


<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">getCharacter</span>(<span class="hljs-params">index</span>) </span>{
    <span class="hljs-keyword">return</span> hexCharacters[index]
}

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">generateJustOneColor</span>(<span class="hljs-params"></span>)</span>{

    <span class="hljs-keyword">let</span> hexColorRep = <span class="hljs-string">"#"</span>

    <span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> position = <span class="hljs-number">0</span>; position &lt; <span class="hljs-number">6</span>; position++){
        hexColorRep += getCharacter( position )
    }

    <span class="hljs-keyword">return</span> hexColorRep

}

<span class="hljs-built_in">console</span>.log( generateJustOneColor() )
</code></pre>
<p><code>generateJustOneColor()</code> generates a random hexadecimal color code represented as a string.</p>
<p>The function starts by declaring a variable named <em>hexColorRep</em> and initializing it with the # character. </p>
<p>Next, the function uses a for loop to generate the next six characters of the color code. The loop runs six times because each color code is represented by six hexadecimal digits.</p>
<p>Within the loop, the function calls another function named <code>getCharacter()</code> to generate a hexadecimal digit for each position of the color code. The <code>position</code> parameter is passed to the <code>getCharacter()</code> function to indicate which digit is being generated.</p>
<p>Once all six digits of the color code have been generated, the function returns the full color code as a string.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/02/Screenshot-2023-02-21-at-08.56.42.png" alt="Image" width="600" height="400" loading="lazy">
<em>The same result is returned every time.</em></p>
<p>The above code will to return this same result/color given the same <code>position</code> for our for-loop<em>.</em> So we need to introduce randomness. This means our selection of the characters must have the element of surprise. </p>
<h3 id="heading-4-improve-our-code-to-generate-random-colors">4. Improve our code to generate random colors</h3>
<p>In JavaScript, <strong><a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random"><code>Math.random()</code></a></strong> is one of the ways to introduce randomness. <code>Math.random()</code> gives a new result every time it is called in range <code>0 to 1</code><em>.</em> </p>
<p>While the <code>Math.random()</code> function generates a random decimal number between 0 (inclusive) and 1 (exclusive), we can manipulate this value to obtain a random integer between 0 and 15.</p>
<p>This is done by multiplying the random decimal number by the desired range of integers (in this case, 16) and then applying the <code>Math.floor()</code> method to round down the result to the nearest integer. This will ensure that the output is within the desired range of integers.</p>
<p>For example, if <code>Math.random()</code> generates the value <code>0.435</code>, multiplying it by 16 would result in <code>6.96</code>. Applying <code>Math.floor()</code> to this result would then round it down to <code>6</code>, which is a random integer within the range of 0 to 15.</p>
<p><code>Math.floor()</code> performs 2 roles here: it helps us avoid a <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Invalid_array_length">RangeError</a> by rounding-down the extremes (the maximum number will be 15) and ensures we always return an integer. </p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> randomNumber = <span class="hljs-built_in">Math</span>.floor ( <span class="hljs-built_in">Math</span>.random() * hexCharacters.length )
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/02/Screenshot-2023-02-21-at-08.34.10.png" alt="Image" width="600" height="400" loading="lazy">
<em>Math.random() gives a new result every-time it is called.</em></p>
<p>We have all the ingredients needed to generate our colour, so now we can combine them together. Each hex-colour must start with a "#" and be followed by 6 characters<em>.</em> </p>
<pre><code class="lang-js">

<span class="hljs-keyword">const</span> hexCharacters = [<span class="hljs-number">0</span>,<span class="hljs-number">1</span>,<span class="hljs-number">2</span>,<span class="hljs-number">3</span>,<span class="hljs-number">4</span>,<span class="hljs-number">5</span>,<span class="hljs-number">6</span>,<span class="hljs-number">7</span>,<span class="hljs-number">8</span>,<span class="hljs-number">9</span>,<span class="hljs-string">"A"</span>,<span class="hljs-string">"B"</span>,<span class="hljs-string">"C"</span>,<span class="hljs-string">"D"</span>,<span class="hljs-string">"E"</span>,<span class="hljs-string">"F"</span>]



<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">getCharacter</span>(<span class="hljs-params">index</span>) </span>{
    <span class="hljs-keyword">return</span> hexCharacters[index]
}

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">generateNewColor</span>(<span class="hljs-params"></span>) </span>{
    <span class="hljs-keyword">let</span> hexColorRep = <span class="hljs-string">"#"</span>

    <span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> index = <span class="hljs-number">0</span>; index &lt; <span class="hljs-number">6</span>; index++){
        <span class="hljs-keyword">const</span> randomPosition = <span class="hljs-built_in">Math</span>.floor ( <span class="hljs-built_in">Math</span>.random() * hexCharacters.length ) 
        hexColorRep += getCharacter( randomPosition )
    }

    <span class="hljs-keyword">return</span> hexColorRep
}

<span class="hljs-built_in">console</span>.log( generateNewColor() )
</code></pre>
<p>The <code>generateNewColor()</code> function is the main function of the program that generates the random hexadecimal color code. It starts by initializing a string variable named "hexColorRep" with the "#" character, as all hexadecimal color codes begin with this character.</p>
<p>Next, the function uses a for loop to generate six random characters for the color code. Within the loop, the function generates a random position within the range of the "hexCharacters" array using the <code>Math.random()</code> function and the length of the <code>hexCharacters</code> array. This random position is then used to obtain a random character from the <code>hexCharacters</code> array using the <code>getCharacter()</code> function. The resulting character is appended to the <code>hexColorRep</code> string variable.</p>
<p>Finally, the <code>generateNewColor()</code> function returns the complete hexadecimal color code represented as a string.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/02/Screenshot-2023-02-21-at-08.55.07.png" alt="Image" width="600" height="400" loading="lazy">
<em>The result is always a new hex-color-rep.</em></p>
<h3 id="heading-5-create-an-interface-to-present-our-code">5. Create an interface to present our code</h3>
<p>We need an interface so users can interact with our code and see the magic we have created. </p>
<p>We are going to have an HTML page with a list of instructions and a button. The elements button and span are given the id attribute so it's easier to find them in our JavaScript code. You can see the HTML code <a target="_blank" href="https://github.com/rufai/rufai.github.io/blob/master/buildingx/random_bg_color.html">here</a>. </p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/03/demo4.JPG" alt="Image" width="600" height="400" loading="lazy"></p>
<h3 id="heading-6-connect-the-button-to-the-function-using-an-event">6. Connect the button to the function using an event</h3>
<p>Our goal is to change the <em>background-color</em> style of this HTML page. </p>
<pre><code class="lang-js"><span class="hljs-keyword">let</span> btn = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'b'</span>)
<span class="hljs-keyword">let</span> bgColor = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'s'</span>)

btn.addEventListener(<span class="hljs-string">"click"</span>, <span class="hljs-function">(<span class="hljs-params">event</span>) =&gt;</span> {

    <span class="hljs-keyword">const</span> newColor = generateNewColor()

    <span class="hljs-built_in">document</span>.body.style.backgroundColor  = newColor
    bgColor.textContent = newColor 

})
</code></pre>
<p>This program that sets the background color of a webpage to a randomly generated hexadecimal color code when a button is clicked.</p>
<p>The program begins by defining two variables using the <code>document.getElementById()</code> method. The <code>btn</code> variable represents the button element on the webpage with the ID <code>b</code>, while the <code>bgColor</code> variable represents a text element on the webpage with the ID <code>s</code>.</p>
<p>Next, the program attaches an event listener to the <code>btn</code> element using the <code>addEventListener()</code> method. This listener listens for the <code>click</code> event on the button. When triggered, it executes a function that generates a new random color code using the <code>generateNewColor()</code> function.</p>
<p>The resulting color code is then assigned to the background color of the webpage using the <code>style.backgroundColor</code> property of the <code>document.body</code> element. This causes the entire webpage to be updated with the new color.</p>
<p>Finally, the color code is also displayed in the <code>bgColor</code> element on the webpage using the textContent property.</p>
<p>You can see the full code <a target="_blank" href="https://github.com/rufai/rufai.github.io/blob/master/buildingx/random_bg_color.html">here</a>. </p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/02/ezgif.com-gif-maker-1.gif" alt="Image" width="600" height="400" loading="lazy">
<em>FInal product</em></p>
<h2 id="heading-summary">Summary</h2>
<p>In this article, we have shown how to generate random colours in JavaScript. We used the methods <em>random</em> and <em>floor</em> from the <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math">Math</a> class and showed basic usage of a for-loop.  </p>
<p>In the <a target="_blank" href="http://rufai.github.io/buildingx/random_bg_color.html">demo project</a>, the generated colour was passed as background to an HTML page. This is why on clicking the button, a new colour gets generated, and updates the <em>background-color</em> style of the page. Check out the full <a target="_blank" href="https://github.com/rufai/rufai.github.io/blob/master/buildingx/random_bg_color.html">code here</a>.   </p>
<p>If you want to see more of teachings, check out <a target="_blank" href="https://www.youtube.com/@xutini">Xutini</a> - the fun way to learn digital skills.  </p>
 ]]>
                </content:encoded>
            </item>
        
    </channel>
</rss>
