<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Sheraz Manzoor</title>
    <description>The latest articles on DEV Community by Sheraz Manzoor (@sheraz4194).</description>
    <link>https://dev.to/sheraz4194</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%2F1694459%2Fd688e183-530a-411a-8968-5ca1ae6f3291.jpg</url>
      <title>DEV Community: Sheraz Manzoor</title>
      <link>https://dev.to/sheraz4194</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sheraz4194"/>
    <language>en</language>
    <item>
      <title>You're Not a Coder Anymore. You're an Orchestrator. (And That's a Good Thing)</title>
      <dc:creator>Sheraz Manzoor</dc:creator>
      <pubDate>Wed, 06 May 2026 10:43:31 +0000</pubDate>
      <link>https://dev.to/sheraz4194/youre-not-a-coder-anymore-youre-an-orchestrator-and-thats-a-good-thing-27a6</link>
      <guid>https://dev.to/sheraz4194/youre-not-a-coder-anymore-youre-an-orchestrator-and-thats-a-good-thing-27a6</guid>
      <description>&lt;p&gt;&lt;em&gt;The shift from AI autocomplete to AI agents is the biggest change in software development since version control -- and most devs aren't ready for it.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;If you're still treating your AI tools like a smarter Stack Overflow, you're already behind.&lt;/p&gt;

&lt;p&gt;In 2026, the developers shipping the most code aren't the ones who type the fastest or know the most syntax by heart. They're the ones who've figured out how to &lt;strong&gt;orchestrate AI agents&lt;/strong&gt; like a conductor leads an orchestra. One experienced developer with the right agentic framework can produce the output of a team of four or five engineers.&lt;/p&gt;

&lt;p&gt;That's not hype. That's what's actually happening in the industry right now.&lt;/p&gt;

&lt;p&gt;So let's talk about what "AI-agentic development" actually means in practice, how it changes the way you write and review code, and how you can start building these habits today.&lt;/p&gt;




&lt;h2&gt;
  
  
  First, What Even Is an AI Agent?
&lt;/h2&gt;

&lt;p&gt;Before we go further, let's make sure we're on the same page.&lt;/p&gt;

&lt;p&gt;A traditional AI coding tool (like early Copilot) works like autocomplete on steroids. You write a comment or a function signature, and it suggests what comes next. You're still driving. The AI is just filling in words.&lt;/p&gt;

&lt;p&gt;An &lt;strong&gt;AI agent&lt;/strong&gt; is different. You give it a goal, and it figures out the steps. It can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Read your existing codebase to understand context&lt;/li&gt;
&lt;li&gt;Create files, write tests, and scaffold components&lt;/li&gt;
&lt;li&gt;Run commands and check the output&lt;/li&gt;
&lt;li&gt;Fix its own errors and iterate&lt;/li&gt;
&lt;li&gt;Open pull requests when it's done
The mental model shift is huge. Instead of asking "what code should I write next?", you start asking "what do I want to exist that doesn't exist yet?" and then delegating the building to an agent.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  The Old Workflow vs. The New Workflow
&lt;/h2&gt;

&lt;p&gt;Here's a concrete example. Let's say you need to build a user authentication module with JWT tokens.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The old workflow (2022-era AI):&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;You: // create a function to generate a JWT token
AI: suggests a 10-line function
You: copy, paste, tweak, move on
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You're still writing 80% of the code. The AI is a lookup tool.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The new workflow (agentic, 2026):&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You open your terminal and type something like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Using Claude Code as an example agent&lt;/span&gt;
claude &lt;span class="s2"&gt;"Build a JWT authentication module. Use jsonwebtoken,
store refresh tokens in Redis, add middleware for protected routes,
and write Jest tests for each function. Follow the existing project
structure in /src."&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The agent then:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Reads your &lt;code&gt;/src&lt;/code&gt; directory to understand your file structure and naming conventions&lt;/li&gt;
&lt;li&gt;Checks your &lt;code&gt;package.json&lt;/code&gt; for existing dependencies&lt;/li&gt;
&lt;li&gt;Scaffolds &lt;code&gt;auth.service.ts&lt;/code&gt;, &lt;code&gt;auth.middleware.ts&lt;/code&gt;, and &lt;code&gt;auth.test.ts&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Runs the tests and fixes any failures it finds&lt;/li&gt;
&lt;li&gt;Reports back with a summary
You didn't write the code. You defined the &lt;strong&gt;outcome&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  What This Means for Your Day-to-Day Work
&lt;/h2&gt;

&lt;p&gt;This shift changes where your mental energy goes. Let's break it down.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Prompting is now a core skill
&lt;/h3&gt;

&lt;p&gt;How you describe a task determines the quality of what you get back. Vague instructions produce vague code. Precise instructions with context produce production-ready code.&lt;/p&gt;

&lt;p&gt;Compare these two prompts:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Bad:  "Add error handling to my API"

Good: "Add error handling to all async functions in /src/routes/*.ts.
      Use a centralized error handler middleware. Return structured JSON
      errors with a 'code', 'message', and 'details' field.
      Log errors using the existing Winston logger in /src/utils/logger.ts."
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The second prompt gives the agent constraints, existing context, and an expected output format. You'll get something you can actually use.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. You review more than you write
&lt;/h3&gt;

&lt;p&gt;Your job becomes code review at a higher level. Instead of reviewing your own work line by line as you go, you're reviewing entire feature scaffolds and asking:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Does this follow our architecture patterns?&lt;/li&gt;
&lt;li&gt;Are there security implications I need to check?&lt;/li&gt;
&lt;li&gt;Is this the right abstraction, or is it over-engineered?
This is actually a more valuable use of your time. The mechanical typing is handled. The judgment is still yours.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. Architecture decisions matter more, not less
&lt;/h3&gt;

&lt;p&gt;Here's the thing people get wrong: they think agentic AI tools reduce the need for technical expertise. It's the opposite.&lt;/p&gt;

&lt;p&gt;If you give an AI agent bad architectural direction, it will build you a very clean, well-tested, beautifully scaffolded bad system. Garbage in, garbage out, just faster.&lt;/p&gt;

&lt;p&gt;Knowing &lt;em&gt;why&lt;/em&gt; you'd use a message queue vs. a direct API call, &lt;em&gt;why&lt;/em&gt; you'd separate your domain logic from your infrastructure layer, &lt;em&gt;why&lt;/em&gt; you'd reach for an event-driven pattern in one scenario vs. a request-response pattern in another -- these skills are more important now than ever. Because you're the one making those calls.&lt;/p&gt;




&lt;h2&gt;
  
  
  A Practical Agentic Workflow You Can Steal
&lt;/h2&gt;

&lt;p&gt;Here's a workflow pattern that senior devs are adopting right now. Think of it as "spec-first" development.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Write a task spec, not just a ticket
&lt;/h3&gt;

&lt;p&gt;Before you hand anything to an AI agent, write a short spec file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gh"&gt;# Task: Add rate limiting to the public API&lt;/span&gt;

&lt;span class="gu"&gt;## Goal&lt;/span&gt;
Prevent abuse by limiting requests to 100 per 15 minutes per IP address.

&lt;span class="gu"&gt;## Constraints&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; Use express-rate-limit (already in package.json)
&lt;span class="p"&gt;-&lt;/span&gt; Apply globally in app.ts, not per-route
&lt;span class="p"&gt;-&lt;/span&gt; Return a 429 status with a clear error message
&lt;span class="p"&gt;-&lt;/span&gt; Add an exemption for internal service-to-service calls (identified by X-Internal-Token header)
&lt;span class="p"&gt;-&lt;/span&gt; Write integration tests using supertest

&lt;span class="gu"&gt;## Files to touch&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; src/app.ts (add middleware)
&lt;span class="p"&gt;-&lt;/span&gt; src/middleware/rateLimiter.ts (create this)
&lt;span class="p"&gt;-&lt;/span&gt; tests/rateLimiter.test.ts (create this)

&lt;span class="gu"&gt;## Do NOT change&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; Any existing route handlers
&lt;span class="p"&gt;-&lt;/span&gt; Authentication logic
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This spec becomes your agent's system prompt. It gives it constraints, context, and a clear scope boundary.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Run the agent with the spec
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claude &lt;span class="nt"&gt;--file&lt;/span&gt; task-spec.md
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or paste it directly into your tool of choice.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: Review the diff like a PR
&lt;/h3&gt;

&lt;p&gt;When the agent is done, treat its output exactly like you'd treat a pull request from a junior developer. Check the logic, check the edge cases, check that the scope didn't drift.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git diff
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Look for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Did it touch files you said not to touch?&lt;/li&gt;
&lt;li&gt;Does the test actually assert the right things, or does it just pass trivially?&lt;/li&gt;
&lt;li&gt;Are there any magic numbers or hardcoded values that should be config?
### Step 4: Iterate with follow-up prompts&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Agents shine in iteration. If something is off, be specific:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"The test passes when the rate limit is hit but it's not testing the
X-Internal-Token exemption. Add a test case for that."
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This back-and-forth is fast. A correction that would take you 20 minutes to track down and fix takes 30 seconds to describe.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Pitfalls (Don't Skip This Section)
&lt;/h2&gt;

&lt;p&gt;Agentic development is powerful, but it's easy to shoot yourself in the foot if you're not careful.&lt;/p&gt;

&lt;h3&gt;
  
  
  Pitfall 1: Trusting without reading
&lt;/h3&gt;

&lt;p&gt;The number one mistake is treating AI output as safe to ship without reading it. Agents can and do:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Introduce subtle bugs in edge cases&lt;/li&gt;
&lt;li&gt;Write tests that pass trivially (testing that &lt;code&gt;true === true&lt;/code&gt;, essentially)&lt;/li&gt;
&lt;li&gt;Use deprecated APIs they learned from older training data&lt;/li&gt;
&lt;li&gt;Over-engineer simple solutions
Always read the diff. Every single time.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Pitfall 2: Scope creep in agent runs
&lt;/h3&gt;

&lt;p&gt;Agents are eager. If your spec is vague, they'll fill the gaps with assumptions. Sometimes those assumptions touch things you didn't want touched.&lt;/p&gt;

&lt;p&gt;Mitigate this by being explicit about scope boundaries in your spec, as shown above. "Do NOT change X" is a sentence worth writing.&lt;/p&gt;

&lt;h3&gt;
  
  
  Pitfall 3: Context rot in long sessions
&lt;/h3&gt;

&lt;p&gt;The longer an agent session runs, the more likely the agent is to lose track of early constraints. For big features, break the work into multiple smaller agent runs rather than one giant session.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Run 1: Scaffold the data models and migrations
Run 2: Build the service layer
Run 3: Wire up the API routes
Run 4: Write tests for the complete flow
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each run starts fresh with the relevant context. This produces cleaner, more consistent output than one mega-prompt.&lt;/p&gt;

&lt;h3&gt;
  
  
  Pitfall 4: Skipping security review
&lt;/h3&gt;

&lt;p&gt;AI agents don't have your threat model. They'll write code that works in the happy path but miss things like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;SQL injection vectors in dynamic queries&lt;/li&gt;
&lt;li&gt;Missing authorization checks on sensitive endpoints&lt;/li&gt;
&lt;li&gt;Storing sensitive data in logs
Treat any agent-written code that handles user input, authentication, or data persistence with extra scrutiny.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  The Skills That Actually Matter in 2026
&lt;/h2&gt;

&lt;p&gt;If you want to level up as a developer in this new landscape, here's where to invest:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Double down on systems thinking.&lt;/strong&gt; Understand distributed systems, data modeling, and software architecture at a deeper level. The agents build. You design.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Get comfortable with TypeScript.&lt;/strong&gt; End-to-end type safety across client and server is now the baseline expectation. Agents produce much better, more consistent code when your codebase has strong types.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Learn to write clear specs.&lt;/strong&gt; This is basically technical writing. Ambiguity is the enemy. Practice writing requirements that a developer who knows nothing about your project could follow.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Understand what agents can't do well.&lt;/strong&gt; Novel algorithmic problems, nuanced UX decisions, security audits, performance profiling -- these still need deep human attention. Know where the handoffs are.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Stay hands-on in the code.&lt;/strong&gt; The developers who drift too far from the actual code and become "prompt managers only" will lose their technical judgment quickly. Keep reading code, keep debugging, keep understanding the system.&lt;/p&gt;




&lt;h2&gt;
  
  
  So, Are Developer Jobs Going Away?
&lt;/h2&gt;

&lt;p&gt;Let's address the elephant in the room.&lt;/p&gt;

&lt;p&gt;No. But the &lt;em&gt;shape&lt;/em&gt; of the work is changing fast.&lt;/p&gt;

&lt;p&gt;The developers who treat AI agents as a threat are going to have a harder time than those who treat them as leverage. A skilled developer with agentic tools doesn't get replaced. They get multiplied.&lt;/p&gt;

&lt;p&gt;Think of it like this: a great architect doesn't get replaced by better construction equipment. Better equipment just means they can build more ambitious things.&lt;/p&gt;

&lt;p&gt;The floor is rising. Junior developers who rely on agents too heavily without building foundational understanding will struggle. But experienced developers who know their craft and add orchestration skills on top will be absurdly productive.&lt;/p&gt;




&lt;h2&gt;
  
  
  Getting Started Today
&lt;/h2&gt;

&lt;p&gt;If you haven't started experimenting with agentic tools, here's the shortest path to getting your hands dirty:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Set up Claude Code, Cursor, or GitHub Copilot Workspace&lt;/strong&gt; in a real project you're working on&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pick one well-defined, low-risk task&lt;/strong&gt; (not something in production-critical code) and write a spec for it as described above&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Run the agent and review the output like a PR&lt;/strong&gt; without running it yet&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Iterate with follow-up prompts&lt;/strong&gt; until the output meets your bar&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Then run the tests&lt;/strong&gt;, check the behavior manually, and decide if it's shippable
That first successful run where you go from "here's what I want" to "here's working, tested code I didn't have to type" is a genuinely mind-shifting experience.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The developers who build this muscle now will have a significant head start over those who wait until it's "mainstream." In a lot of teams, it already is.&lt;/p&gt;




&lt;h2&gt;
  
  
  Wrapping Up
&lt;/h2&gt;

&lt;p&gt;The core shift is this: &lt;strong&gt;your value as a developer is no longer in your typing speed or your ability to recall syntax. It's in your ability to think clearly about what needs to exist, define it precisely, and evaluate what gets built.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That's actually a more interesting job. More architecture, more judgment, more design, less boilerplate.&lt;/p&gt;

&lt;p&gt;The era of AI as autocomplete is already over. The era of AI as collaborator is here. The question is whether you're going to treat these tools like a smarter search engine or like a team member you can delegate to.&lt;/p&gt;

&lt;p&gt;Start delegating.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Have you started using agentic workflows in your day job? What's working for you and what's been a pain? Drop a comment below, I'd love to hear how others are adapting their workflows.&lt;/em&gt;&lt;/p&gt;




</description>
      <category>ai</category>
      <category>webdev</category>
      <category>productivity</category>
      <category>programming</category>
    </item>
    <item>
      <title>Many of my followers liked this post and it got so much love. So sharing it again for the new folks out there,</title>
      <dc:creator>Sheraz Manzoor</dc:creator>
      <pubDate>Tue, 05 May 2026 19:16:05 +0000</pubDate>
      <link>https://dev.to/sheraz4194/many-of-my-followers-liked-this-post-and-it-got-so-much-love-so-sharing-it-again-for-the-new-folks-2f2</link>
      <guid>https://dev.to/sheraz4194/many-of-my-followers-liked-this-post-and-it-got-so-much-love-so-sharing-it-again-for-the-new-folks-2f2</guid>
      <description>&lt;div class="ltag__link--embedded"&gt;
  &lt;div class="crayons-story "&gt;
  &lt;a href="https://dev.to/sheraz4194/good-commit-vs-bad-commit-best-practices-for-git-1plc" class="crayons-story__hidden-navigation-link"&gt;Good Commit ✔ VS. Bad Commit ❌: Best Practices for Git&lt;/a&gt;


  &lt;div class="crayons-story__body crayons-story__body-full_post"&gt;
    &lt;div class="crayons-story__top"&gt;
      &lt;div class="crayons-story__meta"&gt;
        &lt;div class="crayons-story__author-pic"&gt;

          &lt;a href="/sheraz4194" class="crayons-avatar  crayons-avatar--l  "&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%2Fuser%2Fprofile_image%2F1694459%2Fd688e183-530a-411a-8968-5ca1ae6f3291.jpg" alt="sheraz4194 profile" class="crayons-avatar__image"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
        &lt;div&gt;
          &lt;div&gt;
            &lt;a href="/sheraz4194" class="crayons-story__secondary fw-medium m:hidden"&gt;
              Sheraz Manzoor
            &lt;/a&gt;
            &lt;div class="profile-preview-card relative mb-4 s:mb-0 fw-medium hidden m:inline-block"&gt;
              
                Sheraz Manzoor
                
              
              &lt;div id="story-author-preview-content-1925182" class="profile-preview-card__content crayons-dropdown branded-7 p-4 pt-0"&gt;
                &lt;div class="gap-4 grid"&gt;
                  &lt;div class="-mt-4"&gt;
                    &lt;a href="/sheraz4194" class="flex"&gt;
                      &lt;span class="crayons-avatar crayons-avatar--xl mr-2 shrink-0"&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%2Fuser%2Fprofile_image%2F1694459%2Fd688e183-530a-411a-8968-5ca1ae6f3291.jpg" class="crayons-avatar__image" alt=""&gt;
                      &lt;/span&gt;
                      &lt;span class="crayons-link crayons-subtitle-2 mt-5"&gt;Sheraz Manzoor&lt;/span&gt;
                    &lt;/a&gt;
                  &lt;/div&gt;
                  &lt;div class="print-hidden"&gt;
                    
                      Follow
                    
                  &lt;/div&gt;
                  &lt;div class="author-preview-metadata-container"&gt;&lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/div&gt;

          &lt;/div&gt;
          &lt;a href="https://dev.to/sheraz4194/good-commit-vs-bad-commit-best-practices-for-git-1plc" class="crayons-story__tertiary fs-xs"&gt;&lt;time&gt;Jul 19 '24&lt;/time&gt;&lt;span class="time-ago-indicator-initial-placeholder"&gt;&lt;/span&gt;&lt;/a&gt;
        &lt;/div&gt;
      &lt;/div&gt;

    &lt;/div&gt;

    &lt;div class="crayons-story__indention"&gt;
      &lt;h2 class="crayons-story__title crayons-story__title-full_post"&gt;
        &lt;a href="https://dev.to/sheraz4194/good-commit-vs-bad-commit-best-practices-for-git-1plc" id="article-link-1925182"&gt;
          Good Commit ✔ VS. Bad Commit ❌: Best Practices for Git
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;div class="crayons-story__tags"&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/git"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;git&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/github"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;github&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/webdev"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;webdev&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/beginners"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;beginners&lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="crayons-story__bottom"&gt;
        &lt;div class="crayons-story__details"&gt;
          &lt;a href="https://dev.to/sheraz4194/good-commit-vs-bad-commit-best-practices-for-git-1plc" class="crayons-btn crayons-btn--s crayons-btn--ghost crayons-btn--icon-left"&gt;
            &lt;div class="multiple_reactions_aggregate"&gt;
              &lt;span class="multiple_reactions_icons_container"&gt;
                  &lt;span class="crayons_icon_container"&gt;
                    &lt;img src="https://assets.dev.to/assets/fire-f60e7a582391810302117f987b22a8ef04a2fe0df7e3258a5f49332df1cec71e.svg" width="18" height="18"&gt;
                  &lt;/span&gt;
                  &lt;span class="crayons_icon_container"&gt;
                    &lt;img src="https://assets.dev.to/assets/raised-hands-74b2099fd66a39f2d7eed9305ee0f4553df0eb7b4f11b01b6b1b499973048fe5.svg" width="18" height="18"&gt;
                  &lt;/span&gt;
                  &lt;span class="crayons_icon_container"&gt;
                    &lt;img src="https://assets.dev.to/assets/sparkle-heart-5f9bee3767e18deb1bb725290cb151c25234768a0e9a2bd39370c382d02920cf.svg" width="18" height="18"&gt;
                  &lt;/span&gt;
              &lt;/span&gt;
              &lt;span class="aggregate_reactions_counter"&gt;1009&lt;span class="hidden s:inline"&gt; reactions&lt;/span&gt;&lt;/span&gt;
            &lt;/div&gt;
          &lt;/a&gt;
            &lt;a href="https://dev.to/sheraz4194/good-commit-vs-bad-commit-best-practices-for-git-1plc#comments" class="crayons-btn crayons-btn--s crayons-btn--ghost crayons-btn--icon-left flex items-center"&gt;
              Comments


              80&lt;span class="hidden s:inline"&gt; comments&lt;/span&gt;
            &lt;/a&gt;
        &lt;/div&gt;
        &lt;div class="crayons-story__save"&gt;
          &lt;small class="crayons-story__tertiary fs-xs mr-2"&gt;
            4 min read
          &lt;/small&gt;
            
              &lt;span class="bm-initial"&gt;
                

              &lt;/span&gt;
              &lt;span class="bm-success"&gt;
                

              &lt;/span&gt;
            
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;/div&gt;


</description>
      <category>beginners</category>
      <category>git</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Coding is dead; Engineering is not.</title>
      <dc:creator>Sheraz Manzoor</dc:creator>
      <pubDate>Sat, 28 Feb 2026 17:19:29 +0000</pubDate>
      <link>https://dev.to/sheraz4194/coding-is-dead-engineering-is-not-3il2</link>
      <guid>https://dev.to/sheraz4194/coding-is-dead-engineering-is-not-3il2</guid>
      <description>&lt;p&gt;Tech industries have been marking something as dead, since the internet came. They marked PHP dead, they marked the desktop apps dead, now they're saying coding is dead. So, let's disscuss, is coding really dead?&lt;/p&gt;

&lt;p&gt;With vibe coding platforms, the startups are bragging about, shipping without developers. Some even say;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If AI can write code, what's left for developers?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Answer to the question.
&lt;/h2&gt;

&lt;p&gt;To answer that bitter question, I would love to share my personal experiences. &lt;/p&gt;

&lt;p&gt;First experience is very recent, I guess it was in December. A client approached me on Linkedin, and said this exactly;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"I have created a website with loveable, everything is fine but there's an issue. On google page insights the performance score is only 28%. Can you fix this and bring the score to 90+?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So, AI generated the website for him, but he still needed my services. And when I looked his code, there were 2000+ lines of code in various single files, images loading on the homepage were above 5 mb, most of'em.&lt;/p&gt;

&lt;p&gt;And I did my "engineering" and the performance boosted to 98.&lt;/p&gt;

&lt;p&gt;The second experience is that client approached me with a very similar situation, I'll edit his message a bit to avoid confidential information leaks, he said;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"I have a THAT specific issue, I'm trying to resolve it with AI from weeks, but nothing worked out, can you help me in this please? Give me a quotation and a timeline"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So, AI failed at that certain problem, which was basically "Engineering" related; not about "Coding"&lt;/p&gt;

&lt;p&gt;To cut the story short, the coding is really dead, but engineering didn't and it'll never.&lt;/p&gt;

&lt;h2&gt;
  
  
  The death of Coding
&lt;/h2&gt;

&lt;p&gt;Let's be honest; Writing the boilerplate code was never the highest form of intelligence. We even found free templates which really helped a lot several times.&lt;/p&gt;

&lt;p&gt;CRUD oprations, API endpoints, forms validations, UI design, these tasks are increasingly automated, and don't be sad, it's not a tragedy, it's progress. Just like calculators didn't kill Mathematics, AI wouldn't kill Engineering. After AI, just an idea died;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A developer is someone who writes the code line by line&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  What coding was? And why it wasn't enough?
&lt;/h2&gt;

&lt;p&gt;In very descriptive way, "Coding was just syntax execution". And on the other hand, "Engineering is problem solving".&lt;/p&gt;

&lt;p&gt;An engineer understands ambiguous requirements, designs scalable systems, anticipates failure modes, balances performance, security, costs and UX, makes trade-off under real world pressure. So, coding is a language, engineering is the mindset.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Engineering will always survive?
&lt;/h2&gt;

&lt;p&gt;Real world problems are very messy, they aren't like simple vanila problems. Client contradicts themselves, requirements change in the mid-build, business goals conflicts with technical realities.&lt;/p&gt;

&lt;p&gt;Engineering is the ability to shape chaos into meaningful systems. AI can generate functionality, it cannot take responsibility. &lt;/p&gt;

&lt;p&gt;AI works always with context and patterns. Now, from the experiences I shared, many files had 2000+ lines of code, not a single AI can make edits in that single file, and reality we have tens and thousands of files, what will AI do there? It'll crash. On the other hand, Engineers write systems based on domain knowledge, business context, user behavior and organized constraints. Context is not a prompt, context is experience.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Here's my new blog post, I had been working and testing Nextjs 15 for two months and here's a summary of it.</title>
      <dc:creator>Sheraz Manzoor</dc:creator>
      <pubDate>Tue, 09 Dec 2025 10:37:30 +0000</pubDate>
      <link>https://dev.to/sheraz4194/heres-my-new-blog-post-i-had-been-working-and-testing-nextjs-15-for-two-months-and-heres-a-1g80</link>
      <guid>https://dev.to/sheraz4194/heres-my-new-blog-post-i-had-been-working-and-testing-nextjs-15-for-two-months-and-heres-a-1g80</guid>
      <description>&lt;p&gt;

&lt;/p&gt;
&lt;div class="ltag__link--embedded"&gt;
  &lt;div class="crayons-story "&gt;
  &lt;a href="https://dev.to/sheraz4194/whats-new-nextjs-15-3fia" class="crayons-story__hidden-navigation-link"&gt;What's new Nextjs 15?&lt;/a&gt;


  &lt;div class="crayons-story__body crayons-story__body-full_post"&gt;
    &lt;div class="crayons-story__top"&gt;
      &lt;div class="crayons-story__meta"&gt;
        &lt;div class="crayons-story__author-pic"&gt;

          &lt;a href="/sheraz4194" class="crayons-avatar  crayons-avatar--l  "&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%2Fuser%2Fprofile_image%2F1694459%2Fd688e183-530a-411a-8968-5ca1ae6f3291.jpg" alt="sheraz4194 profile" class="crayons-avatar__image"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
        &lt;div&gt;
          &lt;div&gt;
            &lt;a href="/sheraz4194" class="crayons-story__secondary fw-medium m:hidden"&gt;
              Sheraz Manzoor
            &lt;/a&gt;
            &lt;div class="profile-preview-card relative mb-4 s:mb-0 fw-medium hidden m:inline-block"&gt;
              
                Sheraz Manzoor
                
              
              &lt;div id="story-author-preview-content-3094140" class="profile-preview-card__content crayons-dropdown branded-7 p-4 pt-0"&gt;
                &lt;div class="gap-4 grid"&gt;
                  &lt;div class="-mt-4"&gt;
                    &lt;a href="/sheraz4194" class="flex"&gt;
                      &lt;span class="crayons-avatar crayons-avatar--xl mr-2 shrink-0"&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%2Fuser%2Fprofile_image%2F1694459%2Fd688e183-530a-411a-8968-5ca1ae6f3291.jpg" class="crayons-avatar__image" alt=""&gt;
                      &lt;/span&gt;
                      &lt;span class="crayons-link crayons-subtitle-2 mt-5"&gt;Sheraz Manzoor&lt;/span&gt;
                    &lt;/a&gt;
                  &lt;/div&gt;
                  &lt;div class="print-hidden"&gt;
                    
                      Follow
                    
                  &lt;/div&gt;
                  &lt;div class="author-preview-metadata-container"&gt;&lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/div&gt;

          &lt;/div&gt;
          &lt;a href="https://dev.to/sheraz4194/whats-new-nextjs-15-3fia" class="crayons-story__tertiary fs-xs"&gt;&lt;time&gt;Dec 9 '25&lt;/time&gt;&lt;span class="time-ago-indicator-initial-placeholder"&gt;&lt;/span&gt;&lt;/a&gt;
        &lt;/div&gt;
      &lt;/div&gt;

    &lt;/div&gt;

    &lt;div class="crayons-story__indention"&gt;
      &lt;h2 class="crayons-story__title crayons-story__title-full_post"&gt;
        &lt;a href="https://dev.to/sheraz4194/whats-new-nextjs-15-3fia" id="article-link-3094140"&gt;
          What's new Nextjs 15?
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;div class="crayons-story__tags"&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/nextjs"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;nextjs&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/react"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;react&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/javascript"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;javascript&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/typescript"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;typescript&lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="crayons-story__bottom"&gt;
        &lt;div class="crayons-story__details"&gt;
            &lt;a href="https://dev.to/sheraz4194/whats-new-nextjs-15-3fia#comments" class="crayons-btn crayons-btn--s crayons-btn--ghost crayons-btn--icon-left flex items-center"&gt;
              Comments


              &lt;span class="hidden s:inline"&gt;Add Comment&lt;/span&gt;
            &lt;/a&gt;
        &lt;/div&gt;
        &lt;div class="crayons-story__save"&gt;
          &lt;small class="crayons-story__tertiary fs-xs mr-2"&gt;
            2 min read
          &lt;/small&gt;
            
              &lt;span class="bm-initial"&gt;
                

              &lt;/span&gt;
              &lt;span class="bm-success"&gt;
                

              &lt;/span&gt;
            
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;/div&gt;




</description>
      <category>nextjs</category>
      <category>react</category>
      <category>javascript</category>
      <category>typescript</category>
    </item>
    <item>
      <title>What's new Nextjs 15?</title>
      <dc:creator>Sheraz Manzoor</dc:creator>
      <pubDate>Tue, 09 Dec 2025 10:36:23 +0000</pubDate>
      <link>https://dev.to/sheraz4194/whats-new-nextjs-15-3fia</link>
      <guid>https://dev.to/sheraz4194/whats-new-nextjs-15-3fia</guid>
      <description>&lt;p&gt;Vercel Recently launched Nextjs 15, and decaled it as stable and ready for production. Today we'll disscuss what's new in Nextjs 15. &lt;/p&gt;

&lt;p&gt;Basically there are new features in Nextjs 15;&lt;/p&gt;

&lt;h2&gt;
  
  
  React 19 RC Support
&lt;/h2&gt;

&lt;p&gt;Next.js 15 RC now supports React 19 RC. This includes the new features for both client and server side rendering. One of the new features in React 19 is &lt;strong&gt;Actions&lt;/strong&gt; which is a very common use case in React Apps to perform Data Mutation and then update in response. &lt;/p&gt;

&lt;p&gt;For example; when a user submits a form to change their name, you'll make an api request and then handle a response. &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;@next/codemode&lt;/code&gt; CLI
&lt;/h2&gt;

&lt;p&gt;Now you can easily upgrade to latest Nextjs and React versions&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx @next/codemod@canary upgrade latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Turbopack Dev (Stable)
&lt;/h2&gt;

&lt;p&gt;Performance and stability has been improved to the next level.&lt;/p&gt;

&lt;h2&gt;
  
  
  React Compiler (Experimental)
&lt;/h2&gt;

&lt;p&gt;The React Compiler is a new compiler created by the React team at Meta. Complier understands your code at a deep level through it's understanding of plain JavaScript semantics and the rules of React, which allows it to add automatic optimizations to your code.&lt;/p&gt;

&lt;p&gt;The code reduce the amount of manual memorization developers has to do with apis such as useMemo and useCallback, making code simpler, easier to maintain, and less error prove.&lt;/p&gt;

&lt;h2&gt;
  
  
  Hydration Error Improvements.
&lt;/h2&gt;

&lt;p&gt;Nextjs continues to build on those by an improved hydration error view. Hydration errors now display the source code of the error with suggestion on how to address the error. &lt;/p&gt;

&lt;p&gt;Such improvements help the developers to better understand the error fix it in low time. &lt;/p&gt;

&lt;h2&gt;
  
  
  Caching Updates
&lt;/h2&gt;

&lt;p&gt;In Nextjs 15, caching default for fetch requests, GET Route handlers and Client Route Handlers and client router cache has changed from cached by default to uncached by default.&lt;/p&gt;

&lt;p&gt;If you want to retain the previous behavior, you can continue to opt-into caching.  &lt;/p&gt;

&lt;h2&gt;
  
  
  Partial Prerendering (Experimental)
&lt;/h2&gt;

&lt;p&gt;Partial Prerendering is a new rendering strategy that combines the benefits of static and dynamic rendering on the same route. Quite similar to parallel routing, right? With PPR, you can wrap any dynamic components in a Suspense Boundary. &lt;/p&gt;

&lt;p&gt;When a new request comes in, Nextjs will immediately serve a static HTML shell from the cache, then render and stream the dynamic parts in the same HTTP request.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;unstable_after&lt;/code&gt; API (Experimental)
&lt;/h2&gt;

&lt;p&gt;This executers a stream after a response finishes streaming. &lt;/p&gt;

&lt;p&gt;So, these were the backbone new features of Nextjs 15, I find them quite fascinating and interesting, and after using them from almost two months (October 2025 to December 2025), I can now witness that is really lot much better already, and in the next releases it will improve further more. &lt;/p&gt;

&lt;p&gt;I would love to hear your thoughts, questions and critics on it.  &lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>react</category>
      <category>javascript</category>
      <category>typescript</category>
    </item>
    <item>
      <title>How to deal with a slow API, a story in two parts.</title>
      <dc:creator>Sheraz Manzoor</dc:creator>
      <pubDate>Sat, 02 Aug 2025 12:24:30 +0000</pubDate>
      <link>https://dev.to/sheraz4194/how-to-deal-with-a-slow-api-a-story-in-two-parts-j1f</link>
      <guid>https://dev.to/sheraz4194/how-to-deal-with-a-slow-api-a-story-in-two-parts-j1f</guid>
      <description>&lt;p&gt;Why optimize when you can simply... shift the problem to someone else? &lt;/p&gt;

</description>
      <category>programmingmemes</category>
      <category>frontenddev</category>
      <category>backenddev</category>
      <category>devhumor</category>
    </item>
    <item>
      <title>Understanding React's `use` API</title>
      <dc:creator>Sheraz Manzoor</dc:creator>
      <pubDate>Fri, 21 Feb 2025 17:23:09 +0000</pubDate>
      <link>https://dev.to/sheraz4194/understanding-reacts-use-api-5d57</link>
      <guid>https://dev.to/sheraz4194/understanding-reacts-use-api-5d57</guid>
      <description>&lt;h2&gt;
  
  
  A Sneak Peek into React’s &lt;code&gt;use&lt;/code&gt; API: Simplifying Async Data Fetching
&lt;/h2&gt;

&lt;p&gt;React's &lt;code&gt;use&lt;/code&gt; API is an &lt;strong&gt;experimental&lt;/strong&gt; yet powerful feature designed to &lt;strong&gt;simplify asynchronous data fetching&lt;/strong&gt; within components. Instead of juggling &lt;code&gt;useEffect&lt;/code&gt; and state variables, &lt;code&gt;use&lt;/code&gt; lets you directly await promises inside the render phase.  &lt;/p&gt;

&lt;h2&gt;
  
  
  Why is &lt;code&gt;use&lt;/code&gt; a Game-Changer?
&lt;/h2&gt;

&lt;p&gt;✅ Eliminates unnecessary &lt;code&gt;useEffect&lt;/code&gt; hooks&lt;br&gt;&lt;br&gt;
✅ Works seamlessly with Server Components&lt;br&gt;&lt;br&gt;
✅ Simplifies async operations for cleaner, more readable code  &lt;/p&gt;
&lt;h2&gt;
  
  
  How Does it Work?
&lt;/h2&gt;

&lt;p&gt;Here's a quick look at how &lt;code&gt;use&lt;/code&gt; fetches data directly inside a component:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&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;use&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="s2"&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;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;fetchData&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;response&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;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://jsonplaceholder.typicode.com/posts/1&lt;/span&gt;&lt;span class="dl"&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;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="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="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;fetchData&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="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;h2&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&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;title&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;h2&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;p&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&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;body&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;p&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;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;h2&gt;
  
  
  Is use Ready for Production?
&lt;/h2&gt;

&lt;p&gt;⚠️ Not yet! The API is still experimental and currently works best with React Server Components. However, it shows great promise in simplifying data fetching workflows.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://codepanda.online/blog/react-use-api-explained" rel="noopener noreferrer"&gt; Read Full Blog → &lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>🚀 Introducing My Personal Tech Blog: CodePanda.online 📝</title>
      <dc:creator>Sheraz Manzoor</dc:creator>
      <pubDate>Sun, 16 Feb 2025 11:47:20 +0000</pubDate>
      <link>https://dev.to/sheraz4194/introducing-my-personal-tech-blog-codepandaonline-5pk</link>
      <guid>https://dev.to/sheraz4194/introducing-my-personal-tech-blog-codepandaonline-5pk</guid>
      <description>&lt;p&gt;Hey everyone! 👋&lt;/p&gt;

&lt;p&gt;I’m super excited to share that I’ve launched my personal blog website — CodePanda.online! It’s a space where I’ll be sharing my knowledge, experiences, and helpful tips for web developers and tech enthusiasts.&lt;/p&gt;

&lt;h2&gt;
  
  
  💻 What to Expect on CodePanda:
&lt;/h2&gt;

&lt;p&gt;✅ Hands-on tutorials for JavaScript, TypeScript, React, Next.js, and more.&lt;br&gt;
✅ Practical Tips &amp;amp; Tricks – Quick solutions to common coding challenges.&lt;br&gt;
✅ Insights from real-world projects I’ve worked on.&lt;br&gt;
✅ In-Depth Tutorials – Step-by-step guides on JavaScript, TypeScript, React, Next.js, and more.&lt;br&gt;
✅ Snippets and solutions you can use in your own apps.&lt;/p&gt;

&lt;p&gt;I created CodePanda to document my journey as a developer and help others by sharing what I learn along the way. Whether you're just starting out or already deep into your coding career, I hope my posts make your development life a little easier.&lt;/p&gt;

&lt;p&gt;🔗 Check it out here: &lt;a href="https://www.codepanda.online/" rel="noopener noreferrer"&gt;codepanda.online&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I’d love for you to stop by, explore, and let me know what topics you’d like me to cover next! 🚀🔥&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>developers</category>
      <category>tutorial</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Different Ways to fetch data in Reactjs</title>
      <dc:creator>Sheraz Manzoor</dc:creator>
      <pubDate>Tue, 04 Feb 2025 06:58:20 +0000</pubDate>
      <link>https://dev.to/sheraz4194/different-ways-to-fetch-data-in-reactjs-4221</link>
      <guid>https://dev.to/sheraz4194/different-ways-to-fetch-data-in-reactjs-4221</guid>
      <description>&lt;p&gt;Fetching data is a fundamental task in modern web or any kind of applications, as almost every web app interacts with an API or a backend service. There are several ways to fetch data in React, and choosing the right approach depends on factors like performance, reactivity, and ease of use. In this blog, we'll explore different major techniques and methods of fetching data in React.js.&lt;/p&gt;

&lt;h2&gt;
  
  
  Simple Fetch Method
&lt;/h2&gt;

&lt;p&gt;The fetch() API in JS is used to request to the server and load the information in the webpages. You can call any API which returns data in JSON or XML. This method returns a promise.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&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;TextAPI&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://example.com&lt;/span&gt;&lt;span class="dl"&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="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;json&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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;HELLO&lt;/span&gt; &lt;span class="nx"&gt;WORLD&lt;/span&gt;&lt;span class="o"&gt;!&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Axios
&lt;/h2&gt;

&lt;p&gt;For many developers, it is the preferred way of fetching data. &lt;br&gt;
Axios is a popular 3rd-party that simplifies HTTP requests with features like request cancellation, automatic JSON parsing, and better error handling.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&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;FetchComponent&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;data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setData&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="kc"&gt;null&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;loading&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setLoading&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="kc"&gt;true&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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://jsonplaceholder.typicode.com/posts&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;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;json&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;setData&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
                &lt;span class="nf"&gt;setLoading&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="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Error fetching data:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;error&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="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;loading&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="nx"&gt;Loading&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;/p&amp;gt;&lt;/span&gt;&lt;span class="err"&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;pre&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;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&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="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&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;/pre&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;p&gt;Many developers like this, but I don't. It is just a personal opinion. If we want to store data for caching, we'll need a new third party library, and this way, we will have to install several third party packages just for getting data from API? Doesn't make sense to me.&lt;/p&gt;

&lt;h2&gt;
  
  
  React Query
&lt;/h2&gt;

&lt;p&gt;This one is my personal favorite. With this, we can achieve a lot more than just fetching data. It provide support for caching, prefetching, refetching, error handling, which improves overall user experience by preventing irregularities and ensuring our app feels really faster.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&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;useQuery&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-query&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;axios&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;axios&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;fetchPosts&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async &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="kd"&gt;const&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="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;axios&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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://jsonplaceholder.typicode.com/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;return&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;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;ReactQueryComponent&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;data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;isLoading&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useQuery&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="nx"&gt;fetchPosts&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="nx"&gt;isLoading&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="nx"&gt;Loading&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;/p&amp;gt;&lt;/span&gt;&lt;span class="err"&gt;;
&lt;/span&gt;    &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&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="nb"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;message&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;/p&amp;gt;&lt;/span&gt;&lt;span class="err"&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;pre&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;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&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="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&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;/pre&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;p&gt;Here, we can do a lot much things with a single library, we don't have to rely on multiple libraries for data handling. That's why a ❤ to React Query.&lt;/p&gt;

&lt;h2&gt;
  
  
  Server-Side Fetching with Next.js
&lt;/h2&gt;

&lt;p&gt;In Nextjs, we can fetch data on server side, in server components. And that is much easier than the traditional useEffect way in React.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;use server&lt;/span&gt;&lt;span class="dl"&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;getServerSideProps&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;res&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;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://jsonplaceholder.typicode.com/posts&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;data&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;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="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;data&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;p&gt;Now you can import and call this function anywhere in your Nextjs Application. In Server components you can call it directly without any issue, but in Client Components, You'll have to call it useEffect.&lt;/p&gt;

&lt;p&gt;The best approach will be to fetch data in a parent server component, and pass that data to our client components.&lt;/p&gt;

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

&lt;p&gt;There are various ways to fetch data in React, each with its own advantages and use cases.&lt;br&gt;
Choosing the right method depends on your project requirements, API structure, and performance needs. Happy coding!&lt;br&gt;
But my suggestion will be React Query, as it has a ton of features.&lt;/p&gt;

&lt;p&gt;If you need guidance or a separate blog on any of the above methods, please let me know in comments.&lt;br&gt;
Checkout my blog: &lt;a href="https://www.codepanda.online/" rel="noopener noreferrer"&gt;https://www.codepanda.online/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>discuss</category>
      <category>learning</category>
      <category>nextjs</category>
    </item>
    <item>
      <title>[Boost]</title>
      <dc:creator>Sheraz Manzoor</dc:creator>
      <pubDate>Tue, 10 Dec 2024 18:06:33 +0000</pubDate>
      <link>https://dev.to/sheraz4194/-706</link>
      <guid>https://dev.to/sheraz4194/-706</guid>
      <description>&lt;div class="ltag__link"&gt;
  &lt;a href="/sheraz4194" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&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%2Fuser%2Fprofile_image%2F1694459%2Fd688e183-530a-411a-8968-5ca1ae6f3291.jpg" alt="sheraz4194"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/sheraz4194/good-commit-vs-bad-commit-best-practices-for-git-1plc" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Good Commit ✔ VS. Bad Commit ❌: Best Practices for Git&lt;/h2&gt;
      &lt;h3&gt;Sheraz Manzoor ・ Jul 19 '24&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#git&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#github&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#webdev&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#beginners&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


</description>
    </item>
    <item>
      <title>Introduction to Next.js Middleware: How It Works with Examples</title>
      <dc:creator>Sheraz Manzoor</dc:creator>
      <pubDate>Tue, 01 Oct 2024 10:13:13 +0000</pubDate>
      <link>https://dev.to/sheraz4194/introduction-to-nextjs-middleware-how-it-works-with-examples-46pp</link>
      <guid>https://dev.to/sheraz4194/introduction-to-nextjs-middleware-how-it-works-with-examples-46pp</guid>
      <description>&lt;p&gt;Let's talk about routing in Nextjs. Today, we will talk about the one of most powerful thing middleware. Middleware in Nextjs offers a powerful and flexible way both to intercept requests from server and control requests flow (redirects, URL rewriting) and globally enhance features like authentication, headers, cookie persistence.&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating Middleware
&lt;/h2&gt;

&lt;p&gt;Let's create Middleware Next.js application. First of all, we'll create a new file for middleware like &lt;code&gt;middleware.js&lt;/code&gt; or &lt;code&gt;middleware.ts&lt;/code&gt;, in the src folder. Middleware in Next.js then needs to allow you the fine control over where it will be active (ie custom matcher configuration, or using isXXX functions)&lt;/p&gt;

&lt;h2&gt;
  
  
  Redirecting
&lt;/h2&gt;

&lt;p&gt;Using redirection as an example, let's imagine a scenario where navigating to &lt;code&gt;/profile&lt;/code&gt; should redirect the user to the homepage. With the custom matcher configuration approach, we can achieve this by importing the necessary types, defining a middleware function, and specifying the matcher configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&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;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/server&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="kd"&gt;type&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="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;next/server&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;middleware&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;request&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="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;NextResponse&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;redirect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;url&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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/profile&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;/&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;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;config&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;matcher&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/profile&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;p&gt;In this example, the middleware function checks if the request URL path is &lt;code&gt;/profile&lt;/code&gt; and redirects the user to the homepage.&lt;/p&gt;

&lt;p&gt;For the conditional statement approach, we can modify the code as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&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;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/server&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="kd"&gt;type&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="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;next/server&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;middleware&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;request&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="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="nx"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;nextUrl&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;pathname&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/profile&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;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;NextResponse&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;redirect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/hello&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;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;NextResponse&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;next&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;In this case, the middleware checks the request URL path and redirects the user to the &lt;code&gt;/hello&lt;/code&gt; route if the path is &lt;code&gt;/profile&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Middleware in Next.js goes beyond just handling redirections. It also allows for URL rewrites, which can be useful for legacy URL support or SEO optimization. By changing &lt;code&gt;redirect&lt;/code&gt; to &lt;code&gt;rewrite&lt;/code&gt; in the previous examples, the URL in the browser will stay the same (&lt;code&gt;/profile&lt;/code&gt;), but the response content will change to the content from the &lt;code&gt;/hello&lt;/code&gt; route.&lt;/p&gt;

&lt;h2&gt;
  
  
  Using Cookies
&lt;/h2&gt;

&lt;p&gt;Lastly, let's explore the use of cookies and headers in middleware. We can modify our middleware to handle user preferences for themes and add a custom header for all responses:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&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;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/server&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="kd"&gt;type&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="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;next/server&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;middleware&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;request&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="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;NextResponse&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;next&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

  &lt;span class="c1"&gt;// Handle user theme preference&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;themePreference&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;cookies&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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;theme&lt;/span&gt;&lt;span class="dl"&gt;'&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;themePreference&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;cookies&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;theme&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;dark&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;span class="c1"&gt;// Add a custom header&lt;/span&gt;
  &lt;span class="nx"&gt;response&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="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Custom-Header&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;Custom Value&lt;/span&gt;&lt;span class="dl"&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;response&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;In this example, we first check if the user has a theme preference stored in a cookie. If not, we set the theme to 'dark' by adding a cookie. Then, we add a custom header to the response, which can be useful for passing additional information or for debugging purposes.&lt;/p&gt;

&lt;p&gt;As you can see, middleware in Next.js is a powerful tool that allows you to effectively control and intercept the request-response cycle, enabling redirects, URL rewrites, and the manipulation of headers and cookies. By mastering middleware, you can enhance the routing experience in your Next.js applications and create more robust and customizable user experiences.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Middleware in Next.js is a powerful feature that offers a robust way to intercept and control the flow of requests and responses within your applications." - Next.js Documentation&lt;/p&gt;
&lt;/blockquote&gt;

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

&lt;p&gt;In summary, we've learned how to define middleware in Next.js, explore the two main approaches (custom matcher configuration and conditional statements), and apply middleware to handle redirections, URL rewrites, and the management of cookies and headers. This knowledge will help you take your Next.js applications to the next level by leveraging the flexibility and control that middleware provides.&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>webdev</category>
      <category>typescript</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Mastering Tailwind CSS: Overcome Styling Conflicts with Tailwind Merge and clsx</title>
      <dc:creator>Sheraz Manzoor</dc:creator>
      <pubDate>Tue, 03 Sep 2024 18:38:20 +0000</pubDate>
      <link>https://dev.to/sheraz4194/mastering-tailwind-css-overcome-styling-conflicts-with-tailwind-merge-and-clsx-1dol</link>
      <guid>https://dev.to/sheraz4194/mastering-tailwind-css-overcome-styling-conflicts-with-tailwind-merge-and-clsx-1dol</guid>
      <description>&lt;p&gt;People has been asking me to write something on some soft topics for beginners in my email, as I write mostly for Mid-level or senior. So, here is a new article for you beginners, specially for UI Developers 😍.&lt;/p&gt;

&lt;p&gt;Today, let's explore the common challenges developers face when working with Tailwind CSS and how to overcome them using the powerful combination of Tailwind Merge and clsx.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's the problem?
&lt;/h2&gt;

&lt;p&gt;When using Tailwind CSS, you often want to pass custom class names to your components, just like you would with a native HTML element, which allows you to style your components dynamically and override the default styles. However, this can lead to conflicts when the custom class names clash with the base Tailwind classes.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The problem with Tailwind is these conflicts are not predictable. You don't know the outcome really. It doesn't matter if you put this at the front of the class list or at the end, in both cases when you have a conflict, you don't really get the result that you expect.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The default behavior of Tailwind doesn't always align with our intuition, where we expect the last class to take precedence in case of a conflict.&lt;/p&gt;

&lt;h2&gt;
  
  
  Introducing Tailwind Merge
&lt;/h2&gt;

&lt;p&gt;The finest solution to this tricky problem is a utility function called Tailwind Merge. This function intelligently merges conflicting Tailwind classes. It makes sure that the last class wins, which aligns with our expectations.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&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;twMerge&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;tailwind-merge&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;containerClasses&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;twMerge&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;bg-blue-500 text-white px-4 py-2 rounded&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;bg-red-500&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In example above, the &lt;code&gt;twMerge&lt;/code&gt; function takes the base Tailwind classes and the custom class name as arguments, and returns the merged result. This way, the &lt;code&gt;bg-re-500&lt;/code&gt; class will override the &lt;code&gt;bg-blue-500&lt;/code&gt; class, as expected.&lt;/p&gt;

&lt;h2&gt;
  
  
  Handling Conditional Classes
&lt;/h2&gt;

&lt;p&gt;Another common scenario is when you need to apply different classes based on a condition, such as a component's state. Tailwind Merge makes this easy to manage as well:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;buttonClasses&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;twMerge&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;bg-blue-500 text-white px-4 py-2 rounded&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;bg-green-500&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;isLoading&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;bg-gray-500&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this case, if the &lt;code&gt;isLoading&lt;/code&gt; variable is true, the &lt;code&gt;bg-gray-500&lt;/code&gt; class will be added to the final class string.&lt;/p&gt;

&lt;h2&gt;
  
  
  Introducing clsx
&lt;/h2&gt;

&lt;p&gt;While Tailwind Merge solves the problem of conflicting classes, some developers prefer to use an object-based syntax for conditional classes. This is where the clsx library comes in handy.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;clsx&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;clsx&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;buttonClasses&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;twMerge&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="nf"&gt;clsx&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;bg-blue-500 cursor-not-allowed&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;loading&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;bg-gray-500 cursor-pointer&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;loading&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;text-white px-4 py-2 rounded&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By using clsx, you can now define your conditional classes in an object-based format, which some developers find more intuitive.&lt;/p&gt;

&lt;h2&gt;
  
  
  Combining the powers of Tailwind Merge and clsx
&lt;/h2&gt;

&lt;p&gt;To get the best of both worlds, you can combine Tailwind Merge and clsx using a custom utility function:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&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;twMerge&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;tailwind-merge&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;clsx&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;clsx&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;const&lt;/span&gt; &lt;span class="nx"&gt;cn&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(...&lt;/span&gt;&lt;span class="nx"&gt;inputs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;ClassValue&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="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;twMerge&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;clsx&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;inputs&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;This &lt;code&gt;cn&lt;/code&gt; (short for "class names") function first passes the input classes through clsx, which handles the object-based conditional classes, and then passes the result to Tailwind Merge to resolve any conflicts.&lt;/p&gt;

&lt;p&gt;Now, you can use this &lt;code&gt;cn&lt;/code&gt; function in your components with both syntaxes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;buttonClasses&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;cn&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;bg-blue-500&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;pending&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;bg-gray-500&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;pending&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;text-white px-4 py-2 rounded&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;OR&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;buttonClasses&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;cn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
 &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;text-white px-4 py-2 rounded&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;pending&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;bg-blue-500&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;bg-gray-500&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; 
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This approach allows you to leverage the strengths of both Tailwind Merge and clsx together, providing a flexible and intuitive way to manage your component styles.&lt;/p&gt;

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

&lt;p&gt;In conclusion, understanding and mastering the use of Tailwind Merge and clsx can greatly improve your experience when working with Tailwind CSS. By combining these tools, you can effectively manage class conflicts, conditional styles, and create reusable, well-structured components.&lt;/p&gt;

</description>
      <category>tailwindcss</category>
      <category>webdev</category>
      <category>beginners</category>
      <category>ui</category>
    </item>
  </channel>
</rss>
