<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Arjun Sharma</title>
    <description>The latest articles on Forem by Arjun Sharma (@beginarjun).</description>
    <link>https://forem.com/beginarjun</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F869565%2Fea6aba53-bb59-4aad-9369-acd72c8267e3.png</url>
      <title>Forem: Arjun Sharma</title>
      <link>https://forem.com/beginarjun</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/beginarjun"/>
    <language>en</language>
    <item>
      <title>GIVEAWAY + GOOD BOY UPDATE!</title>
      <dc:creator>Arjun Sharma</dc:creator>
      <pubDate>Thu, 25 Sep 2025 18:24:55 +0000</pubDate>
      <link>https://forem.com/beginarjun/giveaway-good-boy-update-20c3</link>
      <guid>https://forem.com/beginarjun/giveaway-good-boy-update-20c3</guid>
      <description>&lt;p&gt;Hey everyone,&lt;/p&gt;

&lt;p&gt;Time for another update on Good Boy. If you’ve been following along, you know the idea has always been pretty simple: a desktop pet that doesn’t demand your attention. He’s not an idle game with grindy loops, just a little companion that eats, naps, and hangs out while you work (or binge random YouTube videos).&lt;/p&gt;

&lt;p&gt;Lately, I’ve been experimenting with new ways to show him off — and that led me to record a short YouTube video. &lt;br&gt;
👉 &lt;a href="https://youtu.be/q-tIoarK1QY" rel="noopener noreferrer"&gt;Watch the video here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Where Good Boy is headed&lt;/p&gt;

&lt;p&gt;Adding more unique interactions (the kind you’ll discover accidentally and laugh at).&lt;/p&gt;

&lt;p&gt;A full customization system, so you can make him look like your own dog.&lt;/p&gt;

&lt;p&gt;Fun cosmetics to dress him up.&lt;/p&gt;

&lt;p&gt;Long-term: I want this to grow into something bigger than just a novelty — a cozy, supportive presence on your desktop.&lt;/p&gt;

&lt;p&gt;But to get there, the project needs your support. Right now, Good Boy is available on Itch for just $2. Every adoption helps me keep working on new features.&lt;br&gt;
👉 &lt;a href="https://wigglingdog.itch.io/good-boy" rel="noopener noreferrer"&gt;Itch.io link&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;🎁 The Giveaway&lt;/p&gt;

&lt;p&gt;I know not everyone can support right away, so I’ve set up a small giveaway for the community. &lt;/p&gt;

&lt;p&gt;How to enter:&lt;/p&gt;

&lt;p&gt;Join our Discord → &lt;a href="https://discord.gg/HrTH9jrVPz" rel="noopener noreferrer"&gt;Discord Invite&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Head to the #giveaway channel and react to the post.&lt;/p&gt;

&lt;p&gt;I’ll be picking winners there soon, so make sure you hop in.&lt;/p&gt;

&lt;p&gt;That’s all for this update. Thanks again to everyone who’s been playing, giving feedback, and just hanging out in the Discord — it really means a lot. I’ll see you in the comments (or the giveaway channel 👀).&lt;/p&gt;

</description>
      <category>gamedev</category>
      <category>programming</category>
      <category>development</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Good Boy (v1.0) Release: Bringing a Lovable Desktop Pet to Life</title>
      <dc:creator>Arjun Sharma</dc:creator>
      <pubDate>Fri, 19 Sep 2025 15:43:53 +0000</pubDate>
      <link>https://forem.com/beginarjun/good-boy-v10-release-bringing-a-lovable-desktop-pet-to-life-239j</link>
      <guid>https://forem.com/beginarjun/good-boy-v10-release-bringing-a-lovable-desktop-pet-to-life-239j</guid>
      <description>&lt;p&gt;&lt;strong&gt;Good Boy (v1.0) Release&lt;/strong&gt;: Bringing a Lovable Desktop Pet to Life&lt;br&gt;
Hey everyone! I’m thrilled to announce the release of &lt;strong&gt;Good Boy (v1.0)&lt;/strong&gt;, a charming desktop pet for Windows that’s sure to steal your heart. Picture a cute, animated dog you can interact with, play with, and even feed, right on your desktop! This project has been a labor of love, built from the ground up in Godot, and I’m excited to share the journey, challenges, and what’s next.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbhwln5v8kmmfe0ig8jbc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbhwln5v8kmmfe0ig8jbc.png" alt="What is Good Boy" width="560" height="135"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Good Boy&lt;/strong&gt; is a lightweight desktop companion that lives on your screen. You can pet your virtual pup, toss a ball for a game of fetch, or feed it treats to keep it happy. It’s designed to bring a bit of joy and whimsy to your workday without getting in the way. Think of it like those classic virtual pets but with a modern twist and a lot of personality.&lt;br&gt;
For example, imagine you’re working on a spreadsheet, and your desktop dog nudges the corner of your screen, wagging its tail. You can drag a bone from its food bowl, and it’ll happily chomp away while you get back to work. It’s simple, fun, and surprisingly heartwarming.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmimxivx6odj47bqiijhb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmimxivx6odj47bqiijhb.png" alt="Features" width="640" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw0g6n9xn1k9mmmh5egss.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw0g6n9xn1k9mmmh5egss.png" alt="Features_II" width="640" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  The Development Journey
&lt;/h3&gt;

&lt;p&gt;Building Good Boy in Godot was a blast, but it wasn’t without its hurdles. Here’s a peek into some of the challenges I faced:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Input Passthrough Woes&lt;/strong&gt;: One of the trickiest parts was making sure the dog didn’t hog all your mouse clicks. I had to figure out how to let inputs pass through to underlying windows (like your browser or file explorer) when they weren’t interacting with the pet. This involved diving deep into Godot’s input handling system and tweaking the event propagation. After a lot of trial and error (and some frustrated debugging sessions), I got it working smoothly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Collaborating with an Artist&lt;/strong&gt;: Working with an artist to bring the dog’s animations and personality to life was amazing but challenging. I fumbled a few times when conveying my vision—like when I vaguely described “a happy wag” and got a tail that spun like a helicopter! Clearer communication and mood boards helped us align, and the final art is adorable (shoutout to my artist for their patience!).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scoping to Meet Deadlines&lt;/strong&gt;: Early on, I had big dreams—multiple pets, complex mini-games, you name it. But to hit the release deadline, I had to ruthlessly scope down to the core features: petting, feeding, and simple play. It was tough to cut ideas, but it ensured Good Boy launched as a polished, focused experience.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What’s Next for Good Boy?&lt;/strong&gt;&lt;br&gt;
The v1.0 release is just the beginning! I’m committed to keeping Good Boy alive and growing. Here’s what’s on the horizon:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Steam Release&lt;/em&gt;: I’m planning to bring Good Boy to Steam, making it easier for more people to discover and enjoy.&lt;br&gt;
Bug Fixes &amp;amp; Polish: I’ll be squashing bugs and refining the experience based on your feedback.&lt;br&gt;
New Content &amp;amp; Features: Expect more interactions, like new toys or tricks, and maybe even seasonal outfits for your pup.&lt;/p&gt;

&lt;p&gt;Final Thoughts&lt;br&gt;
Releasing Good Boy v1.0 feels like sending a beloved pet out into the world. It’s been a wild ride learning Godot’s quirks, collaborating with an artist, and making tough calls to meet deadlines. I’m proud of the result—a cute, interactive companion that I hope brings a smile to your face.&lt;br&gt;
&lt;a href="https://wigglingdog.itch.io/good-boy" rel="noopener noreferrer"&gt;Try Good Boy today&lt;/a&gt;, and let me know what you think! Your feedback will shape its future. Stay tuned for updates, and thanks for joining me on this journey.&lt;br&gt;
Happy petting! 🐶&lt;/p&gt;

