<?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" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Subash Natrayan R M on Medium]]></title>
        <description><![CDATA[Stories by Subash Natrayan R M on Medium]]></description>
        <link>https://medium.com/@subashnatrayan28?source=rss-657a21b28993------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*S9WYg88Adsak6yTojnM49A.jpeg</url>
            <title>Stories by Subash Natrayan R M on Medium</title>
            <link>https://medium.com/@subashnatrayan28?source=rss-657a21b28993------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 22:06:32 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@subashnatrayan28/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[‍⏩ Building a FastAPI User Management System with MongoDB]]></title>
            <link>https://medium.com/@subashnatrayan28/building-a-fastapi-user-management-system-with-mongodb-9152541d7b68?source=rss-657a21b28993------2</link>
            <guid isPermaLink="false">https://medium.com/p/9152541d7b68</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[fastapi]]></category>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[full-stack]]></category>
            <dc:creator><![CDATA[Subash Natrayan R M]]></dc:creator>
            <pubDate>Thu, 27 Nov 2025 16:37:15 GMT</pubDate>
            <atom:updated>2025-11-27T16:47:44.218Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="https://fastapi.tiangolo.com/" src="https://cdn-images-1.medium.com/max/1024/1*UGgf4ZXqBWOtDCNb6jTt8A.png" /><figcaption><a href="https://fastapi.tiangolo.com/">FastAPI</a></figcaption></figure><h3>Building a FastAPI User Management System with MongoDB</h3><p>Instead of just talking theory, let’s actually <em>create something practical</em> — a full <strong>User Management CRUD system.</strong></p><p>This small project will show you exactly how FastAPI fits into real development, both in <strong>development mode</strong> and <strong>production mode</strong>.</p><h3>🌱 Before We Start: What We’re Building</h3><p>We’re creating a <strong>User Management API</strong> with:</p><ul><li>FastAPI (API Framework)</li><li>MongoDB (Database)</li><li>Pydantic (Schema validation)</li><li>Motor (Async MongoDB driver)</li></ul><p>Let’s dive in.</p><h3>Project Structure — Start Clean, Stay Clean</h3><p>Trust me… organizing your folder structure early saves you from a world of pain later.</p><pre>fastapi-users/<br>│── app/<br>│   │── main.py<br>│   │── config.py<br>│   │── database.py<br>│   │── models.py<br>│   │── schemas.py<br>│   │── routes/<br>│   │       └── user.py<br>│── requirements.txt<br>│── .env</pre><h3>Installing Dependencies</h3><pre>pip install fastapi uvicorn motor python-dotenv pydantic[email]</pre><h3>Configuration — Dev &amp; Prod Mode</h3><p>We keep our secrets in .env:</p><pre>MONGO_URI=mongodb://localhost:27017<br>MONGO_DB=fastapi_dev<br>ENV=DEV</pre><p>Your config.py:</p><p>Environment configuration for dev/prod.</p><pre>import os<br>from dotenv import load_dotenv<br><br>load_dotenv()<br>class Settings:<br>    MONGO_URI: str = os.getenv(&quot;MONGO_URI&quot;)<br>    DATABASE_NAME: str = os.getenv(&quot;MONGO_DB&quot;)<br>    ENV: str = os.getenv(&quot;ENV&quot;, &quot;DEV&quot;)<br>settings = Settings()</pre><p>This file separates dev and production environments.</p><p>Production just switches:</p><pre>MONGO_DB=fastapi_prod<br>ENV=PROD</pre><h3>Database Connection (Motor)</h3><p>database.py:</p><p>Database connection setup for MongoDB</p><pre>from motor.motor_asyncio import AsyncIOMotorClient<br>from .config import settings<br><br>client = AsyncIOMotorClient(settings.MONGO_URI)<br>db = client[settings.DATABASE_NAME]</pre><p>This file is the “bridge” between FastAPI and MongoDB.</p><h3>5. User Schema — The Heart of the System</h3><p>schemas.py:</p><p>Defines your Pydantic models for input/output validation.</p><pre>from pydantic import BaseModel, EmailStr<br><br>class User(BaseModel):<br>    name: str<br>    email: EmailStr<br>    age: int<br>class UserUpdate(BaseModel):<br>    name: str | None = None<br>    age: int | None = None</pre><p>This file protects your API from invalid data and forces consistency.</p><h3>CRUD Routes — The Magic Happens Here</h3><p>routes/user.py:</p><p>Contains all API endpoints related to user management.</p><pre>from fastapi import APIRouter, HTTPException<br>from bson import ObjectId<br>from ..database import db<br>from ..schemas import User, UserUpdate<br><br>router = APIRouter()<br>@router.post(&quot;/&quot;)<br>async def create_user(user: User):<br>    user_dict = user.dict()<br>    new_user = await db.users.insert_one(user_dict)<br>    return {&quot;id&quot;: str(new_user.inserted_id), **user_dict}<br>@router.get(&quot;/&quot;)<br>async def get_users():<br>    users = await db.users.find().to_list(100)<br>    return [{**u, &quot;_id&quot;: str(u[&quot;_id&quot;])} for u in users]<br>@router.get(&quot;/{user_id}&quot;)<br>async def get_user(user_id: str):<br>    user = await db.users.find_one({&quot;_id&quot;: ObjectId(user_id)})<br>    if not user:<br>        raise HTTPException(404, &quot;User not found&quot;)<br>    user[&quot;_id&quot;] = str(user[&quot;_id&quot;])<br>    return user<br>@router.put(&quot;/{user_id}&quot;)<br>async def update_user(user_id: str, data: UserUpdate):<br>    update_data = {k: v for k, v in data.dict().items() if v is not None}<br>    await db.users.update_one({&quot;_id&quot;: ObjectId(user_id)}, {&quot;$set&quot;: update_data})<br>    return {&quot;message&quot;: &quot;User updated&quot;}<br>@router.delete(&quot;/{user_id}&quot;)<br>async def delete_user(user_id: str):<br>    await db.users.delete_one({&quot;_id&quot;: ObjectId(user_id)})<br>    return {&quot;message&quot;: &quot;User deleted&quot;}</pre><p>This file is basically your “controller” — the API layer your frontend will call.</p><h3>Main Application</h3><p>main.py:</p><p>Entry point of your FastAPI application.</p><pre>from fastapi import FastAPI<br>from .routes import user<br><br>app = FastAPI()<br>app.include_router(user.router, prefix=&quot;/users&quot;, tags=[&quot;Users&quot;])</pre><p>Think of <strong>main.py</strong> as your app’s “front gate”.</p><p>Run it:</p><pre>uvicorn app.main:app --reload</pre><p>Open:</p><pre>http://localhost:8000/docs</pre><p>Enjoy your <strong>beautiful auto-generated API interface</strong> 😎</p><h3>Final Thoughts — The Dev Journey That Changes You</h3><p>Here’s the truth:<br>building CRUD is not just “CRUD”.<br>It’s the moment your backend brain finally wakes up.<br>It’s the moment the scattered pieces come together and you finally whisper:</p><p><em>“Okay… I know what I’m doing now.”</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9152541d7b68" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[❄️Animated Icons: When a Tiny Detail Catches Your Eye]]></title>
            <link>https://medium.com/@subashnatrayan28/%EF%B8%8Fanimated-icons-when-a-tiny-detail-catches-your-eye-8e1594737cdc?source=rss-657a21b28993------2</link>
            <guid isPermaLink="false">https://medium.com/p/8e1594737cdc</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[ui]]></category>
            <category><![CDATA[ux]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Subash Natrayan R M]]></dc:creator>
            <pubDate>Sun, 23 Nov 2025 10:04:44 GMT</pubDate>
            <atom:updated>2025-11-23T10:04:44.791Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="https://gradienty.codes/pattern-backgrounds" src="https://cdn-images-1.medium.com/max/1024/1*96UexwgYAhZeAyG4GWtiXQ.png" /></figure><p>You know that moment when you’re researching something <em>completely unrelated</em>…<br> Scrolling, scanning, half-focused, half-tired…</p><p>And suddenly — <strong>boom</strong> — something pops up on the screen that grabs your attention?</p><p>That was me when I accidentally stumbled upon <strong>Gradienty’s Animated Icons</strong>.</p><p>I was just digging through some resources (probably procrastinating if I’m being honest), and this link pops up:<br><a href="https://gradienty.codes/animated-icons">Animated SVG Icons Collection | Beautiful Pre-made Motion Icon Animations | Gradienty</a></p><p>And the moment I clicked it, I literally whispered to myself:<br> <em>“Okay… wait… what is THIS?”</em></p><h3>Animated Gradient Icons?</h3><p>Animated gradient icons are essentially:</p><ul><li>SVG icons</li><li>Wrapped with colorful animated gradients</li><li>Feather-light and performance-friendly</li></ul><p>They aren’t just icons — they’re <em>micro-experiences</em>.<br>The type of UI element that makes someone pause and go:</p><blockquote>“I don’t know why… but this feels nice.”</blockquote><p>And trust me, <em>that</em> reaction is pure gold in UI/UX.</p><h3>Why These Icons Feel So… Alive?</h3><p>Most icons are static yet Functional but Forgettable.</p><p>But these?</p><p>They move.<br> They breathe.<br> They glow.<br> They give your UI a personality without screaming for attention.</p><p>Animated gradients do something interesting to the human eye:<br>they create motion + color variation that feels <em>alive but</em> not distracting.</p><h3><strong>How They Work (In a Developer-Friendly Way)</strong></h3><p>Gradienty Icons is that they don’t overcomplicate things.</p><p>Here’s the rough concept:</p><ol><li><strong>Pick an icon</strong> (SVG based)</li><li><strong>Apply a gradient layer</strong></li><li><strong>Animate the gradient using CSS or SVG animations</strong></li><li><strong>Wrap it in a clean, reusable component</strong></li></ol><p>Something like:</p><pre>&lt;div className=&quot;animated-gradient-icon&quot;&gt;<br>  &lt;svg&gt;...&lt;/svg&gt;<br>&lt;/div&gt;</pre><pre>background: linear-gradient(...);<br>animation: gradient-flow 3s ease infinite;</pre><p>Lightweight. Simple. Elegant.</p><h3>The Moment, It Hit Me…</h3><p>You know the spark I’m talking about — <br>that feeling when you discover something small but inspiring enough to upgrade your entire component system.</p><p>We spend so much time building functionality that we forget to sprinkle <strong>delight</strong>.<br>These icons reminded me that design isn’t just about usability — it’s about <em>feeling</em>.</p><h3>Final Thoughts — A Tiny Detail That Creates Big Emotion</h3><p>Sometimes the things you stumble upon unexpectedly become the exact inspiration your project needed.</p><p>These icons reminded me of a simple truth:</p><blockquote><em>UI isn’t just what users see — <br> it’s what they </em>feel<em>.</em></blockquote><p>And if a small, animated gradient can make someone feel joy for even a second…<br> that’s worth adding to your product.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8e1594737cdc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Sliding Into Smooth UI: My Journey With Vaul (The React Drawer Library That Just Gets You)]]></title>
            <link>https://medium.com/@subashnatrayan28/sliding-into-smooth-ui-my-journey-with-vaul-the-react-drawer-library-that-just-gets-you-e509ca68eff1?source=rss-657a21b28993------2</link>
            <guid isPermaLink="false">https://medium.com/p/e509ca68eff1</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Subash Natrayan R M]]></dc:creator>
            <pubDate>Wed, 19 Nov 2025 17:16:24 GMT</pubDate>
            <atom:updated>2025-11-19T17:16:24.419Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="https://vaul.emilkowal.ski/" src="https://cdn-images-1.medium.com/max/1024/1*NRamVf1BLnpUZOesUE0tYw.png" /><figcaption><a href="https://vaul.emilkowal.ski/">Vaul</a></figcaption></figure><p>You know those rare libraries that you discover by accident, try for fun, and then suddenly wonder…<br> <strong>“Where have you been all my life?”</strong></p><p>That was me with <strong>Vaul</strong> — an elegant drawer component for React built on top of Radix UI primitives. As someone who obsesses over UI smoothness, accessibility, and not having 40 props just to slide a div from the left, Vaul felt like a warm hug from the frontend universe.</p><p>So let me walk you through <strong>what Vaul is</strong>, <strong>how to use it step-by-step</strong>, and a few <strong>bonus features</strong> that made me fall in love with it a little more than I should admit.</p><h3>✒️ What Even Is Vaul?</h3><p>Vaul is a <strong>React drawer library</strong> — but not just any drawer library. It focuses on:</p><p>✔ Smooth transitions<br> ✔ Accessibility (ARIA-friendly)<br> ✔ Opinionated but flexible API<br> ✔ Simple enough for beginners, elegant enough for perfectionists<br> ✔ Mobile-friendly behaviors (like snap points!)</p><p>Think of it as the <strong>drawer component you wish your design system shipped with</strong>.</p><h3>Step-By-Step Implementation</h3><h3>1. Install Vaul</h3><p>This part is straightforward — the “bring me magic” step:</p><pre>npm install vaul<br># or<br>yarn add vaul</pre><p>Take a deep breath… things are about to get clean and pretty.</p><h3>2. Create Your First Drawer</h3><p>Here’s the minimal code that already feels premium:</p><pre>import { Drawer } from &quot;vaul&quot;;<br>export default function App() {<br>  return (<br>    &lt;Drawer.Root&gt;<br>      &lt;Drawer.Trigger className=&quot;button&quot;&gt;Open Drawer&lt;/Drawer.Trigger&gt;<br>        &lt;Drawer.Portal&gt;<br>        &lt;Drawer.Overlay className=&quot;bg-black/40 fixed inset-0&quot; /&gt;<br>        &lt;Drawer.Content className=&quot;bg-white rounded-t-2xl p-6 fixed bottom-0 left-0 right-0&quot;&gt;<br>          &lt;div className=&quot;h-1 w-10 bg-gray-300 rounded mx-auto mb-4&quot; /&gt;<br>          &lt;p&gt;Welcome to Vaul! 🎉&lt;/p&gt;<br>        &lt;/Drawer.Content&gt;<br>      &lt;/Drawer.Portal&gt;<br>    &lt;/Drawer.Root&gt;<br>  );<br>}</pre><p>If you run this, you’ll witness:</p><p>✨ buttery smooth animation<br> ✨ auto-focus management<br> ✨ escape-to-close<br> ✨ mobile-ready dragging behavior</p><p>All without touching a single animation config.</p><h3>3. Adding Snap Points (The Feature That Feels Illegal)</h3><p>This is where Vaul starts acting smarter than it should.</p><p>Snap points let the drawer behave like a mobile bottom sheet — halfway open, fully expanded, etc.</p><pre>&lt;Drawer.Content<br>  snapPoints={[0.2, 0.5, 1]}<br>  activeSnapPoint={0.5}<br>  className=&quot;drawer&quot;<br>&gt;<br>   ...<br>&lt;/Drawer.Content&gt;</pre><p>Imagine the elegance:<br> Your drawer “snaps” to the nearest point as the user drags it.</p><p>Perfect for:</p><ul><li>product detail bottom sheets</li><li>filters</li><li>note-taking apps</li><li>mobile UI where space matters</li></ul><h3>4. Implement a Full-Height Drawer</h3><p>Ever wanted a drawer that feels like a full-screen modal but slides from the bottom?</p><p>Vaul does it gracefully:</p><pre>&lt;Drawer.Content className=&quot;h-[90vh] rounded-t-2xl p-6&quot;&gt;<br>  {/* Your content */}<br>&lt;/Drawer.Content&gt;</pre><p>And boom — your app looks instantly modern.</p><h3>🎁 Bonus Concepts: The Stuff I Wish I Knew Earlier</h3><h3>🔹 1. Vaul + Tailwind = Heaven</h3><p>Vaul doesn’t ship with opinionated styling — meaning your Tailwind classes shine beautifully.</p><p>Simple. Clean. Zero CSS fights.</p><h3>🔹 2. Programmatic Control</h3><p>Want to toggle the drawer from anywhere?</p><pre>const [open, setOpen] = useState(false);<br>&lt;Drawer.Root open={open} onOpenChange={setOpen}&gt;<br>   &lt;Drawer.Trigger /&gt;<br>   &lt;Drawer.Content /&gt;<br>&lt;/Drawer.Root&gt;</pre><p>Useful for:</p><ul><li>opening drawers after a form submission</li><li>onboarding flows</li><li>notifications</li></ul><h3>🔹 3. Nested Drawers (Yes, You Can!)</h3><p>Ever seen apps like Instagram or Uber where drawers open inside other drawers?</p><p>Vaul supports it.</p><p>Just nest &lt;Drawer.Root&gt; inside another — Vaul handles focus + scroll for you.</p><h3>❤️ Why Vaul Hits Different (My Honest Emotional Take)</h3><p>It’s the kind of library that <strong>respects your time</strong> and <strong>makes your UI feel alive</strong>.</p><p>It doesn’t force you into a “do it my way” mindset.<br> It gives you tools, acts elegant by default, and lets you focus on what matters — <br> <strong>building experiences that feel modern, smooth, and intentional.</strong></p><p>If you’re building a tool, an app, or even a portfolio — <br> Vaul is that little secret ingredient you sprinkle on top to make your UI feel premium.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e509ca68eff1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[️ Sonner — The Toast Library That Made My UI Feel Alive]]></title>
            <link>https://medium.com/@subashnatrayan28/%EF%B8%8F-sonner-the-toast-library-that-made-my-ui-feel-alive-cf77452eb2c8?source=rss-657a21b28993------2</link>
            <guid isPermaLink="false">https://medium.com/p/cf77452eb2c8</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Subash Natrayan R M]]></dc:creator>
            <pubDate>Tue, 18 Nov 2025 17:28:22 GMT</pubDate>
            <atom:updated>2025-11-18T17:28:22.585Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="https://sonner.emilkowal.ski/" src="https://cdn-images-1.medium.com/max/1024/1*0VOduMSeNwwMp_xYf_r-iQ.png" /><figcaption><a href="https://sonner.emilkowal.ski/">Sonner</a></figcaption></figure><h3>🌤️ Sonner — The Toast Library That Made My UI Feel Alive</h3><p><em>a developer who accidentally fell in love with an opinionated toast component.</em></p><p>I’ll be honest.<br> I treated toast notifications like a checkbox item.<br> <strong>“Does the app show a popup? Yes? Great. Move on.”</strong></p><p>But then one day, while browsing around for a lightweight, clean, <em>don’t-make-me-style-it-myself</em> toast library, I stumbled across <strong>Sonner</strong>. And it genuinely made me stop and think:</p><blockquote><em>“Why… does this toast feel </em>better<em>?”<br> “Why does it look like the UI is… Clean?”</em></blockquote><p>That’s what this tiny library does to you. It doesn’t shout, doesn’t demand configuration, doesn’t force a design language on you — it just shows up, does the job beautifully, and disappears like a polite ghost.</p><p>Today, let me walk you through Sonner — <strong>from the basics to some juicy bonus features</strong> — the same way I learned it: with a little surprise, a little admiration, and the joy of clean UI magic.</p><h3>What Is Sonner Really? 🌀</h3><p>Sonner is an <em>opinionated toast component for React</em>.<br> And yes — “opinionated” is the keyword. It doesn’t give you a thousand props to tweak because it already knows how good toast should feel.</p><ul><li>Lightweight</li><li>Smooth animations</li><li>Modern UI</li><li>Minimal API</li><li>Works anywhere in your React app</li></ul><p>It’s the toast library that believes simplicity is a feature.</p><h3>Step 1: Installing Sonner 🧑‍💻</h3><p>In your terminal, whisper gently:</p><pre>npm install sonner</pre><p>Or shout aggressively:</p><pre>yarn add sonner</pre><p>Depends on your mood. Sonner won’t judge.</p><h3>Step 2: Drop a &lt;Toaster /&gt; — The Heart of It 🌱</h3><p>In your App.jsx or layout file, place the toaster like it’s the kitchen counter where all toast comes from:</p><pre>import { Toaster } from &quot;sonner&quot;;<br><br>function App() {<br>  return (<br>    &lt;&gt;<br>      &lt;Toaster /&gt;<br>      &lt;YourAppContent /&gt;<br>    &lt;/&gt;<br>  );<br>}</pre><p>That’s it.<br> <em>You just enabled magic.</em></p><h3>Step 3: Your First Toast — and The Moment You Fall in Love ✨</h3><p>Anywhere in your app:</p><pre>import { toast } from &quot;sonner&quot;;<br><br>toast(&quot;Hello, Sonner!&quot;);</pre><p>And boom —<br> A soft, elegant toast fades in… just like a moment of UI clarity.</p><p>You’ll stare at it for a second.<br> You’ll like it.<br> You might even click it again because it looks <em>that</em> good.</p><h3>Step 4: Success, Error, and More 🖌️</h3><p>Sonner gives you variants that feel natural:</p><pre>toast.success(&quot;Profile updated!&quot;);<br>toast.error(&quot;Something went wrong.&quot;);<br>toast.info(&quot;New update available.&quot;);</pre><p>Simple.<br> Beautiful.<br> Effective.</p><h3>Step 5: Toast With Description &amp; Action 🥪</h3><p>Because sometimes just saying “Saved!” is not enough for your user (or for your soul):</p><pre>toast(&quot;Saved&quot;, {<br>  description: &quot;Your settings are safely stored!&quot;,<br>  action: {<br>    label: &quot;Undo&quot;,<br>    onClick: () =&gt; console.log(&quot;Undo clicked!&quot;)<br>  }<br>});</pre><p>Undo buttons on toast.!</p><h3>Step 6: Promise Toasts — My Favorite Feature 🔄</h3><p>This one is emotional.</p><p>There’s something poetic about watching a loading toast transform into a success message like a character arc in a movie.</p><pre>toast.promise(fetch(&quot;/api/data&quot;), {<br>  loading: &quot;Fetching data…&quot;,<br>  success: &quot;Data loaded successfully!&quot;,<br>  error: &quot;Failed to load data&quot;,<br>});</pre><p>No state management.<br> No boilerplate.<br> Just pure async storytelling.</p><h3>Step 7: Custom JSX Toasts (When You Need Extra Spice) 🌶️</h3><p>Sometimes, you want the toast to say more. Or look like more.</p><pre>toast.custom(() =&gt; (<br>  &lt;div style={{ padding: &quot;12px&quot; }}&gt;<br>    &lt;h4&gt;🚀 New Feature!&lt;/h4&gt;<br>    &lt;p&gt;Your dashboard just got an upgrade.&lt;/p&gt;<br>  &lt;/div&gt;<br>));</pre><p>This is how you flex on your teammates.</p><h3>Step 8: Dismissing Toasts (It’s Okay to Let Go) 🤫</h3><p>Three options:</p><pre>toast.dismiss();     // dismiss all<br>toast.dismiss(id);   // dismiss one</pre><p>Just like life…<br> sometimes you need to close all tabs at once.</p><h3>Final Takeaway — Why I Recommend Sonner ✒️</h3><p>Sonner isn’t just another toast library.</p><p>It’s a tiny UI enhancer that adds a surprising amount of polish to your app.<br> It respects your time.<br> It respects your design.<br> And it genuinely makes every day flows feel… nicer.</p><p>If a toast library can make you smile,<br> it’s worth using.</p><p>Stat Now: <a href="https://sonner.emilkowal.ski/">Sonner</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cf77452eb2c8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ When `Controller` Becomes Your Best Friend in React Hook Form]]></title>
            <link>https://medium.com/@subashnatrayan28/when-controller-becomes-your-best-friend-in-react-hook-form-5b88bfe3aa46?source=rss-657a21b28993------2</link>
            <guid isPermaLink="false">https://medium.com/p/5b88bfe3aa46</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[react-hook]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Subash Natrayan R M]]></dc:creator>
            <pubDate>Sun, 14 Sep 2025 06:38:15 GMT</pubDate>
            <atom:updated>2025-09-14T06:38:15.397Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*53ex8Cni60eC2BUuXr3pJQ.jpeg" /></figure><p>There’s this one moment that every developer faces while working with <strong>React Hook Form</strong>: You happily set up your form with useForm and register, everything is smooth, and then—boom—you try to add a fancy UI library like <strong>React Select</strong>, and suddenly, your form validation breaks like a cheap umbrella in a monsoon. 🌧️</p><p>That’s when you meet the real hero of this story: <strong>Controller</strong>.</p><h3>🤔 Why Do We Even Need Controller?</h3><p>Most HTML inputs (&lt;input&gt;, &lt;textarea&gt;, &lt;select&gt;) play very nicely with React Hook Form’s register.</p><pre>&lt;input {…register(“email”)} placeholder=”Email” /&gt;</pre><p>But what about when you’re working with <strong>controlled components</strong> — like React Select, Material UI inputs, or your own custom input with weird props? They don’t expose a simple ref or onChange that RHF expects. Suddenly, register is useless.</p><p>That’s when <strong>Controller</strong> steps in.</p><h3>🦸 Controller to the Rescue</h3><p>Think of Controller as the <strong>bridge</strong> between RHF’s form state and your custom component.</p><p>Here’s a simple example:</p><pre>&lt;Controller<br>  name=&quot;country&quot;<br>  control={control}<br>  defaultValue={null}<br>  render={({ field }) =&gt; (<br>    &lt;Select<br>      {...field}<br>      options={[<br>        { value: &quot;IN&quot;, label: &quot;India&quot; },<br>        { value: &quot;US&quot;, label: &quot;USA&quot; }<br>      ]}<br>    /&gt;<br>  )}<br>/&gt;</pre><p>What’s happening here?</p><ul><li>Controller watches your form state.</li><li>It passes down value, onChange, onBlur, and ref to your component.</li><li>And suddenly, your once uncontrollable React Select is happily living inside RHF’s ecosystem. 🎉</li></ul><p>That’s the <strong>basic superpower</strong> of Controller.</p><h3>⚡ Bonus Concept: Two (or More) Components in One Controller</h3><p>Now here’s where things get exciting. One day, while building a form, I asked myself: <em>“Wait a minute… can I put more than one component inside a single Controller?”</em></p><p>The answer? <strong>Yes.</strong> And it feels like discovering cheat codes in a video game. 🎮</p><h4>Example 1: Full Name as Two Inputs</h4><pre>&lt;Controller<br>  name=&quot;fullName&quot;<br>  control={control}<br>  defaultValue={{ first: &quot;&quot;, last: &quot;&quot; }}<br>  render={({ field }) =&gt; (<br>    &lt;div&gt;<br>      &lt;input<br>        placeholder=&quot;First Name&quot;<br>        value={field.value.first}<br>        onChange={(e) =&gt;<br>          field.onChange({ ...field.value, first: e.target.value })<br>        }<br>      /&gt;<br>      &lt;input<br>        placeholder=&quot;Last Name&quot;<br>        value={field.value.last}<br>        onChange={(e) =&gt;<br>          field.onChange({ ...field.value, last: e.target.value })<br>        }<br>      /&gt;<br>    &lt;/div&gt;<br>  )}<br>/&gt;</pre><p>The form output looks like this:</p><pre>{<br> “fullName”: { “first”: “John”, “last”: “Doe” }<br>}</pre><p>Suddenly, two inputs are bound to one field in your form. No extra hacks. No workarounds. Just clean React Hook Form power.</p><h4>Example 2: Phone Number with Country Code</h4><p>Let’s mix a React Select and an &lt;input&gt; together inside one Controller:</p><pre>&lt;Controller<br>  name=&quot;phone&quot;<br>  control={control}<br>  defaultValue={{ code: &quot;+91&quot;, number: &quot;&quot; }}<br>  render={({ field }) =&gt; (<br>    &lt;div style={{ display: &quot;flex&quot;, gap: &quot;8px&quot; }}&gt;<br>      &lt;Select<br>        value={countryOptions.find((opt) =&gt; opt.value === field.value.code)}<br>        onChange={(val) =&gt;<br>          field.onChange({ ...field.value, code: val.value })<br>        }<br>        options={countryOptions}<br>      /&gt;<br>      &lt;input<br>        placeholder=&quot;Phone number&quot;<br>        value={field.value.number}<br>        onChange={(e) =&gt;<br>          field.onChange({ ...field.value, number: e.target.value })<br>        }<br>      /&gt;<br>    &lt;/div&gt;<br>  )}<br>/&gt;</pre><p>And when the user selects USA and types 1234567890, the form data looks like:</p><pre>{<br> “phone”: { “code”: “+1”, “number”: “1234567890” }<br>}</pre><p>That’s <strong>two components → one field → clean output.</strong> Tell me that doesn’t feel satisfying. 😍</p><h3>❤️ Why This Trick Feels So Good</h3><p>For me, this was more than just a coding trick. It was one of those moments when you realize:</p><blockquote><em>Forms don’t have to be messy. You can keep your schema clean, your UI modern, and your validation strict — without spaghetti code.</em></blockquote><h3>🚀 Final Thoughts</h3><ul><li>Use <strong>register</strong> for simple, native inputs.</li><li>Use <strong>Controller</strong> when you deal with controlled/custom inputs.</li><li>And when you feel brave? Combine multiple components inside a single Controller and watch your form output stay elegant.</li></ul><p>It’s one of those small developer joys that makes React Hook Form feel <strong>magical</strong>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5b88bfe3aa46" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Axios in React: The Joyful Guide to Painless API Calls]]></title>
            <link>https://javascript.plainenglish.io/axios-in-react-the-joyful-guide-to-painless-api-calls-465392ed55b0?source=rss-657a21b28993------2</link>
            <guid isPermaLink="false">https://medium.com/p/465392ed55b0</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Subash Natrayan R M]]></dc:creator>
            <pubDate>Sun, 10 Aug 2025 12:56:04 GMT</pubDate>
            <atom:updated>2025-08-10T12:56:04.104Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V0LNDyGRNwc4vyo5xrPHnQ.jpeg" /><figcaption>taken from CloudSigma</figcaption></figure><blockquote>You know that feeling when you code work on the first try? Yeah, that&#39;s magical spark make’s you wish lasted forever.</blockquote><blockquote>That’s exactly how I felt the first I switched from fetch to Axios. Today, I’m gonna walk you through my Axios Playbook — The one I wish.</blockquote><h3>🍵The First Date: Installing Axios</h3><p>Ah , the first meeting — nothing fancy, Just:</p><pre>npm install axios<br>//or<br>yarn add axios</pre><p>Done. That’s It. No awkward small talk, no unnecessary dressing (configuration ofcourse). Just instant connection.</p><h3>🌃The Hello World Moment</h3><p>You know those API calls with fetch that feels like filling out forms? Axios makes it feel like sending a text and old friend:</p><pre>import axios from &quot;axios&quot;;<br><br>async function loadUsers() {<br>  try {<br>    const res = await axios.get(&quot;https://jsonplaceholder.typicode.com/users&quot;);<br>    console.log(res.data);<br>  } catch (err) {<br>    if (err.response) {<br>      console.error(&quot;Server error:&quot;, err.response.status, err.response.data);<br>    } else if (err.request) {<br>      console.error(&quot;No response received:&quot;, err.request);<br>    } else {<br>      console.error(&quot;Request setup error:&quot;, err.message);<br>    }<br>  }<br>}</pre><p>Run it. Smile. You just made a GET request like that.</p><h3>🏙️Moving in Together (Creating an Axios Instance)</h3><p>There comes a time in every coder — library relationship when you realize: “Let’s make this serious,” you whisper.</p><pre>// src/api/client.js<br>import axios from &quot;axios&quot;;<br><br>const api = axios.create({<br>  baseURL: process.env.REACT_APP_API_BASE_URL || &quot;http://localhost:4000/api&quot;,<br>  timeout: 10000,<br>  headers: { &quot;Content-Type&quot;: &quot;application/json&quot; },<br>});<br><br>export default api;</pre><p>now we have one shared client. Cleaner. Consistent. Like a home you both decorate together.</p><h3>⏳ The “I’ve Got Your Back” Pattern (Cancellation in React)</h3><p>You fetch data, the user navigates away, and suddenly — memory leaks. But Axios? It’s got your back.</p><pre>import { useState, useEffect } from &quot;react&quot;;<br>import api from &quot;../api/client&quot;;<br><br>export default function useUsers() {<br>  const [users, setUsers] = useState([]);<br>  const [loading, setLoading] = useState(true);<br>  const [error, setError] = useState(null);<br><br>  useEffect(() =&gt; {<br>    const controller = new AbortController();<br><br>    async function fetchUsers() {<br>      try {<br>        const { data } = await api.get(&quot;/users&quot;, { signal: controller.signal });<br>        setUsers(data);<br>      } catch (err) {<br>        if (err?.code !== &quot;ERR_CANCELED&quot;) setError(err);<br>      } finally {<br>        setLoading(false);<br>      }<br>    }<br><br>    fetchUsers();<br>    return () =&gt; controller.abort();<br>  }, []);<br><br>  return { users, loading, error };<br>}</pre><p>Smooth. No dangling promises. No broken hearts.</p><h3>🔑 Trust Issues &amp; Tokens (Interceptors)</h3><p>Authenticating APIs is like dating someone paranoid — they ask for proof of who you are every time you talk.<br>Axios interceptors handle that without you typing the same thing a hundred times.</p><pre>import axios from &quot;axios&quot;;<br>const api = axios.create({ /* config */ });<br><br>api.interceptors.request.use(config =&gt; {<br>  const token = localStorage.getItem(&quot;token&quot;);<br>  if (token) config.headers.Authorization = `Bearer ${token}`;<br>  return config;<br>});</pre><p>Boom. Every request now automatically includes your credentials.</p><h3>🧐Bonus Tricks from Experience</h3><p>Now that we’re getting serious, here are the moves that make Axios irresistible:</p><ol><li>Error handling helper<br>Because err.message alone is never enough.</li><li>File uploads with progress — show the user you’re listening.</li><li>Concurrent requests — speed things up like a well-oiled team.</li><li>Retry logic — because we all deserve a second chance.</li><li>TypeScript generics — making sure relationships are type-safe.</li></ol><h3>🎁 My Favorite Snippet Ever: Upload Progress</h3><p>This is that little “wow” moment for your users:</p><pre>async function uploadFile(file, onProgress) {<br>  const form = new FormData();<br>  form.append(&quot;file&quot;, file);<br><br>  const { data } = await api.post(&quot;/upload&quot;, form, {<br>    headers: { &quot;Content-Type&quot;: &quot;multipart/form-data&quot; },<br>    onUploadProgress: e =&gt; {<br>      const percent = Math.round((e.loaded * 100) / e.total);<br>      onProgress?.(percent);<br>    },<br>  });<br>  return data;<br>}</pre><p>Now the “Uploading… 75%” bar is no longer a lie.</p><h3>🧑‍💻Final Thoughts</h3><p>Axios, for me, isn’t just about making HTTP requests.<br>It’s about writing API code that feels effortless.<br>It’s the library that quietly does the heavy lifting so you can focus on building cool stuff — without repeating yourself or adding unnecessary complexity.</p><p>So, if you’re tired of fighting with fetch, give Axios a try.<br>You might just fall in love too.</p><h3>A message from our Founder</h3><p><strong>Hey, </strong><a href="https://linkedin.com/in/sunilsandhu"><strong>Sunil</strong></a><strong> here.</strong> I wanted to take a moment to thank you for reading until the end and for being a part of this community.</p><p>Did you know that our team run these publications as a volunteer effort to over 200k supporters? <strong>We do not get paid by Medium</strong>!</p><p>If you want to show some love, please take a moment to <strong>follow me on </strong><a href="https://linkedin.com/in/sunilsandhu"><strong>LinkedIn</strong></a><strong>, </strong><a href="https://tiktok.com/@messyfounder"><strong>TikTok</strong></a><strong> and </strong><a href="https://instagram.com/sunilsandhu"><strong>Instagram</strong></a>. And before you go, don’t forget to <strong>clap</strong> and <strong>follow</strong> the writer️!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=465392ed55b0" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/axios-in-react-the-joyful-guide-to-painless-api-calls-465392ed55b0">🌃Axios in React: The Joyful Guide to Painless API Calls</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Axios in React: The Joyful Guide to Painless API Calls]]></title>
            <link>https://medium.com/@subashnatrayan28/axios-in-react-the-joyful-guide-to-painless-api-calls-af953acaf65a?source=rss-657a21b28993------2</link>
            <guid isPermaLink="false">https://medium.com/p/af953acaf65a</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Subash Natrayan R M]]></dc:creator>
            <pubDate>Sat, 09 Aug 2025 17:42:54 GMT</pubDate>
            <atom:updated>2025-08-09T17:42:54.599Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V0LNDyGRNwc4vyo5xrPHnQ.jpeg" /><figcaption>taken from CloudSigma</figcaption></figure><blockquote>You know that feeling when you code work on the first try? Yeah, that’s magical spark make’s you wish lasted forever.</blockquote><blockquote>That’s exactly how I felt the first I switched from <em>fetch</em> to Axios. Today, I’m gonna walk you through my Axios Playbook — The one I wish.</blockquote><h3>🍵The First Date: Installing Axios</h3><p>Ah , the first meeting — nothing fancy, Just:</p><pre>npm install axios<br>//or<br>yarn add axios</pre><p>Done. That’s It. No awkward small talk, no unnecessary dressing (configuration ofcourse). Just instant connection.</p><h3>🌃The Hello World Moment</h3><p>You know those API calls with fetch that feels like filling out forms? Axios makes it feel like sending a text and old friend:</p><pre>import axios from &quot;axios&quot;;async function loadUsers() {<br>  try {<br>    const res = await axios.get(&quot;https://jsonplaceholder.typicode.com/users&quot;);<br>    console.log(res.data);<br>  } catch (err) {<br>    if (err.response) {<br>      console.error(&quot;Server error:&quot;, err.response.status, err.response.data);<br>    } else if (err.request) {<br>      console.error(&quot;No response received:&quot;, err.request);<br>    } else {<br>      console.error(&quot;Request setup error:&quot;, err.message);<br>    }<br>  }<br>}</pre><p>Run it. Smile. You just made a GET request like that.</p><h3>🏙️Moving in Together (Creating an Axios Instance)</h3><p>There comes a time in every coder — library relationship when you realize: “Let’s make this serious,” you whisper.</p><pre>// src/api/client.js<br>import axios from &quot;axios&quot;;<br>const api = axios.create({<br>  baseURL: process.env.REACT_APP_API_BASE_URL || &quot;http://localhost:4000/api&quot;,<br>  timeout: 10000,<br>  headers: { &quot;Content-Type&quot;: &quot;application/json&quot; },<br>});<br>export default api;</pre><p>now we have one shared client. Cleaner. Consistent. Like a home you both decorate together.</p><h3>⏳ The “I’ve Got Your Back” Pattern (Cancellation in React)</h3><p>You fetch data, the user navigates away, and suddenly — memory leaks. But Axios? It’s got your back.</p><pre>import { useState, useEffect } from &quot;react&quot;;<br>import api from &quot;../api/client&quot;;export default function useUsers() {<br>  const [users, setUsers] = useState([]);<br>  const [loading, setLoading] = useState(true);<br>  const [error, setError] = useState(null);<br>useEffect(() =&gt; {<br>  const controller = new AbortController();<br>async function fetchUsers() {<br>      try {<br>        const { data } = await api.get(&quot;/users&quot;, { signal: controller.signal });<br>        setUsers(data);<br>      } catch (err) {<br>        if (err?.code !== &quot;ERR_CANCELED&quot;) setError(err);<br>      } finally {<br>        setLoading(false);<br>      }<br>    }<br>fetchUsers();<br>    return () =&gt; controller.abort();<br>  }, []);<br>  return { users, loading, error };<br>}</pre><p>Smooth. No dangling promises. No broken hearts.</p><h3>🔑 Trust Issues &amp; Tokens (Interceptors)</h3><p>Authenticating APIs is like dating someone paranoid — they ask for proof of who you are every time you talk.<br>Axios interceptors handle that without you typing the same thing a hundred times.</p><pre>import axios from &quot;axios&quot;;<br>const api = axios.create({ /* config */ });<br>api.interceptors.request.use(config =&gt; {<br>  const token = localStorage.getItem(&quot;token&quot;);<br>  if (token) config.headers.Authorization = `Bearer ${token}`;<br>  return config;<br>});</pre><p>Boom. Every request now automatically includes your credentials.</p><h3>🧐Bonus Tricks from Experience</h3><p>Now that we’re getting serious, here are the moves that make Axios irresistible:</p><ol><li>Error handling helper<br>Because err.message alone is never enough.</li><li>File uploads with progress — show the user you’re listening.</li><li>Concurrent requests — speed things up like a well-oiled team.</li><li>Retry logic — because we all deserve a second chance.</li><li>TypeScript generics — making sure relationships are type-safe.</li></ol><h3>🎁 My Favorite Snippet Ever: Upload Progress</h3><p>This is that little “wow” moment for your users:</p><pre>async function uploadFile(file, onProgress) {<br>  const form = new FormData();<br>  form.append(&quot;file&quot;, file);<br>const { data } = await api.post(&quot;/upload&quot;, form, {<br>    headers: { &quot;Content-Type&quot;: &quot;multipart/form-data&quot; },<br>    onUploadProgress: e =&gt; {<br>      const percent = Math.round((e.loaded * 100) / e.total);<br>      onProgress?.(percent);<br>    },<br>  });<br>  return data;<br>}</pre><p>Now the “Uploading… 75%” bar is no longer a lie.</p><h3>🧑‍💻Final Thoughts</h3><p>Axios, for me, isn’t just about making HTTP requests.<br>It’s about writing API code that feels effortless.<br>It’s the library that quietly does the heavy lifting so you can focus on building cool stuff — without repeating yourself or adding unnecessary complexity.</p><p>So, if you’re tired of fighting with fetch, give Axios a try.<br>You might just fall in love too.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=af953acaf65a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Lazy Loading: Why I Stopped Letting My App Carry the World on Its Back]]></title>
            <link>https://javascript.plainenglish.io/lazy-loading-why-i-stopped-letting-my-app-carry-the-world-on-its-back-11a5d60e3dc0?source=rss-657a21b28993------2</link>
            <guid isPermaLink="false">https://medium.com/p/11a5d60e3dc0</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[optimization]]></category>
            <dc:creator><![CDATA[Subash Natrayan R M]]></dc:creator>
            <pubDate>Wed, 06 Aug 2025 17:59:53 GMT</pubDate>
            <atom:updated>2025-09-14T06:46:13.629Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1TV-zWcodUdxYj_zXW_VjQ.png" /></figure><p>There’s this moment in every developer’s journey where your app feels like a slow, sluggish beast — loading everything at once, bloated with components, image, and routes. You stare your Lighthouse score and silently scream.</p><p>I’ve been there.</p><p>That’s when I met my performance savior: <strong>Lazy Loading</strong>. And trust me, it changed the way I build frontends.</p><p>Let me take you through it, step by step — no jargon jungle, just one dev talking to another.</p><h3>✒️First, What Even <em>Is</em> Lazy Loading?</h3><p>Lazy loading is like calling your Uber only when you’re ready to leave — not the moment you think about going out. You delay the execution of something until it is actually needed.</p><p>Instead of dumping your entire JavaScript bundle (with all your pages, components, and data) into the user’s lap right at the start, you give them only what they need. Just the essential.</p><p>Wonder Why? 🧐</p><p>Because initial load time matters. Every unnecessary byte you send upfront makes your app slower, clunkier and worse on mobile.</p><h3>🧩 Lazy Loading React Components — The Friendly Way</h3><p>Let’s say you’ve got a massive component — Maybe a chart, a dashboard, or a feature that only a fraction of users actually uses.</p><p>Do you really need to ship that with your homepage?</p><p>Nope. Absolutely Not needed. Let’s load it only it’s needed.</p><pre>import React, { Suspense, lazy } from &quot;react&quot;;<br><br>const Dashboard = lazy(() =&gt; import(&quot;./Dashboard&quot;)); //Just a example monster<br><br>function App () {<br>  return (<br>    &lt;div&gt;<br>        &lt;h1&gt; Monster is coming....&lt;/h1&gt;<br>        &lt;Suspense fallback={&lt;p&gt;Wait a minute! Monster....is Loading...&lt;/p&gt;}&gt;      <br>            &lt;Dashboard/&gt;<br>        &lt;/Suspense&gt;<br>     &lt;/div&gt;<br>  );<br>}</pre><p>Boom. You just told React:</p><p>“Hey, don’t worry about Dashboard until I ask for it.”</p><p>And while React is on its way to get it, you give your users something to look at. No awkward blank screens. ✨</p><h3>🖼️ Lazy Loading Images — Because Users Don’t Scroll All at Once</h3><p>Let’s talk about images.</p><p>Ever built a landing page that felt more like a full — blown novel? with 20+ high-res images that took ages to load?</p><p>Here’s the fix:</p><pre>&lt;img src=&quot;big-monsters-image.jpg&quot; loading=&quot;lazy&quot; alt=&quot;Big monster&#39;s Biggest image&quot; /&gt;</pre><p>That’s it. Native lazy loading. The browser handles it for you.</p><p>In React?</p><pre>//In react style 😎<br>&lt;img src=&quot;biggest-monsters-image.jpg&quot; loading=&quot;lazy&quot; alt=&quot;Biggest monster&#39;s Biggest image&quot; /&gt;</pre><p>Why should your user pay the cost of an image they’re never going to scroll to?</p><h3>🌐 Lazy Loading Routes — AKA Code Splitting for the Win</h3><p>Alright, now let’s get spicy. 🌶️</p><p>Let’s say you’re using react-router. Your app has pages. A lot of them. Why load them all upfront?</p><pre>import { lazy, Suspense } from &quot;react&quot;;<br>import { BrowserRouter, Routes, Route } from &quot;react-router-dom&quot;;<br><br>const About = lazy(() =&gt; import(&quot;./pages/About&quot;));<br>const Contact = lazy(() =&gt; import(&quot;./pages/Contact&quot;));<br><br>function App() {<br>  return (<br>    &lt;BrowserRouter&gt;<br>      &lt;Routes&gt;<br>        &lt;Route path=&quot;/&quot; element={&lt;Home /&gt;} /&gt;<br>        &lt;Route<br>          path=&quot;/about&quot;<br>          element={<br>            &lt;Suspense fallback={&lt;div&gt;Loading About...&lt;/div&gt;}&gt;<br>              &lt;About /&gt;<br>            &lt;/Suspense&gt;<br>          }<br>        /&gt;<br>        &lt;Route<br>          path=&quot;/contact&quot;<br>          element={<br>            &lt;Suspense fallback={&lt;div&gt;Loading Contact...&lt;/div&gt;}&gt;<br>              &lt;Contact /&gt;<br>            &lt;/Suspense&gt;<br>          }<br>        /&gt;<br>      &lt;/Routes&gt;<br>    &lt;/BrowserRouter&gt;<br>  );<br>}</pre><p>That’s <strong>code-splitting by route</strong> — you serve only what’s necessary. The rest? They wait until the user walks through the door.</p><h3>🌟 Bonus: Lazy Loading on Scroll (The Intersection Observer Magic)</h3><p>Okay, you love performance. You want to go the extra mile. Let’s get fancy.</p><p>Ever heard of <strong>Intersection Observer API</strong>? It’s how you load stuff only when it’s in the user’s viewport.</p><pre>import { useEffect, useRef, useState } from &quot;react&quot;;<br><br>function LazySection() {<br>  const ref = useRef();<br>  const [showContent, setShowContent] = useState(false);<br><br>  useEffect(() =&gt; {<br>    const observer = new IntersectionObserver(([entry]) =&gt; {<br>      if (entry.isIntersecting) {<br>        setShowContent(true);<br>        observer.disconnect();<br>      }<br>    });<br><br>    observer.observe(ref.current);<br>    return () =&gt; observer.disconnect();<br>  }, []);<br><br>  return (<br>    &lt;div ref={ref}&gt;<br>      {showContent ? &lt;HeavyComponent /&gt; : &lt;div&gt;Loading...&lt;/div&gt;}<br>    &lt;/div&gt;<br>  );<br>}</pre><blockquote>It’s like:<br> <em>“Don’t bother showing up until you’re visible on screen.”</em></blockquote><p>Elegant. Efficient. Superhero-level optimization. 🦸</p><h3>🍩 Final Thoughts: Lazy Loading is Not Just a Feature — It’s a Philosophy</h3><p>Don’t make your app do everything upfront.<br> Let it <strong>breathe</strong>. Let it be <strong>strategic</strong>. Let it say:</p><blockquote><em>“I’ll get to that… when I need to.”</em></blockquote><p>Lazy loading is the art of saying <strong>“Not right now.”</strong></p><p>And sometimes, in a world of eager bundles and bloated pages, that’s exactly what makes your app feel fast, lightweight, and a joy to use.</p><h3>A message from our Founder</h3><p><strong>Hey, </strong><a href="https://linkedin.com/in/sunilsandhu"><strong>Sunil</strong></a><strong> here.</strong> I wanted to take a moment to thank you for reading until the end and for being a part of this community.</p><p>Did you know that our team run these publications as a volunteer effort to over 200k supporters? <strong>We do not get paid by Medium</strong>!</p><p>If you want to show some love, please take a moment to <strong>follow me on </strong><a href="https://linkedin.com/in/sunilsandhu"><strong>LinkedIn</strong></a><strong>, </strong><a href="https://tiktok.com/@messyfounder"><strong>TikTok</strong></a><strong> and </strong><a href="https://instagram.com/sunilsandhu"><strong>Instagram</strong></a>. And before you go, don’t forget to <strong>clap</strong> and <strong>follow</strong> the writer️!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=11a5d60e3dc0" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/lazy-loading-why-i-stopped-letting-my-app-carry-the-world-on-its-back-11a5d60e3dc0">🐌 Lazy Loading: Why I Stopped Letting My App Carry the World on Its Back</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Lazy Loading: Why I Stopped Letting My App Carry the World on Its Back]]></title>
            <link>https://medium.com/@subashnatrayan28/lazy-loading-why-i-stopped-letting-my-app-carry-the-world-on-its-back-3404fee8e9f2?source=rss-657a21b28993------2</link>
            <guid isPermaLink="false">https://medium.com/p/3404fee8e9f2</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Subash Natrayan R M]]></dc:creator>
            <pubDate>Wed, 06 Aug 2025 16:37:31 GMT</pubDate>
            <atom:updated>2025-08-06T16:46:30.961Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*px3mN2prdnU3RuS1-c5lUg.png" /><figcaption>Created with the help of AI</figcaption></figure><p>There’s this moment in every developer’s journey where your app feels like a slow, sluggish beast — loading everything at once, bloated with components, image, and routes. You stare your Lighthouse score and silently scream.</p><p>I’ve been there.</p><p>That’s when I met my performance savior: <strong>Lazy Loading</strong>. And trust me, it changed the way I build frontends.</p><p>Let me take you through it, step by step — no jargon jungle, just one dev talking to another.</p><h3>✒️First, What Even Is Lazy Loading?</h3><p>Lazy loading is like calling your Uber only when you’re ready to leave — not the moment you think about going out. You delay the execution of something until it is actually needed.</p><p>Instead of dumping your entire JavaScript bundle (with all your pages, components, and data) into the user’s lap right at the start, you give them only what they need. Just the essential.</p><p>Wonder Why? 🧐</p><p>Because initial load time matters. Every unnecessary byte you send upfront makes your app slower, clunkier and worse on mobile.</p><h3>🧩 Lazy Loading React Components — The Friendly Way</h3><p>Let’s say you’ve got a massive component — Maybe a chart, a dashboard, or a feature that only a fraction of users actually uses.</p><p>Do you really need to ship that with your homepage?</p><p>Nope. Absolutely Not needed. Let’s load it only it’s needed.</p><pre>import React, { Suspense, lazy } from &quot;react&quot;;<br>const Dashboard = lazy(() =&gt; import(&quot;./Dashboard&quot;)); //Just a example monster<br>function App () {<br>  return (<br>    &lt;div&gt;<br>        &lt;h1&gt; Monster is coming....&lt;/h1&gt;<br>        &lt;Suspense fallback={&lt;p&gt;Wait a minute! Monster....is Loading...&lt;/p&gt;}&gt;      <br>            &lt;Dashboard/&gt;<br>        &lt;/Suspense&gt;<br>     &lt;/div&gt;<br>  );<br>}</pre><p>Boom. You just told React:</p><p>“Hey, don’t worry about Dashboard until I ask for it.”</p><p>And while React is on its way to get it, you give your users something to look at. No awkward blank screens. ✨</p><h3>🖼️ Lazy Loading Images — Because Users Don’t Scroll All at Once</h3><p>Let’s talk about images.</p><p>Ever built a landing page that felt more like a full — blown novel? with 20+ high-res images that took ages to load?</p><p>Here’s the fix:</p><pre>&lt;img src=&quot;big-monsters-image.jpg&quot; loading=&quot;lazy&quot; alt=&quot;Big monster&#39;s Biggest image&quot; /&gt;</pre><p>That’s it. Native lazy loading. The browser handles it for you.</p><p>In React?</p><pre>//In react style 😎<br>&lt;img src=&quot;biggest-monsters-image.jpg&quot; loading=&quot;lazy&quot; alt=&quot;Biggest monster&#39;s Biggest image&quot; /&gt;</pre><p>Why should your user pay the cost of an image they’re never going to scroll to?</p><h3>🌐 Lazy Loading Routes — AKA Code Splitting for the Win</h3><p>Alright, now let’s get spicy. 🌶️</p><p>Let’s say you’re using react-router. Your app has pages. A lot of them. Why load them all upfront?</p><pre>import { lazy, Suspense } from &quot;react&quot;;<br>import { BrowserRouter, Routes, Route } from &quot;react-router-dom&quot;;<br>const About = lazy(() =&gt; import(&quot;./pages/About&quot;));<br>const Contact = lazy(() =&gt; import(&quot;./pages/Contact&quot;));<br>function App() {<br>  return (<br>    &lt;BrowserRouter&gt;<br>      &lt;Routes&gt;<br>        &lt;Route path=&quot;/&quot; element={&lt;Home /&gt;} /&gt;<br>        &lt;Route<br>          path=&quot;/about&quot;<br>          element={<br>            &lt;Suspense fallback={&lt;div&gt;Loading About...&lt;/div&gt;}&gt;<br>              &lt;About /&gt;<br>            &lt;/Suspense&gt;<br>          }<br>        /&gt;<br>        &lt;Route<br>          path=&quot;/contact&quot;<br>          element={<br>            &lt;Suspense fallback={&lt;div&gt;Loading Contact...&lt;/div&gt;}&gt;<br>              &lt;Contact /&gt;<br>            &lt;/Suspense&gt;<br>          }<br>        /&gt;<br>      &lt;/Routes&gt;<br>    &lt;/BrowserRouter&gt;<br>  );<br>}</pre><p>That’s <strong>code-splitting by route</strong> — you serve only what’s necessary. The rest? They wait until the user walks through the door.</p><h3>🌟 Bonus: Lazy Loading on Scroll (The Intersection Observer Magic)</h3><p>Okay, you love performance. You want to go the extra mile. Let’s get fancy.</p><p>Ever heard of <strong>Intersection Observer API</strong>? It’s how you load stuff only when it’s in the user’s viewport.</p><pre>import { useEffect, useRef, useState } from &quot;react&quot;;function LazySection() {<br>  const ref = useRef();<br>  const [showContent, setShowContent] = useState(false); useEffect(() =&gt; {<br>    const observer = new IntersectionObserver(([entry]) =&gt; {<br>      if (entry.isIntersecting) {<br>        setShowContent(true);<br>        observer.disconnect();<br>      }<br>    });<br><br>    observer.observe(ref.current);<br>    return () =&gt; observer.disconnect();<br>  }, []);<br>  <br>return (<br>    &lt;div ref={ref}&gt;<br>      {showContent ? &lt;HeavyComponent /&gt; : &lt;div&gt;Loading...&lt;/div&gt;}<br>    &lt;/div&gt;<br>  );<br>}</pre><blockquote>It’s like:<br> <em>“Don’t bother showing up until you’re visible on screen.”</em></blockquote><p>Elegant. Efficient. Superhero-level optimization. 🦸</p><h3>🍩 Final Thoughts: Lazy Loading is Not Just a Feature — It’s a Philosophy</h3><p>Don’t make your app do everything upfront.<br> Let it <strong>breathe</strong>. Let it be <strong>strategic</strong>. Let it say:</p><blockquote><em>“I’ll get to that… when I need to.”</em></blockquote><p>Lazy loading is the art of saying <strong>“Not right now.”</strong></p><p>And sometimes, in a world of eager bundles and bloated pages, that’s exactly what makes your app feel fast, lightweight, and a joy to use.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3404fee8e9f2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ I Found My New Favorite Way to Manage State: Jotai is Magic in Atoms!]]></title>
            <link>https://javascript.plainenglish.io/i-found-my-new-favorite-way-to-manage-state-jotai-is-magic-in-atoms-54265bf05f92?source=rss-657a21b28993------2</link>
            <guid isPermaLink="false">https://medium.com/p/54265bf05f92</guid>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Subash Natrayan R M]]></dc:creator>
            <pubDate>Thu, 31 Jul 2025 23:44:33 GMT</pubDate>
            <atom:updated>2025-07-31T23:44:33.539Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Vvu2wlE0ZI3oOB3-FzAd_A.jpeg" /></figure><blockquote>“Every Day I code, Learn something new. And somedays, I begin to wonder and stumble upon something that completely stuns me and changes the way I think”</blockquote><blockquote>-A dev, sipping coffee and smiling at their screen.</blockquote><h3>💥So, what’s the Blast Today?</h3><p>You know the joy when you create something, run it and it just works? yeah, that’s a type of feel that I felt every single day. A latest feeling has been unlocked by Learing Jotai.<br>It’s not just another state management library. It’s a whole mood. Lightweight, expressive, and atomic to the core. 😅</p><p>I didn’t go looking for it with checklist. I just wanted to manage my app’s state without turning my component tree into spaghetti. One blog, one example late…. I was all in.</p><h3>🌀Okay, But Jotai…? 🧐</h3><p>Let’s talk about Jotai the atomic! ⚛️</p><p>Imagine useState , but global.</p><p>Imagine useReducer , but without reducers. I can see you’re faces are changing! But the magic begins from now.</p><p>At its core:</p><ul><li>Every piece of state is an atom.</li><li>you can read and write atom from any component.</li><li>Components only re-render when the atoms they use change.</li><li>All this with just a 3kb library, And Yes it is !!!! The atomic.</li></ul><h3>⚡ Let’s Build Something: The Jotai-Powered Todo App</h3><p>This wasn’t a million dollar project. Just a quick idea:</p><p>A little Todo app where I could add delete, toggle tasks. But with jotai, the journey was almost poetic and will be heroic.</p><h4>🧩 Step 1: Declare Your Atom</h4><p>This will be your global state (“The atomic” — just for fun(registered)). Bit like, without the drama.</p><pre>import {atom} from &#39;jotai&#39; ; <br><br>export const todoAtom = atom&lt;Todo[]&gt;([]);</pre><p>Simple. No store setup. No provider wrapping. Just import and go.</p><h4>Step 2: Use It Like Magic ✨</h4><p>in your component, you will be doing:</p><pre>const [todos, setTodos] = useAtom(todoAtom);</pre><p>Boooom! You can now read and write to your app’s state from anywhere. the useAtom() hook give you both the access. Just like useState . But better. The atomic access!</p><p>I remember pausing at this point, sipping my hot coffee and thinking,</p><p>“Wait a minute, That’s it? That’s all I need?? What the ?…… stunned for a while…….” few moments later “Ohhhhh!”.</p><h3>🌄Real Moment: When I Connected Everything Up…</h3><p>I was typing and testing the app — addTodo, TodoList, TodoItem.</p><p>And every click felt like a win.</p><p>No re-renders I didn’t as for. Not state dancing through props. Just components reading their own atoms, like independent little workers.</p><blockquote>The feeling? It was like writing music with clean instruments.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*OXwB6BDxpIzJi9sC-M4Ehg.gif" /><figcaption>Not this Atomic but It is! The Atomic!!!</figcaption></figure><h3>🔮 Bonus Magic: Derived Atoms</h3><p>At this point I was already done for. but then I found this gem:</p><pre>export const completedCountAtom = atom ((get) =&gt; get(todosAtom)<br>.filter((t) =&gt; t.done).length<br>);</pre><p>No events. No state double action. No Maths. Just The atomic.</p><p>Jotai just derives values from other atoms like a real pro.</p><p>This. This is elegance.</p><h3>💾 Want Persistence? It’s Built In.</h3><p>I learned about the atomWithStorage , and it took me 10 seconds to make my todos survive refreshed.</p><pre>import { atomWithStorage } from &#39;jotai/utils&#39;;<br><br>export const themeAtom = atomWithStorage(&#39;theme&#39;, &#39;light&#39;);</pre><p>What.. is.. this.. Sorcery?!</p><h3>🧑‍💻The Dev Experience? 10/10</h3><p>I felt like I wasn’t just using a library — I was <strong>speaking to my UI</strong>, one atom at a time.</p><p>Here’s why it stuck:</p><ul><li>✅ Intuitive like useState, but <strong>scales like a champ</strong>.</li><li>🧠 Think in pieces — each atom is a <strong>micro-universe</strong>.</li><li>💚 Less rerenders, faster UI, and <strong>predictable</strong> updates.</li></ul><h3>💭 Closing Thoughts: I’m Not Replacing. I’m Evolving.</h3><p>I didn’t “switch” anything overnight.<br>But the more I explore, the more I feel like I’m <strong>growing</strong>.<br>Every day I code, I learn something new — and <strong>Jotai</strong>? It’s one of those tools that makes you stop and appreciate how far frontend development has come.</p><p>If you haven’t tried it yet, take 10 minutes. Build a small app.<br>Feel the clarity. Feel the joy. Feel the Atomic!!<br>And then maybe — just maybe — you’ll fall in love with <strong>atoms</strong> like I did. And the Universe! That’s It.</p><blockquote>Dream more! Create more! and Live!</blockquote><blockquote>-A dev, smiling at their screen with sleepy eyes.</blockquote><h3>Thank you for being a part of the community</h3><p><em>Before you go:</em></p><ul><li>Be sure to <strong>clap</strong> and <strong>follow</strong> the writer ️👏️<strong>️</strong></li><li>Follow us: <a href="https://x.com/inPlainEngHQ"><strong>X</strong></a> | <a href="https://www.linkedin.com/company/inplainenglish/"><strong>LinkedIn</strong></a> | <a href="https://www.youtube.com/@InPlainEnglish"><strong>YouTube</strong></a> | <a href="https://newsletter.plainenglish.io/"><strong>Newsletter</strong></a> | <a href="https://open.spotify.com/show/7qxylRWKhvZwMz2WuEoua0"><strong>Podcast</strong></a> | <a href="https://twitch.tv/inplainenglish"><strong>Twitch</strong></a></li><li><a href="https://differ.blog/"><strong>Start your own free AI-powered blog on Differ</strong></a> 🚀</li><li><a href="https://discord.gg/in-plain-english-709094664682340443"><strong>Join our content creators community on Discord</strong></a> 🧑🏻‍💻</li><li>For more content, visit <a href="https://plainenglish.io/"><strong>plainenglish.io</strong></a> + <a href="https://stackademic.com/"><strong>stackademic.com</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=54265bf05f92" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/i-found-my-new-favorite-way-to-manage-state-jotai-is-magic-in-atoms-54265bf05f92">🌱 I Found My New Favorite Way to Manage State: Jotai is Magic in Atoms!</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>