</description>
      <category>programming</category>
      <category>gamedev</category>
      <category>showdev</category>
      <category>productivity</category>
    </item>
    <item>
      <title>How I Built My Portfolio Using NextJS and MDX</title>
      <dc:creator>Arjun Sharma</dc:creator>
      <pubDate>Mon, 10 Jun 2024 04:42:10 +0000</pubDate>
      <link>https://forem.com/beginarjun/how-i-built-my-portfolio-using-nextjs-and-mdx-168a</link>
      <guid>https://forem.com/beginarjun/how-i-built-my-portfolio-using-nextjs-and-mdx-168a</guid>
      <description>&lt;p&gt;Last year, I was inspired by amazing developers like &lt;a href="https://joshwcomeau.com/"&gt;Josh W Comeau&lt;/a&gt; and &lt;a href="https://kentcdodds.com/"&gt;Kent C Dodds&lt;/a&gt;. I decided to make my own portfolio website with a blog to learn in the open and share my journey with the community. You can check it out &lt;a href="https://beginarjun.vercel.app"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Inspiration and Initial Research&lt;/li&gt;
&lt;li&gt;Choosing Next.js and MDX&lt;/li&gt;
&lt;li&gt;Setting Up the Project&lt;/li&gt;
&lt;li&gt;Challenges with the Next.js App Router&lt;/li&gt;
&lt;li&gt;Styling MDX Content&lt;/li&gt;
&lt;li&gt;Using TailwindCSS and Tailwind Typography&lt;/li&gt;
&lt;li&gt;Implementing Page Views with Redis&lt;/li&gt;
&lt;li&gt;Taking a Break&lt;/li&gt;
&lt;li&gt;Back with More Experience&lt;/li&gt;
&lt;li&gt;Current State and Future Plans&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Inspiration and Initial Research
&lt;/h2&gt;

&lt;p&gt;Seeing how developers like &lt;a href="https://www.joshwcomeau.com/"&gt;Josh W Comeau&lt;/a&gt; and &lt;a href="https://www.kentcdodds.com"&gt;Kent C. Dodds&lt;/a&gt; shared their knowledge and projects,&lt;br&gt;
 I felt motivated to create something similar. &lt;br&gt;
 I wanted a platform where I could document my learning process and projects. &lt;br&gt;
 A blog integrated into my portfolio seemed like the perfect idea.&lt;/p&gt;
&lt;h2&gt;
  
  
  Choosing Next.js and MDX
&lt;/h2&gt;

&lt;p&gt;After some research, I decided to use Next.js for its flexibility and performance. &lt;br&gt;
For the blog, I chose MDX because it allowed me to write JSX in Markdown, giving me the power to create interactive content. I opted for &lt;code&gt;next-mdx-remote&lt;/code&gt; for MDX compilation.&lt;/p&gt;
&lt;h2&gt;
  
  
  Setting Up the Project
&lt;/h2&gt;

&lt;p&gt;Here's a step-by-step guide on setting up a Next.js project with MDX, TailwindCSS, and other packages.&lt;/p&gt;
&lt;h3&gt;
  
  
  Initialize Next.js Project
&lt;/h3&gt;

&lt;p&gt;First, we need to create a new Next.js project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx create-next-app@latest my-portfolio
&lt;span class="nb"&gt;cd &lt;/span&gt;my-portfolio
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Install Dependencies
&lt;/h3&gt;

&lt;p&gt;Next, we install the necessary dependencies:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; @next/mdx next-mdx-remote tailwindcss @tailwindcss/typography sugar-high redis
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Setup TailwindCSS
&lt;/h3&gt;

&lt;p&gt;To set up TailwindCSS, follow these steps:&lt;/p&gt;

&lt;h4&gt;
  
  
  Initialize TailwindCSS:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx tailwindcss init &lt;span class="nt"&gt;-p&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Configure TailwindCSS:
&lt;/h4&gt;

&lt;p&gt;Update tailwind.config.js:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./pages/**/*.{js,ts,jsx,tsx}&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./components/**/*.{js,ts,jsx,tsx}&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./posts/**/*.{md,mdx}&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
  &lt;span class="na"&gt;theme&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;extend&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{},&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="na"&gt;plugins&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@tailwindcss/typography&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)],&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  Add Tailwind Directives:
&lt;/h5&gt;

&lt;p&gt;Update styles/globals.css:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="k"&gt;@tailwind&lt;/span&gt; &lt;span class="n"&gt;base&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;@tailwind&lt;/span&gt; &lt;span class="n"&gt;components&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;@tailwind&lt;/span&gt; &lt;span class="n"&gt;utilities&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Configure MDX with next-mdx-remote
&lt;/h3&gt;

&lt;p&gt;To set up MDX, create a lib/mdx.js file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;fs&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;fs&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;path&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;path&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;matter&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;gray-matter&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;serialize&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;next-mdx-remote/serialize&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;postsDirectory&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;cwd&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;posts&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;getSortedPostsData&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;fileNames&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;fs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;readdirSync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;postsDirectory&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;allPostsData&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;fileNames&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;fileName&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;fileName&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;\.&lt;/span&gt;&lt;span class="sr"&gt;mdx$/&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;fullPath&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;postsDirectory&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;fileName&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;fileContents&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;fs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;readFileSync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;fullPath&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;utf8&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;matterResult&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;matter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;fileContents&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;matterResult&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;allPostsData&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sort&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;date&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;date&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;getPostData&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;fullPath&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;postsDirectory&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;.mdx`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;fileContents&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;fs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;readFileSync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;fullPath&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;utf8&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;matterResult&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;matter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;fileContents&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;mdxSource&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;serialize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;fileContents&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;mdxSource&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;matterResult&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;
  &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Create Blog Page
&lt;/h3&gt;

&lt;p&gt;Create a &lt;code&gt;pages/blog/[id].js&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;getPostData&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;getSortedPostsData&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;../../lib/mdx&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;MDXRemote&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;next-mdx-remote&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;Link&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;next/link&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;Post&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;postData&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;article&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;prose lg:prose-xl mx-auto&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h1&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;postData&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h1&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;MDXRemote&lt;/span&gt; &lt;span class="p"&gt;{...&lt;/span&gt;&lt;span class="nx"&gt;postData&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;mdxSource&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Link&lt;/span&gt; &lt;span class="nx"&gt;href&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/blog&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="err"&gt;←&lt;/span&gt; &lt;span class="nx"&gt;Back&lt;/span&gt; &lt;span class="nx"&gt;to&lt;/span&gt; &lt;span class="nx"&gt;Blog&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/Link&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/article&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;getStaticPaths&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;paths&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;getSortedPostsData&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;post&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;params&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;post&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}));&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;paths&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;fallback&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;getStaticProps&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;params&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;postData&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;getPostData&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;params&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;props&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;postData&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Challenges with the Next.js App Router
&lt;/h3&gt;

&lt;p&gt;Back then, the Next.js App Router was still new, and many packages hadn't been updated to work with it. I faced numerous issues and spent a lot of time on the next-mdx-remote GitHub repo discussing with the community. Eventually, &lt;br&gt;
I discovered they had a different implementation for the App Router's &lt;strong&gt;React Server Components&lt;/strong&gt; &lt;em&gt;(RSC)&lt;/em&gt;.&lt;/p&gt;
&lt;h4&gt;
  
  
  Styling MDX Content
&lt;/h4&gt;

&lt;p&gt;Creating a blog page was a significant achievement, but styling the MDX content turned out to be tricky. As a newcomer, I found it challenging to make the content look good. After struggling for a while, I decided to pause the project because I needed to focus on my summer project for college.&lt;/p&gt;
&lt;h3&gt;
  
  
  Using TailwindCSS and Tailwind Typography
&lt;/h3&gt;

&lt;p&gt;TailwindCSS and the Tailwind Typography plugin made styling much easier. By adding prose classes to my blog content, I could quickly achieve a clean and professional look.&lt;/p&gt;

&lt;p&gt;For example, wrapping the MDX content with &lt;code&gt;&amp;lt;article className="prose lg:prose-xl mx-auto"&amp;gt;&lt;/code&gt; applied beautiful default styles to all text elements.&lt;/p&gt;
&lt;h3&gt;
  
  
  Implementing Page Views with Redis
&lt;/h3&gt;

&lt;p&gt;To track page views, I used the sugar-high npm package with Redis. Here's a basic implementation:&lt;/p&gt;

&lt;p&gt;Install Redis&lt;br&gt;
Ensure Redis is installed and running on your machine. For the setup, I used Docker:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;--name&lt;/span&gt; redis &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; 6379:6379 redis
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a &lt;code&gt;lib/redis.js&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;Redis&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;ioredis&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;redis&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Redis&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;REDIS_URL&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;redis&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In your API route (e.g., &lt;code&gt;api/view/route.ts&lt;/code&gt;), set up the endpoint to count views:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;redis&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;../../lib/redis&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;NextRequest&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;NextResponse&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;next&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;POST&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;NextRequest&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;NextResponse&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;id&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;query&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;ip&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;x-real-ip&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;connection&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;remoteAddress&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;hasVisited&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sismember&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`views:&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;ip&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;hasVisited&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sadd&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`views:&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;ip&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;incr&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`views-count:&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;views&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`views-count:&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;views&lt;/span&gt; &lt;span class="p"&gt;},{&lt;/span&gt;&lt;span class="na"&gt;staus&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On the client side, you can fetch and display the views:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;useState&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;PageViews&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;id&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;views&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setViews&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="nf"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`/api/views?id=&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;setViews&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;views&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;views&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="nx"&gt;views&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&amp;gt;&lt;/span&gt;&lt;span class="err"&gt;;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Taking a Break
&lt;/h3&gt;

&lt;p&gt;During the break, I continued working with Next.js on various projects, including a cool project called LinkME, you can learn more about it &lt;a href="https://beginarjun.vercel.app/projects/linkme"&gt;here&lt;/a&gt;. This experience gave me a lot more confidence and knowledge.&lt;/p&gt;

&lt;h3&gt;
  
  
  Back with More Experience
&lt;/h3&gt;

&lt;p&gt;With the additional experience, I felt ready to tackle my portfolio website again. I decided to rebuild it from scratch. This time, everything went much smoother. Although it's not finished yet, I'm developing it iteratively based on feedback.&lt;/p&gt;

&lt;h3&gt;
  
  
  Current State and Future Plans
&lt;/h3&gt;

&lt;p&gt;The portfolio now includes a Project Page where I post about the projects I've completed. While there's still a lot to do, I'm happy with the progress and look forward to improving it over time.&lt;/p&gt;

&lt;p&gt;Thanks for reading about my journey in building my portfolio website. Stay tuned for more updates!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>nextjs</category>
      <category>howto</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Handling Forms in React</title>
      <dc:creator>Arjun Sharma</dc:creator>
      <pubDate>Sun, 04 Jun 2023 12:13:13 +0000</pubDate>
      <link>https://forem.com/beginarjun/handling-forms-in-react-4i07</link>
      <guid>https://forem.com/beginarjun/handling-forms-in-react-4i07</guid>
      <description>&lt;p&gt;&lt;em&gt;Hey there! So, let me tell you a little story. Once upon a time, I was trying to learn how to handle forms in React. And let me tell you, it was not a walk in the park. I found myself scratching my head and wondering why on earth it was so difficult to understand. But then, after many cups of coffee and some late nights, it finally clicked! And now, I want to share my knowledge with all of you lovely people out there who might be struggling just like I was. So buckle up and get ready for some form-handling fun (yes, that’s a thing)!&lt;/em&gt; 😂&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction to Forms
&lt;/h2&gt;

&lt;p&gt;In HTML, forms are used to collect user’s input which is generally sent to a server to process. Form can be visualized as a container for all input elements such as : text-fields, radio buttons, checkboxes, etc.&lt;br&gt;
You can learn more about forms &lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form"&gt;here&lt;/a&gt;&lt;br&gt;
For example,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;form&amp;gt;
  &amp;lt;label for="f-name"&amp;gt;First name:&amp;lt;/label&amp;gt;
  &amp;lt;input type="text" id="f-name" name="f-name"&amp;gt;
  &amp;lt;label for="l-name"&amp;gt;Last name:&amp;lt;/label&amp;gt;  
  &amp;lt;input type="text" id="l-name" name="l-name"&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Need for handling forms?
&lt;/h2&gt;

&lt;p&gt;In HTML, when we submit a form, you will notice that the page refreshes itself.&lt;/p&gt;

&lt;p&gt;However, since React stores the form data in state. If we don’t handle forms in React, the default behavior of the form will take place (i.e. it will refresh itself and the current state will be lost). This means that when the form is submitted the data entered by the user in the form will be lost forever.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6uomlwnv2qfayfgjz144.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6uomlwnv2qfayfgjz144.png" alt="SpongeBob SquarePants" width="500" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Handling Forms in React
&lt;/h3&gt;

&lt;p&gt;Now, that we know why Handling Form is so important, let’s get started on how to handle them.&lt;br&gt;
In React, we can handle form using two ways :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Controlled Components&lt;/li&gt;
&lt;li&gt;Uncontrolled Components&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let's see how they differ from each other and their working.&lt;/p&gt;
&lt;h4&gt;
  
  
  Controlled Components
&lt;/h4&gt;

&lt;p&gt;An form whose data is being controlled in such a way that it’s data is stored in the React state using &lt;code&gt;useState()&lt;/code&gt; and is updated using &lt;code&gt;setState()&lt;/code&gt; which can only be triggered by the user.&lt;br&gt;
To create your own controlled component, we need to use the &lt;code&gt;value&lt;/code&gt; prop and the &lt;code&gt;onChange&lt;/code&gt; prop of the form element.&lt;br&gt;
For example ,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { useState } from "react";
const Form=()=&amp;gt;{
  // To store data in state
  const [data,setData]=useState("") // If you provide a value to the component, it must remain a string throughout its lifetime.

  //To handle Submit
  const handleSubmit=(event)=&amp;gt;{
    event.preventDefault() //Prevents the default behaviour
    alert('You have entered the name: '+ data)
  }

  //To handle change of the input
  const handleChange=(event)=&amp;gt;{
    setData(event.target.value)
    event.preventDefault()  //Prevents the default behaviour
  }
  return(
    &amp;lt;form onSubmit={handleSubmit}&amp;gt;
      &amp;lt;label&amp;gt;
          Name:
          &amp;lt;input type="text" value={data} onChange={handleChange} /&amp;gt;
        &amp;lt;/label&amp;gt;
        &amp;lt;input type="submit" value="Submit" /&amp;gt;
    &amp;lt;/form&amp;gt;
  )
}
export default Form;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;iframe src="https://codesandbox.io/embed/busy-fog-7dzr9i"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h5&gt;
  
  
  Handling Multiple Inputs
&lt;/h5&gt;

&lt;p&gt;To handle multiple inputs, you can use &lt;code&gt;name&lt;/code&gt; attribute of an input element to access it and let the handler function choose what to do with it.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note : For checkboxes, use &lt;code&gt;event.target.checked&lt;/code&gt; instead of &lt;code&gt;event.target.value&lt;/code&gt;&lt;br&gt;
Example:&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

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

const Form=()=&amp;gt;{
  const [state,setState]=useState({isGoing: true,numberOfGuests: 2})

  const handleInputChange=(event)=&amp;gt;{
    event.preventDefault();
    const target=event.target
    const value = target.type === 'checkbox' ? target.checked : target.value;
    const name = target.name;
    setState((prevState)=&amp;gt;{
      return {...prevState,[name]:value}
    })
    console.log(state)
  }

  return(
    &amp;lt;form&amp;gt;
        &amp;lt;label&amp;gt;
          Is going:
          &amp;lt;input
            name="isGoing"
            type="checkbox"
            checked={state.isGoing}
            onChange={handleInputChange} 
            /&amp;gt;
        &amp;lt;/label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;label&amp;gt;
          Number of guests:
          &amp;lt;input
            name="numberOfGuests"
            type="number"
            value={state.numberOfGuests}
            onChange={handleInputChange}
             /&amp;gt;
        &amp;lt;/label&amp;gt;
      &amp;lt;/form&amp;gt;
  )
}
export default Form;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;iframe src="https://codesandbox.io/embed/suspicious-napier-ot7e6v"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Using controlled components in React can be time-consuming because you have to write an event handler for every change in data. This can be frustrating when converting old code to React or using it with non-React libraries. In these cases, you might want to try uncontrolled components, which are another way to implement forms.&lt;/em&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Uncontrolled Components
&lt;/h4&gt;

&lt;p&gt;Even if you manage to create a form which can handle multiple inputs, it still wouldn’t solve the performance issues as the component would re-render after each state update. &lt;br&gt;
Therefore, you may use uncontrolled components which makes use of &lt;code&gt;useRef()&lt;/code&gt; to get form values from the DOM(Document Object Model). &lt;br&gt;
Example :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { createRef } from "react"

const Form=()=&amp;gt;{
  const input=createRef()

  const handleSubmit=(event)=&amp;gt;{
    event.preventDefault()
    alert('A name was submitted: ' + input.current.value);
  }
  return(
    &amp;lt;form onSubmit={handleSubmit}&amp;gt;
        &amp;lt;label&amp;gt;
          Name:
          &amp;lt;input type="text" ref={input} /&amp;gt;
        &amp;lt;/label&amp;gt;
        &amp;lt;input type="submit" value="Submit" /&amp;gt;
      &amp;lt;/form&amp;gt;
  )
}
export default Form
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;iframe src="https://codesandbox.io/embed/stupefied-farrell-s8v4bm"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;As we can see an uncontrolled component gets the form values from the DOM, and is much more easier to implement as well as much less code than controlled input.&lt;/p&gt;

&lt;p&gt;However, it is still advised to use controlled components instead of uncontrolled components.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;You can head over to all the Sandbox which I've embedded and try to understand the code more efficiently. Also, I suggest reading some official docs by React.&lt;/p&gt;

&lt;p&gt;Farewell, my brave hobbits&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fga2ukay380ky3wmxori6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fga2ukay380ky3wmxori6.png" alt="LOTR" width="500" height="230"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>webdev</category>
      <category>beginners</category>
      <category>learning</category>
    </item>
    <item>
      <title>How to create a simple Loading Screen in React</title>
      <dc:creator>Arjun Sharma</dc:creator>
      <pubDate>Sat, 20 May 2023 19:47:44 +0000</pubDate>
      <link>https://forem.com/beginarjun/how-to-create-a-simple-loading-screen-in-react-1md6</link>
      <guid>https://forem.com/beginarjun/how-to-create-a-simple-loading-screen-in-react-1md6</guid>
      <description>&lt;p&gt;Hey devs 👋&lt;br&gt;
So, recently I was trying to figure out how to create an awesome looking Loading Screens in React without installing npm packages and also which are simple to use. And I came around something that I want to share with you guys.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Result
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw5bhpfwrzs614bmvbv55.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw5bhpfwrzs614bmvbv55.png" alt="Final Result"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fftsrjoo2wx8b9o90fs3b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fftsrjoo2wx8b9o90fs3b.png" alt="Star Wars"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating SVG using Figma
&lt;/h2&gt;

&lt;p&gt;Yes, we will be using Figma to create a SVG. Let's open up Figma in our desktop and create a new design file.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F98xc8t1shoa1b4dow990.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F98xc8t1shoa1b4dow990.png" alt="Figma"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Now, create a Frame (by pressing F) and selecting any dimension. I will be using 1280 x 720.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;After creating the Frame, let's make the background a bit darker so that we can see everything perfectly.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now, create a Text in the Frame and increase it's font-size. I will be using 64px.(Make sure the text width and height perfectly fits)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx8wfnz3zda61esoo9y52.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx8wfnz3zda61esoo9y52.png" alt="Loading SVG Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now, Right-click on the Text and select &lt;strong&gt;Outline Stroke&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4v64i5buvofsvb0pxrcp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4v64i5buvofsvb0pxrcp.png" alt="Outline Stroke"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now, let's remove the Fill color from the text and add a Stroke color having width of 5px. Now, it should look something like this...&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiyb92gshatu7ix6h5w0p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiyb92gshatu7ix6h5w0p.png" alt="Final SVG"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now, Right-click on the text and Copy as SVG.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Initial Project Setup
&lt;/h2&gt;

&lt;p&gt;First, let's create the React app by using the following command&lt;br&gt;
&lt;code&gt;npx create-react-app loading-screen&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now, let's delete all the files in &lt;code&gt;src&lt;/code&gt; directory inside the loading-screen app except the &lt;code&gt;index.js&lt;/code&gt;, &lt;code&gt;index.css&lt;/code&gt;, &lt;code&gt;app.js&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Loading Component
&lt;/h2&gt;

&lt;p&gt;Let's begin by creating the Loading Component. So, in the &lt;code&gt;src&lt;/code&gt; folder, create a new file named &lt;code&gt;Loading.jsx&lt;/code&gt; and &lt;code&gt;Loading.css&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a &lt;code&gt;div&lt;/code&gt; with id "loader-container" inside the Loading Component&lt;/li&gt;
&lt;li&gt;Inside the div paste the SVG and add an id "loader"&lt;/li&gt;
&lt;/ul&gt;

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

import './Loading.css'
const Loading=()=&amp;gt;{
  return(
    &amp;lt;div id="loader-container"&amp;gt;
      &amp;lt;svg id="loader" width="285" height="59" viewBox="0 0 285 59" fill="none" xmlns="http://www.w3.org/2000/svg"&amp;gt;
&amp;lt;mask id="path-1-outside-1_1_6" maskUnits="userSpaceOnUse" x="0.636353" y="0.818176" width="284" height="58" fill="black"&amp;gt;
&amp;lt;rect fill="white" x="0.636353" y="0.818176" width="284" height="58"/&amp;gt;
&amp;lt;path d="M5.63635 53V6.45454H11.2727V48H32.9091V53H5.63635Z"/&amp;gt;
&amp;lt;path d="M79.0966 29.7273C79.0966 34.6364 78.2102 38.8788 76.4375 42.4545C74.6648 46.0303 72.2329 48.7879 69.142 50.7273C66.0511 52.6667 62.5208 53.6364 58.5511 53.6364C54.5814 53.6364 51.0511 52.6667 47.9602 50.7273C44.8693 48.7879 42.4375 46.0303 40.6648 42.4545C38.892 38.8788 38.0057 34.6364 38.0057 29.7273C38.0057 24.8182 38.892 20.5758 40.6648 17C42.4375 13.4242 44.8693 10.6667 47.9602 8.72727C51.0511 6.78787 54.5814 5.81818 58.5511 5.81818C62.5208 5.81818 66.0511 6.78787 69.142 8.72727C72.2329 10.6667 74.6648 13.4242 76.4375 17C78.2102 20.5758 79.0966 24.8182 79.0966 29.7273ZM73.642 29.7273C73.642 25.697 72.9678 22.2955 71.6193 19.5227C70.286 16.75 68.4754 14.6515 66.1875 13.2273C63.9148 11.803 61.3693 11.0909 58.5511 11.0909C55.7329 11.0909 53.1799 11.803 50.892 13.2273C48.6193 14.6515 46.8087 16.75 45.4602 19.5227C44.1269 22.2955 43.4602 25.697 43.4602 29.7273C43.4602 33.7576 44.1269 37.1591 45.4602 39.9318C46.8087 42.7045 48.6193 44.803 50.892 46.2273C53.1799 47.6515 55.7329 48.3636 58.5511 48.3636C61.3693 48.3636 63.9148 47.6515 66.1875 46.2273C68.4754 44.803 70.286 42.7045 71.6193 39.9318C72.9678 37.1591 73.642 33.7576 73.642 29.7273Z"/&amp;gt;
&amp;lt;path d="M88.2954 53H82.3864L99.4773 6.45454H105.295L122.386 53H116.477L102.568 13.8182H102.205L88.2954 53ZM90.4773 34.8182H114.295V39.8182H90.4773V34.8182Z"/&amp;gt;
&amp;lt;path d="M144 53H129.636V6.45454H144.636C149.152 6.45454 153.015 7.38636 156.227 9.25C159.439 11.0985 161.901 13.7576 163.614 17.2273C165.326 20.6818 166.182 24.8182 166.182 29.6364C166.182 34.4848 165.318 38.6591 163.591 42.1591C161.864 45.6439 159.348 48.3258 156.045 50.2045C152.742 52.0682 148.727 53 144 53ZM135.273 48H143.636C147.485 48 150.674 47.2576 153.205 45.7727C155.735 44.2879 157.621 42.1742 158.864 39.4318C160.106 36.6894 160.727 33.4242 160.727 29.6364C160.727 25.8788 160.114 22.6439 158.886 19.9318C157.659 17.2045 155.826 15.1136 153.386 13.6591C150.947 12.1894 147.909 11.4545 144.273 11.4545H135.273V48Z"/&amp;gt;
&amp;lt;path d="M181.273 6.45454V53H175.636V6.45454H181.273Z"/&amp;gt;
&amp;lt;path d="M229.483 6.45454V53H224.028L198.665 16.4545H198.21V53H192.574V6.45454H198.028L223.483 43.0909H223.937V6.45454H229.483Z"/&amp;gt;
&amp;lt;path d="M272.58 21C272.08 19.4697 271.42 18.0985 270.602 16.8864C269.799 15.6591 268.837 14.6136 267.716 13.75C266.61 12.8864 265.352 12.2273 263.943 11.7727C262.534 11.3182 260.989 11.0909 259.307 11.0909C256.549 11.0909 254.042 11.803 251.784 13.2273C249.526 14.6515 247.731 16.75 246.398 19.5227C245.064 22.2955 244.398 25.697 244.398 29.7273C244.398 33.7576 245.072 37.1591 246.42 39.9318C247.769 42.7045 249.595 44.803 251.898 46.2273C254.201 47.6515 256.792 48.3636 259.67 48.3636C262.337 48.3636 264.686 47.7955 266.716 46.6591C268.761 45.5076 270.352 43.8864 271.489 41.7955C272.64 39.6894 273.216 37.2121 273.216 34.3636L274.943 34.7273H260.943V29.7273H278.67V34.7273C278.67 38.5606 277.852 41.8939 276.216 44.7273C274.595 47.5606 272.352 49.7576 269.489 51.3182C266.64 52.8636 263.367 53.6364 259.67 53.6364C255.549 53.6364 251.928 52.6667 248.807 50.7273C245.701 48.7879 243.276 46.0303 241.534 42.4545C239.807 38.8788 238.943 34.6364 238.943 29.7273C238.943 26.0454 239.436 22.7348 240.42 19.7954C241.42 16.8409 242.83 14.3258 244.648 12.25C246.466 10.1742 248.617 8.58333 251.102 7.47727C253.587 6.37121 256.322 5.81818 259.307 5.81818C261.761 5.81818 264.049 6.18939 266.17 6.93181C268.307 7.65908 270.208 8.69696 271.875 10.0454C273.557 11.3788 274.958 12.9773 276.08 14.8409C277.201 16.6894 277.973 18.7424 278.398 21H272.58Z"/&amp;gt;
&amp;lt;/mask&amp;gt;
&amp;lt;path d="M5.63635 53V6.45454H11.2727V48H32.9091V53H5.63635Z" stroke="white" stroke-width="10" mask="url(#path-1-outside-1_1_6)"/&amp;gt;
&amp;lt;path d="M79.0966 29.7273C79.0966 34.6364 78.2102 38.8788 76.4375 42.4545C74.6648 46.0303 72.2329 48.7879 69.142 50.7273C66.0511 52.6667 62.5208 53.6364 58.5511 53.6364C54.5814 53.6364 51.0511 52.6667 47.9602 50.7273C44.8693 48.7879 42.4375 46.0303 40.6648 42.4545C38.892 38.8788 38.0057 34.6364 38.0057 29.7273C38.0057 24.8182 38.892 20.5758 40.6648 17C42.4375 13.4242 44.8693 10.6667 47.9602 8.72727C51.0511 6.78787 54.5814 5.81818 58.5511 5.81818C62.5208 5.81818 66.0511 6.78787 69.142 8.72727C72.2329 10.6667 74.6648 13.4242 76.4375 17C78.2102 20.5758 79.0966 24.8182 79.0966 29.7273ZM73.642 29.7273C73.642 25.697 72.9678 22.2955 71.6193 19.5227C70.286 16.75 68.4754 14.6515 66.1875 13.2273C63.9148 11.803 61.3693 11.0909 58.5511 11.0909C55.7329 11.0909 53.1799 11.803 50.892 13.2273C48.6193 14.6515 46.8087 16.75 45.4602 19.5227C44.1269 22.2955 43.4602 25.697 43.4602 29.7273C43.4602 33.7576 44.1269 37.1591 45.4602 39.9318C46.8087 42.7045 48.6193 44.803 50.892 46.2273C53.1799 47.6515 55.7329 48.3636 58.5511 48.3636C61.3693 48.3636 63.9148 47.6515 66.1875 46.2273C68.4754 44.803 70.286 42.7045 71.6193 39.9318C72.9678 37.1591 73.642 33.7576 73.642 29.7273Z" stroke="white" stroke-width="10" mask="url(#path-1-outside-1_1_6)"/&amp;gt;
&amp;lt;path d="M88.2954 53H82.3864L99.4773 6.45454H105.295L122.386 53H116.477L102.568 13.8182H102.205L88.2954 53ZM90.4773 34.8182H114.295V39.8182H90.4773V34.8182Z" stroke="white" stroke-width="10" mask="url(#path-1-outside-1_1_6)"/&amp;gt;
&amp;lt;path d="M144 53H129.636V6.45454H144.636C149.152 6.45454 153.015 7.38636 156.227 9.25C159.439 11.0985 161.901 13.7576 163.614 17.2273C165.326 20.6818 166.182 24.8182 166.182 29.6364C166.182 34.4848 165.318 38.6591 163.591 42.1591C161.864 45.6439 159.348 48.3258 156.045 50.2045C152.742 52.0682 148.727 53 144 53ZM135.273 48H143.636C147.485 48 150.674 47.2576 153.205 45.7727C155.735 44.2879 157.621 42.1742 158.864 39.4318C160.106 36.6894 160.727 33.4242 160.727 29.6364C160.727 25.8788 160.114 22.6439 158.886 19.9318C157.659 17.2045 155.826 15.1136 153.386 13.6591C150.947 12.1894 147.909 11.4545 144.273 11.4545H135.273V48Z" stroke="white" stroke-width="10" mask="url(#path-1-outside-1_1_6)"/&amp;gt;
&amp;lt;path d="M181.273 6.45454V53H175.636V6.45454H181.273Z" stroke="white" stroke-width="10" mask="url(#path-1-outside-1_1_6)"/&amp;gt;
&amp;lt;path d="M229.483 6.45454V53H224.028L198.665 16.4545H198.21V53H192.574V6.45454H198.028L223.483 43.0909H223.937V6.45454H229.483Z" stroke="white" stroke-width="10" mask="url(#path-1-outside-1_1_6)"/&amp;gt;
&amp;lt;path d="M272.58 21C272.08 19.4697 271.42 18.0985 270.602 16.8864C269.799 15.6591 268.837 14.6136 267.716 13.75C266.61 12.8864 265.352 12.2273 263.943 11.7727C262.534 11.3182 260.989 11.0909 259.307 11.0909C256.549 11.0909 254.042 11.803 251.784 13.2273C249.526 14.6515 247.731 16.75 246.398 19.5227C245.064 22.2955 244.398 25.697 244.398 29.7273C244.398 33.7576 245.072 37.1591 246.42 39.9318C247.769 42.7045 249.595 44.803 251.898 46.2273C254.201 47.6515 256.792 48.3636 259.67 48.3636C262.337 48.3636 264.686 47.7955 266.716 46.6591C268.761 45.5076 270.352 43.8864 271.489 41.7955C272.64 39.6894 273.216 37.2121 273.216 34.3636L274.943 34.7273H260.943V29.7273H278.67V34.7273C278.67 38.5606 277.852 41.8939 276.216 44.7273C274.595 47.5606 272.352 49.7576 269.489 51.3182C266.64 52.8636 263.367 53.6364 259.67 53.6364C255.549 53.6364 251.928 52.6667 248.807 50.7273C245.701 48.7879 243.276 46.0303 241.534 42.4545C239.807 38.8788 238.943 34.6364 238.943 29.7273C238.943 26.0454 239.436 22.7348 240.42 19.7954C241.42 16.8409 242.83 14.3258 244.648 12.25C246.466 10.1742 248.617 8.58333 251.102 7.47727C253.587 6.37121 256.322 5.81818 259.307 5.81818C261.761 5.81818 264.049 6.18939 266.17 6.93181C268.307 7.65908 270.208 8.69696 271.875 10.0454C273.557 11.3788 274.958 12.9773 276.08 14.8409C277.201 16.6894 277.973 18.7424 278.398 21H272.58Z" stroke="white" stroke-width="10" mask="url(#path-1-outside-1_1_6)"/&amp;gt;
&amp;lt;/svg&amp;gt;

    &amp;lt;/div&amp;gt;
  )
}
export default Loading;


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

&lt;/div&gt;
&lt;h2&gt;
  
  
  Implementing the Loading Component to the App
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Let's begin with importing the &lt;code&gt;Loading.jsx&lt;/code&gt; into the &lt;code&gt;App.js&lt;/code&gt;
&lt;code&gt;import Loading from "./Loading";&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Now, since a loading screen only appears in the beginning of the render we will make use of &lt;code&gt;React.useState()&lt;/code&gt; and &lt;code&gt;React.useEffect()&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Let's create a local state called &lt;code&gt;loading&lt;/code&gt; initialized to true and use &lt;code&gt;setLoading&lt;/code&gt; to toggle it's value.&lt;/li&gt;
&lt;li&gt;Using &lt;code&gt;useEffect()&lt;/code&gt;and &lt;code&gt;setTimeout()&lt;/code&gt; to change the value of &lt;code&gt;loading&lt;/code&gt; to false.&lt;/li&gt;
&lt;li&gt;After that, we will check if &lt;code&gt;loading&lt;/code&gt; is true we will return &lt;code&gt;&amp;lt;Loading/&amp;gt;&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

import Loading from "./Loading";
import "./styles.css";
import { useEffect, useState } from "react";
export default function App() {
  const [loading, setLoading] = useState(true)
    useEffect(() =&amp;gt; {
        setTimeout(() =&amp;gt; setLoading(false), 3300)
    }, [])
    if (loading) {
        return &amp;lt;Loading/&amp;gt;
    }
  return (
    &amp;lt;div className="App"&amp;gt;
      &amp;lt;h1&amp;gt;Hello&amp;lt;/h1&amp;gt;
    &amp;lt;/div&amp;gt;
  );
}



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

&lt;/div&gt;
&lt;h2&gt;
  
  
  Styling the Page
&lt;/h2&gt;

&lt;p&gt;Let's begin by styling the &lt;code&gt;App.js&lt;/code&gt; and then move on to the Loading component.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Styling the Main App
```
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;body{&lt;br&gt;
  margin:0;&lt;br&gt;
  padding: 0;&lt;br&gt;
  box-sizing: border-box;&lt;br&gt;
}&lt;br&gt;
.App {&lt;br&gt;
  font-family: sans-serif;&lt;br&gt;
  text-align: center;&lt;br&gt;
}&lt;/p&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- Styling the Loader
Now, we will be using the [`stroke-dasharray`](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-dasharray) and [`stroke-dashoffset`](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-dashoffset) property in CSS to animate our SVG. I highly advise learning about this property if you are not familiar with it. Basically, we will be playing the stroke of the individual child path of the SVG.


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

&lt;/div&gt;



&lt;h1&gt;
  
  
  loader-container{
&lt;/h1&gt;

&lt;p&gt;max-width:220px;&lt;br&gt;
  position: absolute;&lt;br&gt;
  top:50%;&lt;br&gt;
  left: 50%;&lt;br&gt;
  transform: translate(-50%,-50%);&lt;br&gt;
}&lt;/p&gt;

&lt;h1&gt;
  
  
  loader path:nth-child(2){
&lt;/h1&gt;

&lt;p&gt;stroke-dasharray: 200%;&lt;br&gt;
  stroke-dashoffset: 200%;&lt;br&gt;
  animation: strokeAnimate 2s  0s  ease forwards;&lt;br&gt;
}&lt;/p&gt;

&lt;h1&gt;
  
  
  loader path:nth-child(3){
&lt;/h1&gt;

&lt;p&gt;stroke-dasharray: 100%;&lt;br&gt;
  stroke-dashoffset: 100%;&lt;br&gt;
  animation: strokeAnimate 2s  0.3s  ease forwards;&lt;br&gt;
}&lt;/p&gt;

&lt;h1&gt;
  
  
  loader path:nth-child(4){
&lt;/h1&gt;

&lt;p&gt;stroke-dasharray: 100%;&lt;br&gt;
  stroke-dashoffset: 100%;&lt;br&gt;
  animation: strokeAnimate 2s  0.9s  ease forwards;&lt;br&gt;
}&lt;/p&gt;

&lt;h1&gt;
  
  
  loader path:nth-child(5){
&lt;/h1&gt;

&lt;p&gt;stroke-dasharray: 100%;&lt;br&gt;
  stroke-dashoffset: 100%;&lt;br&gt;
  animation: strokeAnimate 2s  1.2s  ease forwards;&lt;br&gt;
}&lt;/p&gt;

&lt;h1&gt;
  
  
  loader path:nth-child(6){
&lt;/h1&gt;

&lt;p&gt;stroke-dasharray: 100%;&lt;br&gt;
  stroke-dashoffset: 100%;&lt;br&gt;
  animation: strokeAnimate 2s  1.5s  ease forwards;&lt;br&gt;
}&lt;/p&gt;

&lt;h1&gt;
  
  
  loader path:nth-child(7){
&lt;/h1&gt;

&lt;p&gt;stroke-dasharray: 100%;&lt;br&gt;
  stroke-dashoffset: 100%;&lt;br&gt;
  animation: strokeAnimate 2s  1.8s  ease forwards;&lt;br&gt;
}&lt;/p&gt;

&lt;h1&gt;
  
  
  loader path:nth-child(8){
&lt;/h1&gt;

&lt;p&gt;stroke-dasharray: 100%;&lt;br&gt;
  stroke-dashoffset: 100%;&lt;br&gt;
  animation: strokeAnimate 2s  2.1s  ease forwards;&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;@keyframes strokeAnimate{&lt;br&gt;
  to{&lt;br&gt;
      stroke-dashoffset: 0;&lt;/p&gt;

&lt;p&gt;}&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;&lt;a class="mentioned-user" href="https://dev.to/media"&gt;@media&lt;/a&gt; screen and (max-width: 768px) {&lt;br&gt;
  #loader-container{&lt;br&gt;
      max-width:150px;&lt;br&gt;
  }&lt;br&gt;
  #loader{&lt;br&gt;
      width:150px;&lt;br&gt;
  }&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;&lt;a class="mentioned-user" href="https://dev.to/media"&gt;@media&lt;/a&gt;  screen and (max-width:650px) {&lt;br&gt;
  #loader-container{&lt;br&gt;
      max-width:100px;&lt;br&gt;
  }&lt;br&gt;
  #loader{&lt;br&gt;
      width:100px;&lt;br&gt;
  }&lt;br&gt;
}&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;## Result
&lt;iframe src="https://codesandbox.io/embed/musing-haze-e9gfly"&gt;
&lt;/iframe&gt;


### Final Thoughts
I think this method is pretty slick and easy to create awesome Loading Screens. Do let me know if you have any doubts or facing any problem implementing this. 

Adios Amigo 👋

![Tuco](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t7oq5poteafrau61bkbt.png)

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

&lt;/div&gt;

</description>
      <category>webdev</category>
      <category>howto</category>
      <category>javascript</category>
      <category>ui</category>
    </item>
    <item>
      <title>Web Development: An Introduction to Working with REST APIs and JSON Data</title>
      <dc:creator>Arjun Sharma</dc:creator>
      <pubDate>Thu, 20 Apr 2023 14:38:37 +0000</pubDate>
      <link>https://forem.com/beginarjun/web-development-an-introduction-to-working-with-rest-apis-and-json-data-a4j</link>
      <guid>https://forem.com/beginarjun/web-development-an-introduction-to-working-with-rest-apis-and-json-data-a4j</guid>
      <description>&lt;p&gt;I still remember when I learned about APIs and the possibilities of using them in my projects made my mind boggle. It took me a lot of practice to understand it and I would always face some kind of issues while fetching the API into my web applications. So, I decided to share my knowledge to those who are new and interested in working with APIs.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flmuz7p8q05yegfsoabbm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flmuz7p8q05yegfsoabbm.png" alt="JSON Meme" width="509" height="499"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;With the increasing use of REST APIs and web services in the industry, it's important for developers to have a good understanding of how to work with them. &lt;strong&gt;REST (Representational State Transfer)&lt;/strong&gt; is an architectural style that defines a set of constraints to create web services. JSON (JavaScript Object Notation) is a lightweight data format that is easy to read and write which makes it a personal favorite of all the developers including me 😅. Together, REST APIs and JSON data are essential components of modern web development. In this blog post, we will provide an introduction to working with REST APIs and JSON data, covering the basics of how they work and how to use them.&lt;/p&gt;

&lt;h3&gt;
  
  
  Table Of Contents
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;What are REST APIs&lt;/li&gt;
&lt;li&gt;How do REST APIs work?&lt;/li&gt;
&lt;li&gt;What is JSON data?&lt;/li&gt;
&lt;li&gt;Parsing JSON data with JavaScript&lt;/li&gt;
&lt;li&gt;Retrieving data from a REST API&lt;/li&gt;
&lt;li&gt;Integrating REST APIs into a web application.&lt;/li&gt;
&lt;li&gt;Best Practices for Working with REST APIs and JSON data&lt;/li&gt;
&lt;li&gt;Conclusion&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz0yq1z80uwu52sqfyn0v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz0yq1z80uwu52sqfyn0v.png" alt="Memes-REST-API" width="500" height="543"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  1. What are REST APIs
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Glossary/REST" rel="noopener noreferrer"&gt;REST APIs&lt;/a&gt;&lt;/strong&gt; are a type of web service that uses HTTP requests to access and manipulate data. The data can be in any format, such as HTML, XML, or JSON. The most popular format however is JSON. REST APIs follow a set of constraints, known as the REST architectural style, to create scalable and maintainable web services.&lt;/p&gt;

&lt;p&gt;According to &lt;strong&gt;&lt;a href="https://developer.mozilla.org/" rel="noopener noreferrer"&gt;MDN Web Docs&lt;/a&gt;&lt;/strong&gt;, &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The basic idea of REST is that a resource, e.g. a document, is transferred via well-recognized, language-agnostic, and reliably standardized client/server interactions. Services are deemed RESTful when they adhere to these constraints.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  2. How do REST APIs work?
&lt;/h2&gt;

&lt;p&gt;REST APIs use HTTP requests to perform operations on data. HTTP requests are made up of a URL, an HTTP method (such as &lt;code&gt;GET&lt;/code&gt;, &lt;code&gt;POST&lt;/code&gt;, &lt;code&gt;PUT&lt;/code&gt;, &lt;code&gt;DELETE&lt;/code&gt;), and headers. The HTTP response typically contains a status code, headers, and the requested data in the specified format (such as JSON).&lt;/p&gt;

&lt;h2&gt;
  
  
  3. What is JSON data?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON" rel="noopener noreferrer"&gt;JSON&lt;/a&gt;&lt;/strong&gt; is a lightweight data format that is easy to read and write. It is based on a subset of the JavaScript programming language and is often used to transmit data between a server and a web application. JSON data is stored as key-value pairs, similar to JavaScript objects.&lt;/p&gt;

&lt;p&gt;An Example of JSON would be :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
"id": 1,
"name":"Arjun Sharma",
"enrolled":true,
"symptoms":["Coughing","Headache","Body Pain","Nausea"]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  4. Parsing JSON data with JavaScript
&lt;/h2&gt;

&lt;p&gt;When I was learning about JSON, I would always forget to parse them and would spend hours trying to figure out what went wrong and why I am getting &lt;code&gt;[object Object]&lt;/code&gt; instead of some useful data, only to find my dumb mistake.&lt;br&gt;
To work with JSON data in JavaScript, you need to parse it into a JavaScript object.This can be done using the built-in &lt;code&gt;JSON.parse()&lt;/code&gt; method. Here's an example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const jsonData='{"name":"Katy","age":30,"city":"Ohio"}'
const obj=JSON.parse(jsonData)
console.log(obj.city)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  5. Retrieving data from a REST API
&lt;/h2&gt;

&lt;p&gt;To retrieve data from a &lt;strong&gt;REST API&lt;/strong&gt;, you need to make an HTTP request using the appropriate HTTP method (usually &lt;code&gt;GET&lt;/code&gt;). Here's an example using the &lt;strong&gt;Fetch API&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;fetch('https://api.example.com/data')
  .then(response =&amp;gt; response.json())
  .then(data =&amp;gt; console.log(data))
  .catch(error =&amp;gt; console.error(error));
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note :&lt;/strong&gt; &lt;em&gt;You could also use &lt;strong&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest" rel="noopener noreferrer"&gt;XMLHttpRequest(XHR)&lt;/a&gt;&lt;/strong&gt; to retrieve data from a REST API but, I would advice not using it in your web applications ( but would recommend trying it out just to learn about it). You could research more on why the &lt;code&gt;fetch()&lt;/code&gt; method is preferred instead of &lt;code&gt;XMLHttpRequest()&lt;/code&gt;.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  6. Integrating REST APIs into a web application
&lt;/h2&gt;

&lt;p&gt;To integrate a &lt;strong&gt;REST API&lt;/strong&gt; into a web application, you need to make HTTP requests to the API and &lt;em&gt;parse&lt;/em&gt; the &lt;strong&gt;JSON&lt;/strong&gt; data. Here's an example of a web application that retrieves and displays data from a &lt;strong&gt;REST API&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;Web App&amp;lt;/title&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;div id="data"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;script&amp;gt;
      fetch('https://api.example.com/data')
        .then(response =&amp;gt; response.json())
        .then(data =&amp;gt; {
          const element = document.getElementById('data');
          element.innerHTML = `Name: ${data.name}, Age: ${data.age}, City: ${data.city}
data.name}&amp;lt;br&amp;gt;Age: ${data.age}&amp;lt;br&amp;gt;City: ${data.city}`;
})
.catch(error =&amp;gt; console.error(error));
&amp;lt;/script&amp;gt;

  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, the web application retrieves data from the URL &lt;code&gt;https://api.example.com/data&lt;/code&gt; and displays it in an HTML element with the ID 'data'. The data is parsed using the &lt;code&gt;response.json()&lt;/code&gt; method, and the JavaScript template literal syntax is used to format the data into an HTML string.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Best Practices for Working with REST APIs and JSON data
&lt;/h2&gt;

&lt;p&gt;When working with &lt;strong&gt;REST APIs&lt;/strong&gt; and &lt;strong&gt;JSON&lt;/strong&gt; data, it's important to follow best practices to ensure that your web application is &lt;em&gt;secure, scalable, and maintainable&lt;/em&gt;. Here are some best practices to keep in mind:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Use HTTPS to ensure secure communication between the web application and the API.&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Validate user input to prevent malicious attacks such as SQL injection.&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Use pagination to limit the amount of data returned by the API and improve performance.&lt;/em&gt;
-_ Cache API responses to reduce the number of HTTP requests and improve performance._&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Handle errors gracefully by displaying user-friendly error messages and logging errors for debugging purposes.&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  8. Conclusion
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftqb1b8m72zpgixvkagiu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftqb1b8m72zpgixvkagiu.png" alt="post-conclusion" width="600" height="770"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this blog post, we provided an introduction to working with &lt;strong&gt;REST APIs&lt;/strong&gt; and &lt;strong&gt;JSON&lt;/strong&gt; data in web development. We covered the basics of how &lt;strong&gt;REST APIs&lt;/strong&gt; work, how to parse &lt;strong&gt;JSON&lt;/strong&gt; data with JavaScript, how to retrieve data from a &lt;strong&gt;REST API&lt;/strong&gt;, and how to integrate REST APIs into a web application. We also discussed best practices for working with &lt;strong&gt;REST APIs&lt;/strong&gt; and &lt;strong&gt;JSON&lt;/strong&gt; data. By following these best practices, you can ensure that your web application is &lt;em&gt;secure, scalable, and maintainable&lt;/em&gt;.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>beginners</category>
      <category>javascript</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>ReactJS Best Practices: Tips and Tricks for Writing Better Code</title>
      <dc:creator>Arjun Sharma</dc:creator>
      <pubDate>Wed, 19 Apr 2023 18:48:45 +0000</pubDate>
      <link>https://forem.com/beginarjun/reactjs-best-practices-tips-and-tricks-for-writing-better-code-aaf</link>
      <guid>https://forem.com/beginarjun/reactjs-best-practices-tips-and-tricks-for-writing-better-code-aaf</guid>
      <description>&lt;p&gt;ReactJS is a popular JavaScript library for building user interfaces. As with any technology, there are certain best practices that can help you write clean, efficient, and maintainable code when working with ReactJS. In this post, we will explore some practical tips and tricks for writing better code in ReactJS.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Use functional components and hooks:
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftohax4z3ksnju179fd4o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftohax4z3ksnju179fd4o.png" alt="ReactJS Components Hooks" width="500" height="454"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;React introduced hooks in version 16.8 which allows us to use state and other React features in functional components. Functional components are easier to read and test than class components, so it's a good idea to use them whenever possible. Additionally, functional components can help to reduce the amount of boilerplate code and make it easier to follow best practices such as keeping components small and focused.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Keep your components small and focused:
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fycjecgvxvirjjaefo460.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fycjecgvxvirjjaefo460.png" alt="ReactJS-Meme" width="420" height="320"&gt;&lt;/a&gt;&lt;br&gt;
 It’s easier to understand, test, and reuse small components that do one thing well. Try to break down your UI into small, reusable components that each have a single responsibility. By breaking down the user interface into small, reusable components, developers can create modular and maintainable code. Additionally, small components are easier to debug and optimize, as their behavior is more predictable and their scope is limited. Overall, using small and focused components can result in cleaner and more efficient code.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Use PropTypes for type checking:
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8sf876sjhgbjzi04uw4z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8sf876sjhgbjzi04uw4z.png" alt="Props Meme" width="546" height="457"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://legacy.reactjs.org/docs/typechecking-with-proptypes.html"&gt;PropTypes&lt;/a&gt; allow you to specify the types of props that a component should receive. This can help catch errors during development and make your code more readable. If a prop is passed to the component with an incorrect type, a warning will be displayed in the console during development. This can help developers to quickly identify and fix issues. Additionally, by specifying the expected prop types, developers can make their code more readable and easier to understand for others.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Write tests:
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fawdtn7j80k43ix1pbjry.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fawdtn7j80k43ix1pbjry.png" alt="reactjs test" width="625" height="795"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Writing tests for your components can help you catch errors early and ensure that your code is working as expected. There are several testing libraries available for React, such as &lt;a href="https://jestjs.io/"&gt;Jest&lt;/a&gt; and &lt;a href="https://testing-library.com/docs/react-testing-library/intro/"&gt;React Testing Library&lt;/a&gt;. By writing tests, developers can have confidence that their code is reliable and will function correctly when deployed. Additionally, tests can help to prevent regressions when changes are made to the codebase. By running tests after making changes, developers can quickly identify and fix any issues that may have been introduced. Overall, writing tests can save time and effort in the long run and result in higher quality code.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Go through the Documentation at least once:
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fby7cilkrqdnt4i84g87k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fby7cilkrqdnt4i84g87k.png" alt="ReactJS Doc Memes" width="480" height="469"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Going through the documentation at least once is a best practice for any technology, including &lt;a href="https://legacy.reactjs.org/docs/getting-started.html"&gt;ReactJS&lt;/a&gt;. The documentation provides a comprehensive guide to the features and capabilities of the technology. By reading the documentation, developers can gain a better understanding of how to use ReactJS effectively and avoid common pitfalls. Additionally, the documentation often includes examples and tutorials that can help developers get started quickly. By taking the time to read the documentation, developers can save time and effort in the long run and produce higher quality code.&lt;/p&gt;

&lt;p&gt;Hope you gained something useful from this post 👋&lt;/p&gt;

</description>
      <category>react</category>
      <category>webdev</category>
      <category>beginners</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
