<?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 CHIRAG BODARYA on Medium]]></title>
        <description><![CDATA[Stories by CHIRAG BODARYA on Medium]]></description>
        <link>https://medium.com/@crbodarya05?source=rss-6b7bf528f501------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*W-amCDC4p_8sdwoe</url>
            <title>Stories by CHIRAG BODARYA on Medium</title>
            <link>https://medium.com/@crbodarya05?source=rss-6b7bf528f501------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 03:08:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@crbodarya05/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[I Replaced 15 Developer Tools with AI — Here’s What Actually Happened]]></title>
            <link>https://medium.com/@crbodarya05/i-replaced-15-developer-tools-with-ai-heres-what-actually-happened-802e8a6192a9?source=rss-6b7bf528f501------2</link>
            <guid isPermaLink="false">https://medium.com/p/802e8a6192a9</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[CHIRAG BODARYA]]></dc:creator>
            <pubDate>Wed, 22 Jul 2026 17:44:12 GMT</pubDate>
            <atom:updated>2026-07-22T17:44:12.286Z</atom:updated>
            <content:encoded><![CDATA[<p>After 4+ years as a full-stack developer, I challenged myself to replace as many traditional development tools as possible with AI. Some tools completely changed my workflow. Others were a huge disappointment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sUEE72D1p7ciVL7MUMzoMA.png" /></figure><h3>We Are Entering a New Era of Software Development</h3><p>A few years ago, building software meant jumping between dozens of websites, documentation pages, Stack Overflow answers, browser tabs, and debugging tools.</p><p>Today?</p><p>AI promises to replace almost everything.</p><p>According to social media, AI can:</p><ul><li>Write code</li><li>Debug applications</li><li>Explain documentation</li><li>Generate UI</li><li>Write SQL</li><li>Review pull requests</li><li>Create APIs</li><li>Fix bugs</li><li>Generate tests</li><li>Write deployment scripts</li></ul><p>It sounds amazing.</p><p>But after months of actually using AI every day as a developer, I realized something surprising…</p><p><strong>AI doesn’t replace every tool equally.</strong></p><p>Some tools became almost useless.</p><p>Others remain impossible to replace.</p><p>So I decided to document my real workflow.</p><p>No hype.</p><p>No marketing.</p><p>Just honest results.</p><h3>My Old Development Workflow</h3><p>Before AI became part of my daily work, my browser usually looked like this:</p><ul><li>Stack Overflow</li><li>MDN Documentation</li><li>React Documentation</li><li>Tailwind Documentation</li><li>GitHub Issues</li><li>npm Website</li><li>Google Search</li><li>CSS Tricks</li><li>Postman</li><li>JSON Formatter</li><li>Regex Testing Website</li><li>Lorem Ipsum Generator</li><li>Color Palette Website</li><li>Chat Applications</li><li>Translation Tools</li></ul><p>Sometimes I had over <strong>40 browser tabs open</strong>.</p><p>Finding answers often took longer than actually writing code.</p><p>Every small problem meant another Google search.</p><h3>Then I Tried Replacing Everything with AI</h3><p>For one month, I challenged myself:</p><blockquote><em>Before opening another website, ask AI first.</em></blockquote><p>Whenever I needed help, I started with AI.</p><p>Not Google.</p><p>Not Stack Overflow.</p><p>Not documentation.</p><p>Just AI.</p><p>The results surprised me.</p><h3>The 15 Developer Tools I Tried Replacing</h3><pre>| Traditional Tool        | Replaced with AI? | Result                             |<br>| ----------------------- | ----------------- | ---------------------------------- |<br>| Google Search           | ✅ Yes             | Huge improvement                   |<br>| Stack Overflow          | ✅ Mostly          | Massive time saver                 |<br>| MDN Docs                | ✅ Mostly          | Faster learning                    |<br>| React Docs              | ✅ Mostly          | Better explanations                |<br>| Tailwind Docs           | ✅ Mostly          | Great for examples                 |<br>| SQL Query Generator     | ✅ Yes             | Excellent                          |<br>| Regex Generator         | ✅ Yes             | Much easier                        |<br>| JSON Formatter          | ⚠️ Sometimes      | Depends on data size               |<br>| Postman                 | ❌ No              | Still essential                    |<br>| GitHub Issues           | ⚠️ Partially      | AI gives ideas but not real issues |<br>| CSS Generator           | ✅ Yes             | Excellent                          |<br>| Unit Test Generator     | ✅ Yes             | Huge productivity boost            |<br>| Git Command Cheatsheets | ✅ Yes             | Never search again                 |<br>| API Documentation       | ⚠️ Partially      | Still need official docs           |<br>| Browser DevTools        | ❌ Never           | Impossible to replace              |</pre><h3>What AI Completely Replaced</h3><h3>1. Google Search</h3><p>This was the biggest change.</p><p>Earlier I searched:</p><pre>React useEffect dependency array</pre><p>Then I opened five websites.</p><p>Read three articles.</p><p>Ignored two outdated answers.</p><p>Finally solved the problem.</p><p>Now I simply ask:</p><blockquote><em>Why is my useEffect running twice?</em></blockquote><p>AI usually explains:</p><ul><li>Why it happens</li><li>Common mistakes</li><li>Correct solution</li><li>Example code</li><li>Best practices</li></ul><p>One answer.</p><p>Done.</p><h3>2. Stack Overflow</h3><p>Don’t get me wrong.</p><p>Stack Overflow is still one of the greatest developer communities.</p><p>But searching multiple similar questions became exhausting.</p><p>AI gives context.</p><p>Instead of copying code, it explains <em>why</em> something works.</p><p>That’s a huge difference.</p><p>I still visit Stack Overflow when researching edge cases, but probably <strong>80% less</strong> than before.</p><h3>3. SQL Query Builders</h3><p>Need a complex SQL query?</p><p>Instead of remembering JOIN syntax…</p><p>I simply describe what I need.</p><p>Example:</p><blockquote><em>Get all customers who placed more than five orders this month.</em></blockquote><p>AI generates:</p><ul><li>SQL query</li><li>Explanation</li><li>Optimization tips</li><li>Index suggestions</li></ul><p>Much faster.</p><h3>4. Regex Generators</h3><p>Regex used to feel like magic.</p><p>Now I simply describe what I need.</p><p>Example:</p><blockquote><em>Match Indian mobile numbers with optional +91.</em></blockquote><p>Done.</p><p>No more trial and error.</p><h3>5. Git Commands</h3><p>I no longer memorize commands.</p><p>Instead of searching:</p><pre>Undo last commit but keep changes</pre><p>I ask AI.</p><p>It gives:</p><ul><li>Exact command</li><li>Explanation</li><li>Safe alternatives</li><li>Possible risks</li></ul><h3>Where AI Failed</h3><p>Not everything became easier.</p><p>Some tools remain irreplaceable.</p><h3>1. Browser Developer Tools</h3><p>AI cannot inspect your live application.</p><p>When layout breaks…</p><p>When CSS behaves strangely…</p><p>When JavaScript crashes…</p><p>Chrome DevTools still wins.</p><p>Every time.</p><h3>2. Postman</h3><p>AI can generate API requests.</p><p>But testing authentication…</p><p>Headers…</p><p>Tokens…</p><p>Cookies…</p><p>Response timing…</p><p>Nothing beats Postman or similar API testing tools.</p><h3>3. Official Documentation</h3><p>AI sometimes:</p><ul><li>Misses new features</li><li>Uses outdated APIs</li><li>Invents non-existent methods</li><li>Assumes incorrect versions</li></ul><p>When building production applications…</p><p>Always verify with official documentation.</p><p>Especially for:</p><ul><li>React</li><li>Next.js</li><li>Node.js</li><li>AWS</li><li>Firebase</li></ul><h3>The Biggest Surprise</h3><p>The biggest productivity boost wasn’t writing code.</p><p>It was eliminating <strong>context switching</strong>.</p><p>Previously:</p><p>Google → Documentation → Stack Overflow → GitHub → YouTube → Back to VS Code</p><p>Now:</p><p>VS Code → AI → Continue coding</p><p>Staying focused saves far more time than copying code.</p><h3>Before vs After</h3><pre>| Task                   | Before    | After   |<br>| ---------------------- | --------- | ------- |<br>| Understanding an error | 15–20 min | 3–5 min |<br>| Writing SQL            | 20 min    | 5 min   |<br>| Creating Regex         | 30 min    | 2 min   |<br>| Learning a new API     | 45 min    | 15 min  |<br>| Git command lookup     | 5 min     | 30 sec  |<br>| Boilerplate generation | 25 min    | 3 min   |</pre><p>Overall, I estimate AI reduced my repetitive development work by <strong>30–40%</strong>.</p><p>The biggest benefit wasn’t speed — it was maintaining focus and reducing interruptions.</p><h3>What I Learned</h3><p>AI is an incredible assistant.</p><p>It is <strong>not</strong> a replacement for experience.</p><p>The better you understand programming…</p><p>The better AI becomes.</p><p>Junior developers often ask AI:</p><blockquote><em>Write this feature.</em></blockquote><p>Experienced developers ask:</p><blockquote><em>Improve this architecture.</em></blockquote><p>That difference matters.</p><h3>My Recommendations</h3><p>If you’re a developer in 2026, here’s where I’d start:</p><p>✅ Use AI for:</p><ul><li>Learning new technologies</li><li>Code explanations</li><li>Boilerplate generation</li><li>SQL queries</li><li>Regex</li><li>Refactoring</li><li>Unit tests</li><li>Documentation summaries</li><li>Git commands</li><li>Debugging ideas</li></ul><p>Be cautious when using AI for:</p><ul><li>Security-sensitive code</li><li>Authentication logic</li><li>Performance optimization</li><li>Production architecture</li><li>Framework-specific updates without verification</li></ul><p>Continue relying on:</p><ul><li>Official documentation</li><li>Browser DevTools</li><li>API testing tools</li><li>Version control systems</li><li>Your own engineering judgment</li></ul><h3>Final Thoughts</h3><p>When I began this experiment, I expected AI to replace nearly every tool in my development workflow.</p><p>It didn’t.</p><p>Instead, it changed <strong>how</strong> I use those tools.</p><p>AI isn’t replacing developers.</p><p>It’s replacing repetitive tasks, reducing context switching, and making it easier to focus on solving real problems.</p><p>The developers who thrive won’t be the ones who avoid AI — or blindly trust it. They’ll be the ones who know when to use it, when to verify it, and when to rely on their own experience.</p><p>For me, AI didn’t eliminate 15 tools completely. It transformed the way I work with them — and that has made me a faster, more confident developer.</p><h3>Key Takeaways</h3><ul><li>AI replaced many repetitive development tasks, but not every tool.</li><li>Browser DevTools and API testing tools remain essential.</li><li>Official documentation is still the source of truth.</li><li>The biggest productivity gain comes from reducing context switching.</li><li>AI works best as a knowledgeable assistant, not as a replacement for engineering judgment.</li></ul><h3>Frequently Asked Questions</h3><h3>Can AI completely replace Stack Overflow?</h3><p>For many day-to-day questions, yes. However, Stack Overflow remains valuable for niche issues, historical discussions, and community-validated solutions.</p><h3>Is AI safe to use for production code?</h3><p>AI is useful for generating and explaining code, but always review, test, and validate anything that goes into production.</p><h3>Which developers benefit the most from AI?</h3><p>Developers with solid programming fundamentals tend to get the most value because they can verify AI’s suggestions and ask better questions.</p><h3>What’s the biggest productivity improvement?</h3><p>Reducing context switching. Spending less time jumping between search results and more time staying in your coding environment has the greatest impact.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=802e8a6192a9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React 19 Complete Guide (2026): New Features, Hooks, Performance Improvements & Real Examples]]></title>
            <link>https://medium.com/@crbodarya05/react-19-complete-guide-2026-new-features-hooks-performance-improvements-real-examples-0dc39820c005?source=rss-6b7bf528f501------2</link>
            <guid isPermaLink="false">https://medium.com/p/0dc39820c005</guid>
            <category><![CDATA[react-19-guide]]></category>
            <category><![CDATA[useoptimistic]]></category>
            <category><![CDATA[react-19-features]]></category>
            <category><![CDATA[react-19]]></category>
            <category><![CDATA[useactionstate]]></category>
            <dc:creator><![CDATA[CHIRAG BODARYA]]></dc:creator>
            <pubDate>Sat, 04 Jul 2026 16:04:06 GMT</pubDate>
            <atom:updated>2026-07-04T16:04:06.490Z</atom:updated>
            <content:encoded><![CDATA[<p>Learn everything about React 19 — from Actions and useActionState to useOptimistic, the use() API, React Compiler, performance improvements, migration tips, real-world examples, and best practices.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x3Rj9mWutzgKWusweW56wQ.png" /></figure><p>React has become one of the most influential JavaScript libraries for building modern web applications. Since its initial release by Facebook in 2013, it has transformed the way developers create user interfaces by introducing a component-based architecture, efficient rendering through the Virtual DOM, and a declarative programming model. Today, React powers thousands of applications ranging from personal portfolios and startup products to enterprise platforms used by millions of users every day.</p><p>React 19 represents one of the most significant releases in the library’s history. Rather than introducing only incremental improvements, this version focuses on simplifying common development patterns, reducing boilerplate code, improving application performance, and enhancing the overall developer experience. Features such as Actions, the use() API, useOptimistic, built-in document metadata support, asset loading improvements, and better hydration diagnostics solve many long-standing challenges that developers previously addressed using custom solutions or third-party libraries. In this guide, we’ll explore every major React 19 feature with practical examples, explain why these improvements matter, compare React 19 with previous versions, and discuss best practices for building modern React applications.</p><h3>1. React Release Timeline</h3><p>Instead of just listing versions, create a proper timeline.</p><pre>| Version  | Release Date   | Major Highlights                                                             |<br>| -------- | -------------- | ---------------------------------------------------------------------------- |<br>| React 16 | September 2017 | Fiber architecture, Error Boundaries, Portals, Fragments                     |<br>| React 17 | October 2020   | No new developer APIs, gradual upgrades, improved event delegation           |<br>| React 18 | March 2022     | Concurrent Rendering, Automatic Batching, Suspense improvements, Transitions |<br>| React 19 | December 2024  | Actions, use(), useOptimistic, Metadata, Asset Loading, Better Hydration     |</pre><h3>React 16 (September 2017)</h3><p>React 16 marked one of the biggest architectural changes in React’s history with the introduction of the Fiber rendering engine. Fiber completely redesigned React’s reconciliation process, enabling asynchronous rendering and laying the foundation for future features such as Concurrent Rendering. This release also introduced Error Boundaries for graceful error handling, Fragments to avoid unnecessary wrapper elements, and Portals for rendering components outside their parent DOM hierarchy.</p><h3>React 17 (October 2020)</h3><p>Unlike previous releases, React 17 focused primarily on making upgrades easier rather than introducing new APIs. The event system was rewritten to improve compatibility between different React versions, allowing developers to gradually migrate large applications. Although React 17 appeared to be a small release, it prepared the ecosystem for the much larger architectural improvements introduced in React 18.</p><h3>React 18 (March 2022)</h3><p>React 18 introduced Concurrent Rendering, allowing React to interrupt and prioritize rendering tasks for smoother user experiences. Automatic Batching reduced unnecessary renders by grouping multiple state updates together, while features like Suspense for data fetching and the new Transition APIs made applications more responsive. Although React 18 significantly improved performance, developers still had to write considerable boilerplate for forms, async operations, and optimistic UI updates.</p><h3>React 19 (December 2024)</h3><p>React 19 builds upon the foundation established by React 18 by introducing features that simplify everyday development. Instead of relying heavily on third-party libraries or custom patterns, developers can now use built-in APIs such as Actions, useActionState, useOptimistic, and the new use() function to manage asynchronous operations more efficiently. React 19 also improves hydration error reporting, optimizes asset loading, adds document metadata support, and lays the groundwork for future automatic optimizations through the React Compiler.</p><h3>Why React Has Continued to Evolve</h3><p>React has never been about simply adding more features. Each major release has focused on solving real-world development challenges while maintaining backward compatibility wherever possible. As web applications have grown more interactive and data-driven, React has continuously adapted to reduce complexity, improve performance, and provide developers with more intuitive APIs. React 19 continues this philosophy by making asynchronous programming, server interactions, and application optimization easier than ever before.</p><h3>2. Why React 19 Matters</h3><h3>Problems in React 18</h3><p>Although React 18 introduced Concurrent Rendering and several performance improvements, many everyday development tasks still required significant boilerplate code. Developers often relied on external libraries for form handling, optimistic UI updates, document metadata management, and asynchronous state management. Handling server actions, loading states, error states, and pending submissions usually meant writing repetitive code, making applications harder to maintain as they grew larger.</p><h3>Goals of React 19</h3><p>React 19 aims to simplify these common workflows by introducing built-in solutions for many of these challenges. Rather than forcing developers to manually manage asynchronous state or integrate multiple third-party libraries, React now provides first-class APIs that make code cleaner, more predictable, and easier to maintain. The overall goal is to help developers write less code while building faster, more reliable applications.</p><h3>Developer Experience Improvements</h3><p>React 19 significantly enhances the developer experience through simplified APIs, better debugging tools, clearer hydration error messages, and built-in support for common application patterns. Developers spend less time writing boilerplate code and more time focusing on business logic, resulting in faster development cycles and improved code quality.</p><h3>Performance Improvements</h3><p>Performance remains a central focus of React 19. The framework now optimizes resource loading, reduces unnecessary rendering work, improves scheduling efficiency, and prepares applications for future compiler-based optimizations. These enhancements contribute to faster initial page loads, smoother interactions, and improved responsiveness across a wide range of devices.</p><h3>3. Latest React Version</h3><p>Instead of only writing “Current version”, expand it.</p><h3>Current Stable Version</h3><p>React 19 is the latest stable major release of the React library. It introduces numerous new APIs while maintaining compatibility with most existing React applications. Developers can gradually adopt React 19 without needing to rewrite their projects from scratch.</p><h3>Release Date</h3><p>The stable version of React 19 was officially released in <strong>December 2024</strong> after an extensive beta and release candidate period. The release focused on production-ready improvements rather than experimental features, making it suitable for both new and existing applications.</p><h3>Supported Environments</h3><p>React 19 supports all modern browsers, including the latest versions of Chrome, Firefox, Safari, and Edge. It also works seamlessly with popular frameworks such as Next.js, Remix, React Router, Vite, and many server-side rendering environments.</p><h3>Installation</h3><p>Show:</p><pre>npm install react react-dom</pre><pre>yarn add react react-dom</pre><pre>pnpm add react react-dom</pre><p>Then explain that existing React 18 projects can typically upgrade by updating react and react-dom to version 19 and verifying that dependencies are compatible.</p><h3>4. What’s New in React 19 (Overview)</h3><p>Before discussing each feature individually, provide readers with a high-level overview of the improvements introduced in React 19. This release focuses on reducing boilerplate, improving asynchronous workflows, enhancing rendering performance, and making React applications easier to build and maintain. Many capabilities that previously required third-party libraries are now included directly within React, resulting in a cleaner development experience and better application performance.</p><p>Then include your table:</p><pre>| Feature                 | Available in React 19 |<br>| ----------------------- | --------------------- |<br>| Actions                 | ✅                     |<br>| useActionState          | ✅                     |<br>| useOptimistic           | ✅                     |<br>| use()                   | ✅                     |<br>| Document Metadata       | ✅                     |<br>| Asset Loading           | ✅                     |<br>| Better Hydration Errors | ✅                     |<br>| Improved Suspense       | ✅                     |<br>| React Compiler          | Experimental          |</pre><p>After the table, add a short transition paragraph explaining that the following sections will examine each feature in detail with real-world examples, benefits, and best practices.</p><h3>5. Actions</h3><h3>Introduction</h3><p>Actions are one of the most exciting additions in React 19. They provide a simpler and more intuitive way to handle asynchronous operations such as form submissions, server requests, and data mutations. Before React 19, developers typically had to manage multiple state variables like loading, error, and success while coordinating asynchronous logic manually. Actions eliminate much of this boilerplate by allowing developers to write cleaner, more declarative code that automatically tracks the state of asynchronous operations.</p><p>Instead of focusing on how an asynchronous task should be managed internally, developers can now describe what should happen when an action is performed, and React handles the underlying state transitions. This makes applications easier to maintain, reduces repetitive code, and improves the overall developer experience.</p><h3>Why Actions Were Introduced</h3><p>Modern web applications perform numerous asynchronous tasks, including user authentication, creating blog posts, uploading files, updating user profiles, processing payments, and submitting forms. Managing these operations traditionally required developers to write repetitive logic for loading indicators, error handling, and successful responses.</p><p>React 19 introduces Actions to simplify these common workflows. By integrating asynchronous operations directly into React’s rendering model, developers can focus on business logic instead of managing multiple pieces of UI state. This approach results in more readable code, fewer bugs, and a better user experience.</p><h3>Before React 19</h3><p>Before React 19, developers commonly implemented form submissions like this:</p><pre>const [loading, setLoading] = useState(false);<br>const [error, setError] = useState(null);<br><br>async function handleSubmit() {<br>  setLoading(true);<br><br>  try {<br>    await saveUser();<br>  } catch (err) {<br>    setError(err);<br>  } finally {<br>    setLoading(false);<br>  }<br>}</pre><p>Although this approach works, every asynchronous action requires manually managing multiple state variables. As applications grow larger, this pattern becomes repetitive and difficult to maintain.</p><h3>React 19 Solution</h3><p>React 19 allows developers to define an Action that automatically manages pending states, errors, and asynchronous execution. Instead of writing boilerplate state management, developers simply provide an asynchronous function and let React handle the rest.</p><p>This makes code significantly shorter, easier to understand, and less prone to mistakes.</p><h3>Example</h3><pre>async function submitForm(formData) {<br>  &quot;use server&quot;;<br><br>  await saveUser(formData);<br>}<br><br>&lt;form action={submitForm}&gt;<br>  &lt;button type=&quot;submit&quot;&gt;Save User&lt;/button&gt;<br>&lt;/form&gt;</pre><p>In this example, the form directly invokes an asynchronous Action. React automatically manages the submission lifecycle, allowing developers to focus on the business logic rather than UI state management.</p><h3>Benefits</h3><ul><li>Reduces boilerplate code for asynchronous operations.</li><li>Automatically manages pending and submission states.</li><li>Simplifies form handling.</li><li>Improves code readability.</li><li>Encourages declarative programming.</li><li>Integrates seamlessly with Server Components and Server Actions.</li><li>Makes applications easier to maintain.</li></ul><h3>Best Practices</h3><ul><li>Keep Actions focused on a single responsibility.</li><li>Validate input data before processing.</li><li>Handle server-side errors gracefully.</li><li>Avoid placing complex business logic directly inside components.</li><li>Combine Actions with useActionState for better state management.</li></ul><blockquote><strong>💡 Summary</strong></blockquote><blockquote>Actions simplify asynchronous workflows by removing repetitive loading and error management, allowing developers to write cleaner and more maintainable React applications.</blockquote><h3>6. useActionState Hook</h3><h3>Introduction</h3><p>The useActionState Hook is a new React 19 feature designed to work seamlessly with Actions. It enables developers to track the current state of an Action, including its result, pending status, and any returned values. This makes it much easier to display loading indicators, success messages, or validation errors without manually managing several state variables.</p><h3>Why useActionState Was Introduced</h3><p>Previously, developers often needed multiple useState Hooks to keep track of the outcome of asynchronous operations. For example, a login form might require separate state variables for loading, success, error messages, and response data.</p><p>The useActionState Hook consolidates this logic into a single, easy-to-use API.</p><h3>Before React 19</h3><pre>const [loading, setLoading] = useState(false);<br>const [message, setMessage] = useState(&quot;&quot;);</pre><p>Every asynchronous form required multiple pieces of state.</p><h3>React 19 Solution</h3><pre>const [state, submitAction, isPending] = useActionState(<br>  async (previousState, formData) =&gt; {<br>    return {<br>      message: &quot;User created successfully&quot;<br>    };<br>  },<br>  { message: &quot;&quot; }<br>);</pre><p>The hook automatically provides:</p><ul><li>Current state</li><li>Action function</li><li>Pending status</li></ul><h3>Example</h3><pre>&lt;form action={submitAction}&gt;<br>  &lt;input name=&quot;username&quot; /&gt;<br>  &lt;button disabled={isPending}&gt;<br>    {isPending ? &quot;Saving...&quot; : &quot;Save&quot;}<br>  &lt;/button&gt;<br><br>  &lt;p&gt;{state.message}&lt;/p&gt;<br>&lt;/form&gt;</pre><h3>Benefits</h3><ul><li>Less boilerplate.</li><li>Cleaner state management.</li><li>Easier loading indicators.</li><li>Built-in pending tracking.</li><li>Better readability.</li><li>Simplified form handling.</li></ul><h3>Best Practices</h3><ul><li>Return predictable state objects.</li><li>Keep state minimal.</li><li>Validate inputs before returning state.</li><li>Separate business logic from presentation.</li></ul><blockquote><strong>💡 Summary</strong></blockquote><blockquote>useActionState centralizes asynchronous form state into a single Hook, making React forms significantly easier to build and maintain.</blockquote><h3>7. useOptimistic Hook</h3><h3>Introduction</h3><p>One of the biggest challenges in modern web applications is making the interface feel fast even when network requests take time. React 19 introduces the useOptimistic Hook to improve perceived performance by updating the UI immediately, before the server confirms the operation.</p><p>Instead of waiting several hundred milliseconds for a response, users see instant feedback, making applications feel significantly more responsive.</p><h3>Why useOptimistic Was Introduced</h3><p>Imagine clicking a “Like” button on a social media post. Users expect the like count to increase instantly. Waiting for the server response makes the interface feel sluggish.</p><p>The useOptimistic Hook solves this problem by allowing developers to display an optimistic version of the UI while the server request is still processing.</p><h3>Before React 19</h3><pre>await likePost();<br>setLikes(newLikes);</pre><p>Users had to wait for the server.</p><h3>React 19 Solution</h3><pre>const [optimisticLikes, addOptimisticLike] =<br>  useOptimistic(likes);<br><br>async function handleLike() {<br>  addOptimisticLike(current =&gt; current + 1);<br><br>  await likePost();<br>}</pre><p>The UI updates immediately.</p><h3>Real-World Examples</h3><ul><li>Facebook Likes</li><li>Instagram Comments</li><li>Twitter Likes</li><li>Shopping Cart</li><li>Task Management Apps</li><li>Chat Applications</li></ul><h3>Benefits</h3><ul><li>Instant feedback.</li><li>Better user experience.</li><li>Faster perceived performance.</li><li>Reduced UI latency.</li><li>Cleaner asynchronous updates.</li></ul><h3>Best Practices</h3><ul><li>Roll back optimistic updates if requests fail.</li><li>Use optimistic updates only when appropriate.</li><li>Keep updates simple.</li><li>Handle server conflicts properly.</li></ul><blockquote><strong><em>💡 Summary</em></strong></blockquote><blockquote><em>useOptimistic allows React applications to feel much faster by updating the interface immediately while background requests continue processing.</em></blockquote><h3>8. use() API</h3><h3>Introduction</h3><p>The new use() API is another major addition in React 19. It allows components to directly consume asynchronous resources such as Promises and Context values without requiring complex data-fetching patterns.</p><p>The API greatly simplifies asynchronous rendering and works especially well with Server Components and Suspense.</p><h3>Why use() Was Introduced</h3><p>Before React 19, developers typically wrote several Hooks to fetch data.</p><pre>useEffect(() =&gt; {<br>   fetchData();<br>}, []);</pre><p>Along with:</p><ul><li>useState</li><li>loading state</li><li>error state</li><li>cleanup logic</li></ul><p>This pattern quickly became repetitive.</p><h3>React 19 Solution</h3><pre>const users = use(fetchUsers());</pre><p>React automatically suspends rendering until the Promise resolves.</p><h3>Example</h3><pre>function Users() {<br>  const users = use(fetchUsers());<br><br>  return (<br>    &lt;&gt;<br>      {users.map(user =&gt; (<br>        &lt;p key={user.id}&gt;{user.name}&lt;/p&gt;<br>      ))}<br>    &lt;/&gt;<br>  );<br>}</pre><h3>Benefits</h3><ul><li>Less boilerplate.</li><li>Cleaner asynchronous code.</li><li>Better Suspense integration.</li><li>Easier server rendering.</li><li>Simplified data fetching.</li></ul><h3>Best Practices</h3><ul><li>Use with Suspense boundaries.</li><li>Handle errors properly.</li><li>Avoid deeply nested asynchronous logic.</li><li>Prefer server-side fetching when possible.</li></ul><blockquote><strong><em>💡 Summary</em></strong></blockquote><blockquote><em>The </em><em>use() API dramatically simplifies asynchronous rendering by allowing components to directly consume Promises and Context values.</em></blockquote><h3>10. Document Metadata Support</h3><h3>Introduction</h3><p>Managing HTML metadata such as page titles, descriptions, canonical URLs, Open Graph tags, and Twitter Cards has traditionally required external libraries like React Helmet. React 19 introduces built-in document metadata support, allowing developers to define metadata directly within React components without relying on additional dependencies.</p><p>This built-in capability simplifies SEO implementation, improves developer productivity, and ensures metadata stays closely tied to the components it describes. It’s especially valuable for applications using Server Components and server-side rendering, where metadata can be generated more efficiently.</p><h3>Why Metadata Support Was Introduced</h3><p>Search engines and social media platforms rely heavily on page metadata to understand and display web content. Before React 19, managing this information typically involved installing and configuring third-party libraries, which added extra dependencies and maintenance overhead.</p><p>By bringing metadata management into React itself, developers can create more streamlined applications with fewer external packages while improving consistency across pages.</p><h3>Before React 19</h3><p>Developers commonly used libraries such as <strong>React Helmet</strong>:</p><pre>import { Helmet } from &quot;react-helmet&quot;;<br><br>function Home() {<br>  return (<br>    &lt;&gt;<br>      &lt;Helmet&gt;<br>        &lt;title&gt;React 19 Guide&lt;/title&gt;<br>        &lt;meta<br>          name=&quot;description&quot;<br>          content=&quot;Learn everything about React 19.&quot;<br>        /&gt;<br>      &lt;/Helmet&gt;<br><br>      &lt;h1&gt;Welcome&lt;/h1&gt;<br>    &lt;/&gt;<br>  );<br>}</pre><p>While effective, this required an additional dependency and configuration.</p><h3>React 19 Solution</h3><p>React 19 allows metadata to be declared directly within components, reducing complexity and improving integration with modern rendering features.</p><pre>function BlogPost() {<br>  return (<br>    &lt;&gt;<br>      &lt;title&gt;React 19 Complete Guide&lt;/title&gt;<br><br>      &lt;meta<br>        name=&quot;description&quot;<br>        content=&quot;Everything you need to know about React 19.&quot;<br>      /&gt;<br><br>      &lt;h1&gt;React 19&lt;/h1&gt;<br>    &lt;/&gt;<br>  );<br>}</pre><h3>Benefits</h3><ul><li>Built-in SEO support without extra libraries.</li><li>Fewer project dependencies.</li><li>Better integration with Server Components and SSR.</li><li>Easier maintenance of page metadata.</li><li>Improved consistency between UI and document metadata.</li></ul><h3>Best Practices</h3><ul><li>Provide a unique &lt;title&gt; and meta description for every page.</li><li>Use descriptive metadata that matches the page content.</li><li>Include Open Graph and Twitter Card tags for better social sharing.</li><li>Keep metadata close to the component it represents.</li><li>Test metadata using browser developer tools and SEO validation tools.</li></ul><blockquote><strong><em>💡 Summary</em></strong></blockquote><blockquote><em>Built-in document metadata support in React 19 removes the need for many third-party SEO libraries, making it easier to create search-engine-friendly applications with cleaner and more maintainable code.</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0dc39820c005" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Send Emails in Node.js Using Gmail SMTP and Nodemailer | Complete Guide]]></title>
            <link>https://medium.com/@crbodarya05/send-emails-in-node-js-using-gmail-smtp-and-nodemailer-complete-guide-59887c3daf84?source=rss-6b7bf528f501------2</link>
            <guid isPermaLink="false">https://medium.com/p/59887c3daf84</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[nodemailer]]></category>
            <category><![CDATA[backend-development]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[expressjs]]></category>
            <dc:creator><![CDATA[CHIRAG BODARYA]]></dc:creator>
            <pubDate>Sat, 27 Jun 2026 09:48:57 GMT</pubDate>
            <atom:updated>2026-06-27T09:55:07.879Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="nodejs-gmail-smtp-nodemailer-guide.png" src="https://cdn-images-1.medium.com/max/1024/1*jS0vh-rvtcZCd8mB2Hc0Vw.png" /></figure><p>Almost every modern web application sends emails to its users. Whether it’s a welcome email after registration, an OTP for account verification, a password reset link, or an order confirmation, email communication has become an essential part of web development.</p><p>In this tutorial, we will build a complete email-sending API using <strong>Node.js</strong>, <strong>Express.js</strong>, <strong>Gmail SMTP</strong>, and <strong>Nodemailer</strong>. Starting from creating a Gmail SMTP configuration to testing the API in Postman, every step will be explained in detail. By the end of this guide, you’ll have a production-ready email service that you can integrate into any Node.js application.</p><h3>What is SMTP?</h3><p>Before writing any code, it’s important to understand what SMTP is.</p><p>SMTP (Simple Mail Transfer Protocol) is the standard protocol used to send emails over the internet. Whenever an application sends an email, it doesn’t send it directly to the recipient’s inbox. Instead, it connects to an SMTP server, which is responsible for delivering the email to the recipient’s email provider.</p><p>Think of SMTP as a delivery service. Your application prepares the email, the SMTP server transports it, and the recipient receives it in their inbox.</p><h3>Why Do We Need an SMTP Server?</h3><p>A Node.js application cannot send emails directly because it doesn’t have permission to communicate with mail providers like Gmail or Outlook.</p><p>Instead, your application sends the email to an SMTP server. The SMTP server authenticates your application, verifies the sender, and securely delivers the email to the recipient.</p><p>Some common SMTP providers include:</p><ul><li>Gmail SMTP</li><li>Outlook SMTP</li><li>Zoho Mail</li><li>Brevo</li><li>Mailgun</li><li>Amazon SES</li><li>SendGrid</li></ul><p>For this tutorial, we will use <strong>Gmail SMTP</strong> because it is free for personal use and easy to configure.</p><h3>Is Gmail SMTP Free?</h3><p>Yes. Gmail provides a free SMTP server that developers can use for learning, testing, and small projects.</p><p>However, there are some limitations:</p><ul><li>Daily sending limits apply.</li><li>You must enable Two-Step Verification.</li><li>You need to create an App Password instead of using your Gmail password.</li><li>It is ideal for development and small applications but not recommended for high-volume production systems.</li></ul><h3>Create a Gmail SMTP Account (Step-by-Step)</h3><p>In this section, we will configure Gmail so it can be used as an SMTP server.</p><h3>Step 1: Create or Sign In to Your Google Account</h3><p>Open your browser and visit:</p><p><a href="https://accounts.google.com/">https://accounts.google.com/</a></p><p>Sign in with the Gmail account you want to use for sending emails.</p><h3>Step 2: Open Google Account Settings</h3><p>After logging in:</p><ol><li>Click your profile picture.</li><li>Select <strong>Manage your Google Account</strong>.</li></ol><h3>Step 3: Enable Two-Step Verification</h3><p>From the left sidebar:</p><p>Security → Two-Step Verification</p><p>Click <strong>Get Started</strong> and complete the verification process.</p><p>This step is mandatory because Gmail only allows App Passwords after Two-Step Verification is enabled.</p><h3>Step 4: Open App Passwords</h3><p>Go to:</p><p>Security → App Passwords</p><p>If you cannot see this option:</p><ul><li>Make sure Two-Step Verification is enabled.</li><li>Ensure you are using a personal Google account.</li><li>Some Workspace accounts may have this feature disabled by the administrator.</li></ul><h3>Step 5: Create an App Password</h3><p>Click <strong>App Passwords</strong>.</p><p>Choose:</p><blockquote>App Name:<br>Node.js Email API</blockquote><p>Click <strong>Create</strong>.</p><p>Google will generate a 16-character password.</p><blockquote>Example:</blockquote><blockquote>abcd efgh ijkl mnop</blockquote><p>Copy this password and save it safely.</p><p>Do not use your Gmail account password inside your Node.js application.</p><h3>Step 6: Create the Node.js Project</h3><p>Now that Gmail SMTP is configured, let’s create the backend project.</p><p>Create a new project folder:</p><pre>mkdir node-email-api<br>cd node-email-api<br>npm init -y</pre><p>Install the required packages:</p><pre>npm install express nodemailer dotenv cors<br>npm install - save-dev nodemon</pre><h3>Project Folder Structure</h3><p>node-email-api/</p><pre>├── src/<br>│ ├── config/<br>│ │ └── smtp.config.js<br>│ │<br>│ ├── controllers/<br>│ │ └── email.controller.js<br>│ │<br>│ ├── routes/<br>│ │ └── email.routes.js<br>│ │<br>│ ├── services/<br>│ │ └── email.service.js<br>│ │<br>│ ├── templates/<br>│ │ └── welcome.template.js<br>│ │<br>│ ├── app.js<br>│ └── server.js<br>│<br>├── .env<br>├── package.json</pre><h3>Understanding the Project Folder Structure</h3><p>Before we start writing code, let’s understand why we created these folders. Organizing the project into separate folders makes the code easier to maintain, debug, and scale as the application grows.</p><pre>| Folder          | Purpose                                                                        |<br>| --------------- | ------------------------------------------------------------------------------ |<br>| **config**      | Stores reusable configuration files such as the Gmail SMTP transporter.        |<br>| **controllers** | Receives requests from the client, processes the data, and returns a response. |<br>| **routes**      | Defines all API endpoints and connects them to their respective controllers.   |<br>| **services**    | Contains the business logic, such as sending emails using Nodemailer.          |<br>| **templates**   | Stores reusable HTML email templates.                                          |<br>| **app.js**      | Configures the Express application, middleware, and routes.                    |<br>| **server.js**   | Starts the Express server and listens for incoming requests.                   |<br>| **.env**        | Stores sensitive environment variables like SMTP credentials.                  |</pre><p>By separating the project into different folders, each file has a single responsibility, making the application much easier to understand and maintain.</p><h3>Create the .env File</h3><p>First, create a new file named <strong>.env</strong> in the project root directory. This file stores your SMTP credentials securely, so you don&#39;t need to hardcode sensitive information like your Gmail address or App Password.</p><p>Create the file and add the following code:</p><pre>SMTP_HOST=smtp.gmail.com<br>SMTP_PORT=587<br>SMTP_EMAIL=yourgmail@gmail.com<br>SMTP_PASSWORD=your_app_password<br>FROM_EMAIL=yourgmail@gmail.com</pre><p>Explain every variable.</p><h3>Step 7: Configure the Gmail SMTP Transport</h3><p>Now that we’ve added our SMTP credentials to the .env file, it&#39;s time to connect our Node.js application to Gmail&#39;s SMTP server.</p><p>To do this, we’ll create a reusable SMTP transporter using <strong>Nodemailer</strong>. Instead of writing the SMTP configuration every time we send an email, we’ll create it once and reuse it throughout the project.</p><h3>Create the smtp.config.js File</h3><p>Open the following file:</p><pre>src/config/smtp.config.js</pre><p>Now add the following code:</p><pre>const nodemailer = require(&quot;nodemailer&quot;);<br>require(&quot;dotenv&quot;).config();</pre><pre>const transporter = nodemailer.createTransport({<br>    host: process.env.SMTP_HOST,<br>    port: process.env.SMTP_PORT,<br>    secure: false,<br>    auth: {<br>        user: process.env.SMTP_EMAIL,<br>        pass: process.env.SMTP_PASSWORD,<br>    },<br>});</pre><pre>module.exports = transporter;</pre><h3>Understanding the Code</h3><p>Let’s understand what each part of the code does.</p><ul><li><strong>host</strong> — Specifies the SMTP server. Since we’re using Gmail, the value is smtp.gmail.com.</li><li><strong>port</strong> — Gmail uses port 587 for TLS connections.</li><li><strong>secure</strong> — We set this to false because port 587 uses TLS instead of SSL.</li><li><strong>auth.user</strong> — Your Gmail address.</li><li><strong>auth.pass</strong> — The App Password generated from your Google account.</li></ul><p>By exporting the transporter, we can use the same SMTP connection anywhere in our application.</p><h3>Step 8: Create the HTML Email Template</h3><p>Instead of sending plain text emails, let’s create a simple HTML email template. Keeping the template in a separate file makes it easier to update the email design in the future.</p><p>Create the following file:</p><pre>src/templates/welcome.template.js</pre><p>Add the following code:</p><pre>const welcomeTemplate = (name) =&gt; {<br>    return `<br>        &lt;div style=&quot;font-family: Arial, sans-serif; padding:20px;&quot;&gt;<br>            &lt;h2&gt;Welcome ${name} 👋&lt;/h2&gt;</pre><pre>            &lt;p&gt;Thank you for registering with our application.&lt;/p&gt;</pre><pre>            &lt;p&gt;Your account has been created successfully.&lt;/p&gt;</pre><pre>            &lt;a<br>                href=&quot;https://yourwebsite.com&quot;<br>                style=&quot;<br>                    display:inline-block;<br>                    padding:12px 20px;<br>                    background:#2563eb;<br>                    color:#ffffff;<br>                    text-decoration:none;<br>                    border-radius:5px;<br>                &quot;<br>            &gt;<br>                Visit Website<br>            &lt;/a&gt;</pre><pre>            &lt;p style=&quot;margin-top:20px;&quot;&gt;<br>                Regards,&lt;br&gt;<br>                Node.js Team<br>            &lt;/p&gt;<br>        &lt;/div&gt;<br>    `;<br>};</pre><pre>module.exports = welcomeTemplate;</pre><h3>Why Are We Creating a Separate Template?</h3><p>Keeping HTML in a separate file has several advantages:</p><ul><li>The controller stays clean.</li><li>The email design can be updated without changing the API logic.</li><li>The same template can be reused for different email types.</li><li>It becomes easier to maintain large projects.</li></ul><h3>Step 9: Create the Email Service</h3><p>The email service contains all the logic for sending emails. Whenever another part of the application needs to send an email, it will call this service instead of writing SMTP code again.</p><p>Create the following file:</p><pre>src/services/email.service.js</pre><p>Add the following code:</p><pre>const transporter = require(&quot;../config/smtp.config&quot;);<br>const welcomeTemplate = require(&quot;../templates/welcome.template&quot;);</pre><pre>const sendEmail = async ({ to, subject, name }) =&gt; {<br>    const mailOptions = {<br>        from: process.env.FROM_EMAIL,<br>        to,<br>        subject,<br>        html: welcomeTemplate(name),<br>    };</pre><pre>    return await transporter.sendMail(mailOptions);<br>};</pre><pre>module.exports = sendEmail;</pre><h3>Understanding the Code</h3><p>Let’s understand what this file does.</p><ul><li>First, we import the SMTP transporter.</li><li>Next, we import the HTML email template.</li><li>Then, we create a mailOptions object that contains all the email information.</li><li>Finally, we use transporter.sendMail() to send the email.</li></ul><p>The advantage of using a service is that all email-related logic stays in one place.</p><h3>Step 10: Create the Email Controller</h3><p>The controller receives the API request from the client. It reads the request data, calls the email service, and returns the response.</p><p>Create the following file:</p><pre>src/controllers/email.controller.js</pre><p>Add the following code:</p><pre>const sendEmail = require(&quot;../services/email.service&quot;);</pre><pre>const sendEmailController = async (req, res) =&gt; {<br>    try {<br>        const { to, subject, name } = req.body;</pre><pre>        await sendEmail({<br>            to,<br>            subject,<br>            name,<br>        });</pre><pre>        return res.status(200).json({<br>            success: true,<br>            message: &quot;Email sent successfully.&quot;,<br>        });<br>    } catch (error) {<br>        return res.status(500).json({<br>            success: false,<br>            message: error.message,<br>        });<br>    }<br>};</pre><pre>module.exports = {<br>    sendEmailController,<br>};</pre><h3>Why Do We Need a Controller?</h3><p>The controller acts as a bridge between the client and the email service.</p><p>Its responsibilities are:</p><ul><li>Receive the request from Postman or the frontend.</li><li>Read the request body.</li><li>Call the email service.</li><li>Handle errors.</li><li>Return a JSON response to the client.</li></ul><p>This separation keeps the code organized and easier to maintain.</p><h3>Step 11: Create the Email Route</h3><p>Now we need a route that users can call to send an email.</p><p>Whenever this endpoint is called, Express will execute the sendEmailController, which will then use the email service to send the email through Gmail SMTP.</p><p>Create the following file:</p><pre>src/routes/email.routes.js</pre><p>Add the following code:</p><pre>const express = require(&quot;express&quot;);<br>const { sendEmailController } = require(&quot;../controllers/email.controller&quot;);</pre><pre>const router = express.Router();</pre><pre>router.post(&quot;/send&quot;, sendEmailController);</pre><pre>module.exports = router;</pre><p>This route creates the endpoint:</p><pre>POST /api/email/send</pre><p>Whenever this endpoint is called, Express will execute the sendEmailController, which will then use the email service to send the email through Gmail SMTP.</p><h3>Step 12: Create the Express Application (app.js)</h3><p>Now that we have created all the required files, it’s time to connect everything together using Express.</p><p>The app.js file is responsible for:</p><ul><li>Creating the Express application.</li><li>Registering middleware.</li><li>Connecting all API routes.</li><li>Exporting the application so it can be started by the server.</li></ul><p>Create the following file:</p><pre>src/app.js</pre><p>Add the following code:</p><pre>const express = require(&quot;express&quot;);<br>const cors = require(&quot;cors&quot;);</pre><pre>const emailRoutes = require(&quot;./routes/email.routes&quot;);</pre><pre>const app = express();</pre><pre>app.use(cors());</pre><pre>app.use(express.json());</pre><pre>app.use(&quot;/api/email&quot;, emailRoutes);</pre><pre>module.exports = app;</pre><h3>Understanding the Code</h3><p>Let’s understand what each line does.</p><ul><li><strong>express()</strong> creates the Express application.</li><li><strong>cors()</strong> allows requests from different origins.</li><li><strong>express.json()</strong> parses JSON request bodies.</li><li><strong>app.use(“/api/email”, emailRoutes)</strong> registers our email routes.</li><li>Finally, we export the application so it can be used by server.js.</li></ul><h3>Step 13: Create the Server (server.js)</h3><p>The Express application is ready, but it still isn’t running.</p><p>To start our Node.js server, we’ll create a server.js file.</p><p>Create the following file:</p><pre>src/server.js</pre><p>Add the following code:</p><pre>require(&quot;dotenv&quot;).config();</pre><pre>const app = require(&quot;./app&quot;);</pre><pre>const PORT = process.env.PORT || 5000;</pre><pre>app.listen(PORT, () =&gt; {<br>    console.log(`Server is running on <a href="http://localhost:${PORT}`);">http://localhost:${PORT}`);</a><br>});</pre><h3>Understanding the Code</h3><ul><li><strong>dotenv</strong> loads the environment variables.</li><li><strong>PORT</strong> defines the server port.</li><li><strong>app.listen()</strong> starts the Express server.</li><li>Once the server starts successfully, the message is displayed in the terminal.</li></ul><h3>Step 14: Update package.json</h3><p>To make it easier to run the project during development, update the <strong>scripts</strong> section in your package.json file.</p><p>Replace the existing scripts with the following:</p><pre>&quot;scripts&quot;: {<br>    &quot;start&quot;: &quot;node src/server.js&quot;,<br>    &quot;dev&quot;: &quot;nodemon src/server.js&quot;<br>}</pre><p>Now you can start the application by running:</p><pre>npm run dev</pre><h3>Test the Email API Using Postman</h3><p>Congratulations! 🎉</p><p>We have successfully completed the Node.js project setup, configured Gmail SMTP, created the HTML email template, and built the email API.</p><p>Now it’s time to test our API and verify that the email is delivered successfully.</p><p>For testing, we’ll use <strong>Postman</strong>, one of the most popular tools for testing REST APIs.</p><h3>Start the Node.js Server</h3><p>Before sending a request from Postman, make sure your Node.js application is running.</p><p>Open your terminal and run the following command:</p><pre>npm run dev</pre><p>If everything is configured correctly, you’ll see a message similar to this:</p><pre>Server is running on http://localhost:5000</pre><p>If you don’t see this message, double-check your project setup before moving to the next step.</p><h3>Open Postman</h3><p>Launch the Postman application.</p><p>Click the <strong>New</strong> button and create a new <strong>HTTP Request</strong>.</p><h3>Configure the Request</h3><p>Set the request method to:</p><pre>POST</pre><p>Enter the following API URL:</p><pre>http://localhost:5000/api/email/send</pre><blockquote><strong><em>Note:</em></strong><em> Replace </em><em>5000 with your application&#39;s port number if you&#39;re using a different port.</em></blockquote><h3>Add Request Headers</h3><p>Click on the <strong>Headers</strong> tab and add the following header.</p><p>KeyValueContent-Typeapplication/json</p><p>This tells Express that we’re sending JSON data in the request body.</p><h3>Add the Request Body</h3><p>Click on the <strong>Body</strong> tab.</p><p>Select <strong>raw</strong>.</p><p>From the dropdown, choose <strong>JSON</strong>.</p><p>Now paste the following JSON:</p><pre>{<br>    &quot;to&quot;: &quot;recipient@gmail.com&quot;,<br>    &quot;subject&quot;: &quot;Welcome to Our Platform&quot;,<br>    &quot;name&quot;: &quot;John Doe&quot;<br>}</pre><h3>Understanding Each Field</h3><p><strong>to</strong></p><p>The recipient’s email address.</p><pre>&quot;to&quot;:&quot;recipient@gmail.com&quot;</pre><p><strong>subject</strong></p><p>The subject line that appears in the recipient’s inbox.</p><pre>&quot;subject&quot;:&quot;Welcome to Our Platform&quot;</pre><p><strong>name</strong></p><p>This value is passed to our HTML email template and displayed inside the email.</p><pre>&quot;name&quot;:&quot;John Doe&quot;</pre><h3>Send the Request</h3><p>After completing all the configuration, click the <strong>Send</strong> button.</p><p>Postman will send the request to your Express server.</p><p>The Express route will call the controller.</p><p>The controller will call the email service.</p><p>The email service will connect to Gmail SMTP and send the email.</p><h3>API Flow</h3><p>The complete request flow looks like this:</p><pre>Postman</pre><pre>    │</pre><pre>    ▼</pre><pre>POST /api/email/send</pre><pre>    │</pre><pre>    ▼</pre><pre>Express Route</pre><pre>    │</pre><pre>    ▼</pre><pre>Email Controller</pre><pre>    │</pre><pre>    ▼</pre><pre>Email Service</pre><pre>    │</pre><pre>    ▼</pre><pre>Gmail SMTP</pre><pre>    │</pre><pre>    ▼</pre><pre>Recipient Inbox</pre><h3>Expected Success Response</h3><p>If the email is sent successfully, you’ll receive the following response:</p><pre>{<br>    &quot;success&quot;: true,<br>    &quot;message&quot;: &quot;Email sent successfully.&quot;<br>}</pre><p>At the same time, check the recipient’s Gmail inbox.</p><p>You should receive an email similar to this:</p><pre>Subject:<br>Welcome to Our Platform</pre><pre>Hello John Doe 👋</pre><pre>Thank you for registering with our application.</pre><pre>Your account has been created successfully.</pre><pre>[Visit Website]</pre><p>Congratulations! 🎉 Your first email has been sent successfully using Gmail SMTP and Nodemailer.</p><h3>What If You Don’t Receive the Email?</h3><p>Sometimes the email may not appear in the Inbox immediately.</p><p>Check the following folders:</p><ul><li>Inbox</li><li>Spam</li><li>Promotions</li><li>Updates</li></ul><p>If you still can’t find the email, review the server logs in your terminal to identify any SMTP errors.</p><h3>Common Testing Errors</h3><h3>1. Authentication Failed</h3><pre>Invalid login</pre><h3>Reason</h3><p>Your Gmail credentials or App Password is incorrect.</p><h3>Solution</h3><ul><li>Verify the Gmail address.</li><li>Generate a new App Password.</li><li>Update the .env file.</li><li>Restart the server.</li></ul><h3>2. Missing Required Fields</h3><p>If you send an empty request body, the API may fail.</p><p>Example:</p><pre>{}</pre><p>Always send:</p><ul><li>to</li><li>subject</li><li>name</li></ul><h3>3. Invalid Email Address</h3><pre>{<br>    &quot;to&quot;:&quot;abc&quot;<br>}</pre><p>Gmail cannot deliver emails to invalid email addresses.</p><p>Always provide a valid email address.</p><h3>4. Server Not Running</h3><p>If Postman shows an error like:</p><pre>ECONNREFUSED</pre><p>It usually means your Express server is not running.</p><p>Start the server again using:</p><pre>npm run dev</pre><h3>Verify the Email</h3><p>Open the recipient’s Gmail account.</p><p>If everything is configured correctly, you’ll see your welcome email along with the HTML design created earlier.</p><p>This confirms that:</p><ul><li>Gmail SMTP is configured correctly.</li><li>Nodemailer is working properly.</li><li>Your Express API is functioning as expected.</li><li>The HTML email template is rendering successfully.</li></ul><p>Congratulations! You have successfully built and tested your first email-sending API using Node.js, Express.js, Gmail SMTP, and Nodemailer.</p><h3>Best Practices</h3><p>To build secure and maintainable applications, follow these best practices when working with Gmail SMTP and Nodemailer.</p><ul><li>Never expose your Gmail App Password in your source code.</li><li>Store sensitive credentials inside the .env file.</li><li>Add .env to your .gitignore file before pushing your project to GitHub.</li><li>Validate user input before attempting to send an email.</li><li>Keep HTML templates separate from your business logic.</li><li>Reuse the same SMTP transporter instead of creating a new connection for every request.</li><li>Handle SMTP errors gracefully and return meaningful API responses.</li><li>Use Gmail SMTP for development and small projects. For production applications with high email volume, consider services like Amazon SES, SendGrid, or Mailgun.</li></ul><h3>Conclusion</h3><p>Congratulations! 🎉 You have successfully built a complete email-sending API using <strong>Node.js</strong>, <strong>Express.js</strong>, <strong>Gmail SMTP</strong>, and <strong>Nodemailer</strong>.</p><p>Throughout this tutorial, you learned how to configure Gmail SMTP, generate an App Password, organize a scalable project structure, create reusable email templates, implement an email service, build a REST API, and test everything using Postman.</p><p>This architecture can easily be extended to implement features such as:</p><ul><li>User Registration Emails</li><li>OTP Verification</li><li>Password Reset Emails</li><li>Contact Us Forms</li><li>Newsletter Emails</li><li>Invoice Delivery</li><li>Order Confirmation Emails</li></ul><p>As your application grows, you can replace Gmail SMTP with production email providers like Amazon SES, SendGrid, or Mailgun without changing your overall project architecture.</p><p>If you found this tutorial helpful, consider following me for more practical Node.js, Express.js, and backend development tutorials.</p><h3><strong>What You’ll Learn</strong></h3><p>By the end of this tutorial, you’ll learn how to:</p><ul><li>Understand how SMTP works.</li><li>Configure Gmail SMTP with App Passwords.</li><li>Build a Node.js and Express.js email API.</li><li>Create reusable HTML email templates.</li><li>Send emails using Nodemailer.</li><li>Test the API with Postman.</li><li>Apply best practices for secure email sending.</li></ul><p>This improves readability and helps readers know what to expect.</p><blockquote><strong>Note:</strong> Gmail SMTP is ideal for learning, testing, and small projects. For production applications that send large volumes of email, consider dedicated email providers such as Amazon SES, SendGrid, or Mailgun.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=59887c3daf84" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Save Form Data Directly to Google Sheets Using Google Sheets API (Next.js — Step by Step)]]></title>
            <link>https://medium.com/@crbodarya05/how-to-save-form-data-directly-to-google-sheets-using-google-sheets-api-next-js-step-by-step-9e28f96593ef?source=rss-6b7bf528f501------2</link>
            <guid isPermaLink="false">https://medium.com/p/9e28f96593ef</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[google-sheets]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[front-end-development]]></category>
            <dc:creator><![CDATA[CHIRAG BODARYA]]></dc:creator>
            <pubDate>Fri, 23 Jan 2026 10:35:11 GMT</pubDate>
            <atom:updated>2026-01-23T10:37:06.799Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7FBdgiE_KP-C25C_nJO8wA.png" /></figure><h3>How to Save Form Data to Google Sheets Using Google Sheets API in Next.js (Step-by-Step)</h3><p>Learn how to send form data from a Next.js app directly to Google Sheets using Google Sheets API and service account — explained with baby steps.</p><p>Many developers want to save contact form data without using a database. <br>Google Sheets is a free and simple solution.</p><p>In this tutorial, you will learn how to connect a Next.js form with Google Sheets using the Google Sheets API. <br>This guide is written for beginners and covers every step, from Google Cloud setup to saving form data in Google Sheets.</p><h3>Step 1: Create a Google Account</h3><p>If you already have a Google account, you can skip this step.</p><ol><li>Go to <strong>google.com</strong></li><li>Click <strong>Create account</strong></li><li>Complete the signup process</li></ol><p>You will use this account to manage Google Sheets and API access.</p><h3>Step 2: Create a New Google Cloud Project</h3><h3>Step 2.1: Open Google Cloud Console</h3><p>Open this official Google link:</p><p>👉 <a href="https://console.cloud.google.com/"><strong>https://console.cloud.google.com/</strong></a></p><p>Make sure:</p><ul><li>You are logged in with the <strong>same Google account</strong></li><li>Dashboard page is visible</li></ul><p>📌 <em>If this is your first time, Google may ask for basic setup — just click “Continue”</em></p><h3>Step 2.2: Create a New Project</h3><ol><li>Click on <strong>Select a project</strong> (top-left corner)</li><li>Click <strong>New Project</strong></li></ol><p>You will see a form like this:</p><ul><li><strong>Project name</strong>:<br> Example:</li><li>nextjs-google-sheet-form</li><li><strong>Organization</strong>:<br> Leave it as default</li><li><strong>Location</strong>:<br> Leave it as default</li></ul><ol><li>Click <strong>Create</strong></li></ol><p>⏳ It may take <strong>10–20 seconds</strong></p><h3>Step 2.3: Select Your New Project</h3><p>After project creation:</p><ol><li>Click again on <strong>Select a project</strong></li><li>Choose your newly created project</li><li>Make sure project name appears at the top</li></ol><p>✅ Now your Google Cloud Project is active</p><figure><img alt="Create new project" src="https://cdn-images-1.medium.com/max/1024/1*7cDuLB-r7meoeWRp2ENoew.png" /></figure><p>This project will hold your API and service account.</p><h3>Step 3: Enable Google Sheets API</h3><ol><li>Open your project in Google Cloud Console</li><li>Go to <strong>APIs &amp; Services → Library</strong></li><li>Search for <strong>Google Sheets API</strong></li><li>Click <strong>Enable</strong></li></ol><p>Option 2: Search for Google Sheets API</p><ol><li>On the API Library page, you will see a search bar</li><li>Type: Google Sheets API</li><li>Press <strong>Enter</strong></li></ol><p>You will see <strong>Google Sheets API</strong> in the results.</p><figure><img alt="Google sheet API" src="https://cdn-images-1.medium.com/max/1024/1*qhokgbOLFUaYg6CnXUeMFQ.png" /></figure><h3>Step 4: Create a Service Account (Very Important)</h3><h3>Step 4.1: Open Service Accounts Page</h3><p>Open this official Google link:</p><p>👉 <a href="https://console.cloud.google.com/iam-admin/serviceaccounts"><strong>https://console.cloud.google.com/iam-admin/serviceaccounts</strong></a></p><p>Before continuing, check:</p><ul><li>Correct <strong>project name</strong> is selected at the top</li><li>You are inside <strong>Google Cloud Console</strong></li></ul><figure><img alt="Create new service account" src="https://cdn-images-1.medium.com/max/1024/1*1l1xzSXsHzb1TPOUqNCC2w.png" /></figure><h3>Step 4.2: Click “Create Service Account”</h3><ol><li>Click <strong>Create Service Account</strong></li><li>A form will open</li></ol><p>Fill the details:</p><ul><li><strong>Service account name</strong><br> Example: nextjs-sheets-service</li><li><strong>Service account ID</strong><br> (Auto-generated, no need to change)</li><li><strong>Description</strong> (optional)<br> Example: Service account for Next.js Google Sheets API</li></ul><p>3. Click <strong>Create and Continue</strong></p><figure><img alt="new service account details" src="https://cdn-images-1.medium.com/max/990/1*zcWiK90DrcgmLi-rxVfhBw.png" /></figure><h3>Step 4.3: Skip Role Assignment (Important)</h3><p>You will see a section to <strong>Grant this service account access to project</strong>.</p><p>👉 For Google Sheets API, <strong>we do NOT need to add any role here</strong>.</p><ol><li>Leave roles <strong>empty</strong></li><li>Click <strong>Continue</strong></li><li>Click <strong>Done</strong></li></ol><p>✅ Service account is now created.</p><h3>Step 4.4: Copy Service Account Email</h3><p>After creation:</p><ol><li>You will see the service account in the list</li><li>Click on the service account name</li><li>Copy the <strong>Email address</strong></li></ol><p>Example:</p><pre>nextjs-sheets-service@your-project-id.iam.gserviceaccount.com</pre><p>📌 <strong>Save this email</strong><br> We will use it in the next steps.</p><h3>Step 5: Generate Service Account Key (JSON)</h3><ol><li>Open your service account</li></ol><h3>Step 5.2: Go to “Keys” Tab</h3><p>Inside the service account page:</p><ol><li>Click on the <strong>Keys</strong> tab</li><li>You will see a section called <strong>Keys</strong></li></ol><h3>Step 5.3: Create a New Key</h3><ol><li>Click <strong>Add Key</strong></li><li>Select <strong>Create new key</strong></li><li>Choose <strong>JSON</strong></li><li>Click <strong>Create</strong></li></ol><p>⬇️ A .json file will be downloaded automatically</p><p>Example filename:</p><pre>nextjs-sheets-service-123456.json</pre><h3>Step 5.4: Store the JSON File Safely</h3><p>Important rules:</p><ul><li>✅ Store the file on your local system</li><li>❌ Do NOT upload it to GitHub</li><li>❌ Do NOT share it with anyone</li><li>✅ We will copy values from this file later</li></ul><p>📌 You will use:</p><ul><li>client_email</li><li>private_key</li></ul><h3>What Is Inside the JSON File? (Do Not Edit)</h3><p>Example (sample only):</p><pre>{<br>  &quot;type&quot;: &quot;service_account&quot;,<br>  &quot;project_id&quot;: &quot;your-project-id&quot;,<br>  &quot;private_key&quot;: &quot;-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n&quot;,<br>  &quot;client_email&quot;: &quot;your-service@project.iam.gserviceaccount.com&quot;<br>}</pre><p>⚠️ Do NOT change anything inside this file.</p><h3>Step 6: Create Google Sheet</h3><h3>Step 6.1: Open Google Sheets</h3><p>Open this official link:</p><p>👉 <a href="https://sheets.google.com/"><strong>https://sheets.google.com/</strong></a></p><p>Make sure:</p><ul><li>You are logged in with the <strong>same Google account</strong></li><li>Google Sheets dashboard is visible</li></ul><h3>Step 6.2: Create a New Blank Sheet</h3><ol><li>Click on <strong>Blank</strong></li><li>A new spreadsheet will open</li><li>Rename the sheet (top-left)</li></ol><p>Example name:</p><pre>Next.js Contact Form Data</pre><h3>Step 6.3: Add Header Columns (Very Important)</h3><p>In <strong>Row 1</strong>, add column names like this:</p><p>CellValueA1NameB1EmailC1MessageD1Date</p><p>Final header row:</p><pre>Name | Email | Message | Date</pre><p>📌 These headers help keep your data clean and readable.</p><h3>Step 6.4: Do NOT Add Any Data Manually</h3><p>Important rules:</p><ul><li>❌ Do not type test data</li><li>❌ Do not delete header row</li><li>✅ Keep sheet empty after headers</li></ul><p>Your API will add rows automatically.</p><h3>Step 6.5: Keep the Sheet Open</h3><ul><li>Do not close or delete this sheet</li><li>We will use it in the next steps</li><li>Permissions will be added soon</li></ul><h3>Step 7: Copy Google Sheet ID</h3><p>Look at the Google Sheet URL:</p><pre>https://docs.google.com/spreadsheets/d/THIS_IS_SHEET_ID/edit</pre><p>📌 Copy <strong>THIS_IS_SHEET_ID</strong><br> You will use it in your code.</p><h3>Step 8: Give Sheet Edit Permission to Service Account</h3><p>This step is <strong>mandatory</strong>.</p><ol><li>Open the Google Sheet</li><li>Click <strong>Share</strong></li><li>Copy <strong>service account email</strong><br> (from JSON file → client_email)</li><li>Paste email in Share input</li><li>Set permission to <strong>Editor</strong></li><li>Click <strong>Send</strong></li></ol><p>✅ Now API can edit the sheet.</p><h3>Step 9: Create Next.js Project</h3><pre>npx create-next-app google-sheet-form<br>cd google-sheet-form<br>npm run dev</pre><h3>Step 10: Install Required Package</h3><pre>npm install googleapis</pre><h3>Step 11: Setup Environment Variables</h3><p>Create .env.local</p><pre>GOOGLE_CLIENT_EMAIL=your-service-account-email<br>GOOGLE_PRIVATE_KEY=&quot;your-private-key&quot;<br>GOOGLE_SHEET_ID=your-sheet-id</pre><p>⚠️ Important:</p><ul><li>Replace \n correctly in private key</li><li>Keep .env.local private</li></ul><h3>Step 12: Create API Route (Server Side)</h3><p>Create file:</p><pre>/app/api/contact/route.js</pre><pre>import { google } from &quot;googleapis&quot;;</pre><pre>export async function POST(req) {<br>  try {<br>    const body = await req.json();</pre><pre>    const auth = new google.auth.GoogleAuth({<br>      credentials: {<br>        client_email: process.env.GOOGLE_CLIENT_EMAIL,<br>        private_key: process.env.GOOGLE_PRIVATE_KEY.replace(/\\n/g, &quot;\n&quot;),<br>      },<br>      scopes: [&quot;https://www.googleapis.com/auth/spreadsheets&quot;],<br>    });</pre><pre>    const sheets = google.sheets({ version: &quot;v4&quot;, auth });</pre><pre>    await sheets.spreadsheets.values.append({<br>      spreadsheetId: process.env.GOOGLE_SHEET_ID,<br>      range: &quot;A:D&quot;,<br>      valueInputOption: &quot;USER_ENTERED&quot;,<br>      requestBody: {<br>        values: [[<br>          body.name,<br>          body.email,<br>          body.message,<br>          new Date().toLocaleString()<br>        ]],<br>      },<br>    });</pre><pre>    return Response.json({ success: true });<br>  } catch (error) {<br>    return Response.json({ success: false }, { status: 500 });<br>  }<br>}</pre><h3>Step 13: Create Contact Form (Frontend)</h3><pre>&quot;use client&quot;;<br>import { useState } from &quot;react&quot;;</pre><pre>export default function ContactForm() {<br>  const [form, setForm] = useState({<br>    name: &quot;&quot;,<br>    email: &quot;&quot;,<br>    message: &quot;&quot;,<br>  });</pre><pre>  const handleSubmit = async (e) =&gt; {<br>    e.preventDefault();</pre><pre>    await fetch(&quot;/api/contact&quot;, {<br>      method: &quot;POST&quot;,<br>      body: JSON.stringify(form),<br>    });</pre><pre>    alert(&quot;Data saved successfully!&quot;);<br>    setForm({ name: &quot;&quot;, email: &quot;&quot;, message: &quot;&quot; });<br>  };</pre><pre>  return (<br>    &lt;form onSubmit={handleSubmit}&gt;<br>      &lt;input<br>        placeholder=&quot;Name&quot;<br>        value={form.name}<br>        onChange={(e) =&gt; setForm({ ...form, name: e.target.value })}<br>      /&gt;<br>      &lt;input<br>        placeholder=&quot;Email&quot;<br>        value={form.email}<br>        onChange={(e) =&gt; setForm({ ...form, email: e.target.value })}<br>      /&gt;<br>      &lt;textarea<br>        placeholder=&quot;Message&quot;<br>        value={form.message}<br>        onChange={(e) =&gt; setForm({ ...form, message: e.target.value })}<br>      /&gt;<br>      &lt;button type=&quot;submit&quot;&gt;Submit&lt;/button&gt;<br>    &lt;/form&gt;<br>  );<br>}</pre><h3>Step 14: Test the Flow</h3><ol><li>Run project</li><li>Fill the form</li><li>Submit</li><li>Open Google Sheet</li></ol><p>🎉 <strong>Form data will appear instantly</strong></p><h3>✅ Google Sheets Integration Is Now Ready</h3><p>At this point, we have completed <strong>all required Google-side setup</strong>.</p><p>Your system is now fully prepared to receive form data from a <strong>Next.js application</strong> and store it safely inside <strong>Google Sheets</strong>.</p><p>No database is required.<br> No paid service is needed.</p><p>Everything works using <strong>Google Sheets API + Service Account</strong>.</p><h3>🔁 How This Functionality Works (Simple Flow)</h3><p>Here is how the complete flow works:</p><ol><li>User fills the form on your website</li><li>Form data is sent to a Next.js API route</li><li>API route uses <strong>service account key</strong></li><li>Google Sheets API authenticates the request</li><li>Data is added as a new row in Google Sheet</li></ol><p>👉 This process happens <strong>automatically</strong> in the background.</p><h3>🎯 Where You Can Use This Setup</h3><p>This Google Sheets setup is perfect for:</p><ul><li>Contact Us forms</li><li>Portfolio websites</li><li>Feedback forms</li><li>Lead collection pages</li><li>Admin-free data storage</li><li>Small business websites</li></ul><p>It is especially useful when:</p><ul><li>You don’t want to use a database</li><li>You want data in Excel/Sheet format</li><li>You want a quick and free solution</li></ul><h3>🔐 Is This Setup Secure?</h3><p>Yes, this setup is <strong>secure</strong> if you follow these rules:</p><ul><li>Keep service account JSON key private</li><li>Never upload keys to GitHub</li><li>Use environment variables (.env.local)</li><li>Share Google Sheet only with service account email</li></ul><p>Google handles authentication internally, so <strong>no user can access your sheet directly</strong>.</p><h3>⚡ Benefits of Using Google Sheets Instead of Database</h3><ul><li>100% free</li><li>Easy to manage</li><li>No backend database setup</li><li>Data is readable &amp; exportable</li><li>Perfect for beginners</li><li>Ideal for production contact forms</li></ul><h3>📌 Final Note for Beginners</h3><p>If you followed all steps correctly:</p><ul><li>Your Google Sheet is ready</li><li>Your API access is ready</li><li>Your Next.js backend can now send data</li><li>Your form data will be stored automatically</li></ul><p>This setup is <strong>production-ready</strong> and used by many developers for real projects.</p><h3>🚀 What You Can Add Next (Optional)</h3><p>You can improve this feature by adding:</p><ul><li>Email notification after form submit</li><li>Input validation</li><li>Success / error messages</li><li>Google reCAPTCHA (spam protection)</li><li>Admin email alerts</li><li>Analytics tracking</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9e28f96593ef" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React Interview Questions (Basic to Advanced) — A Complete Guide for Developers]]></title>
            <link>https://medium.com/@crbodarya05/react-interview-questions-basic-to-advanced-a-complete-guide-for-developers-772d70edda36?source=rss-6b7bf528f501------2</link>
            <guid isPermaLink="false">https://medium.com/p/772d70edda36</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[interview-questions]]></category>
            <category><![CDATA[frontend]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[CHIRAG BODARYA]]></dc:creator>
            <pubDate>Sun, 04 Jan 2026 19:17:09 GMT</pubDate>
            <atom:updated>2026-01-04T19:31:40.562Z</atom:updated>
            <content:encoded><![CDATA[<h3>React Interview Questions (Basic to Advanced) — A Complete Guide for Developers</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/823/1*cVu4fORKq8PQODVtTi69gw.png" /></figure><h3>Introduction</h3><p>React is one of the most popular JavaScript libraries for building user interfaces.<br> Many companies use React for web applications, so React interview questions are very common.</p><p>In this blog, you will learn <strong>React interview questions with simple answers</strong>.<br> This guide is useful for <strong>freshers, junior developers, and experienced developers</strong>.</p><p>We have divided the questions into <strong>three levels</strong>:</p><ul><li>Basic React Interview Questions</li><li>Medium React Interview Questions</li><li>Advanced React Interview Questions</li></ul><p><strong>🔹 Basic React Interview Questions (For Beginners)</strong></p><h3>1. What is React?</h3><p>React is a <strong>JavaScript library</strong> used to build <strong>user interfaces</strong> for websites.</p><p>It allows developers to create websites using <strong>small reusable components</strong> like buttons, forms, and cards.<br> React makes applications <strong>fast, simple, and easy to maintain</strong>.</p><p>React updates only the changed part of the page, not the full page.</p><h3>2. What is a component in React?</h3><p>A component is a <strong>small piece of the user interface</strong>.</p><p>Each component does one job and can be reused many times.</p><p><em>Examples of components:</em></p><ul><li>Header</li><li>Footer</li><li>Button</li><li>Login form</li></ul><p>Components help keep code <strong>clean and organized</strong>.</p><h3>3. What is JSX?</h3><p>JSX is a <strong>syntax used in React</strong> that looks like HTML.</p><p>It allows us to write HTML inside JavaScript code, which makes code <strong>easy to read and understand</strong>.</p><p>JSX is not HTML, but React converts it into JavaScript.</p><h3>4. What is the virtual DOM?</h3><p>The Virtual DOM is a <strong>lightweight copy of the real DOM</strong>.</p><p>When something changes, React:</p><ol><li>Updates the virtual DOM</li><li>Compares it with the old version</li><li>Updates only the changed part in the real DOM</li></ol><p>This makes React applications <strong>very fast</strong>.</p><h3>5. What are props?</h3><p>Props are used to <strong>send data from one component to another</strong>.</p><p>Props are <strong>read-only</strong>, which means they cannot be changed.</p><p>👉 Example:<br> A parent component sends a username to a child component using props.</p><p>Props help components <strong>communicate with each other</strong>.</p><h3>6. What is State in React?</h3><p>State is used to <strong>store data inside a component</strong>.</p><p>When the state changes, the component <strong>automatically updates the UI</strong>.</p><p>State is mostly used for data that can change, like:</p><ul><li>User input</li><li>Button clicks</li><li>API response data</li></ul><h3>7. Difference between State and Props?</h3><p>StatePropsManaged inside the componentPassed from parent to childCan be changedRead-onlyUsed for dynamic dataUsed to share data</p><p>👉 In simple words:</p><ul><li><strong>State</strong> belongs to the component</li><li><strong>Props</strong> come from outside the component</li></ul><h3>8. What is useState?</h3><p>useState is a <strong>React Hook</strong> used to manage state in functional components.</p><p>Before hooks, state was used only in class components.<br> Now, with useState, we can use state easily in function components.</p><p>It helps React <strong>remember values</strong> between renders.</p><h3>9. What is an Event in React?</h3><p>An event is an <strong>action performed by the user</strong>, such as:</p><ul><li>Clicking a button</li><li>Typing in an input</li><li>Submitting a form</li></ul><p>React handles events using <strong>camelCase</strong>, like onClick and onChange.</p><p>Events help make websites <strong>interactive</strong>.</p><h3>10. What is Conditional Rendering?</h3><p>Conditional rendering means <strong>showing different content based on a condition</strong>.</p><p>👉 Example:</p><ul><li>Show “Login” button if the user is not logged in</li><li>Show “Logout” button if the user is logged in</li></ul><p>This helps display the <strong>right UI at the right time</strong>.</p><h3>🔹 Medium React Interview Questions (For Intermediate Developers)</h3><h3>11. What are React Hooks?</h3><p>React Hooks are <strong>special functions</strong> that allow us to use React features in functional components.</p><p>With hooks, we can:</p><ul><li>Use state</li><li>Handle side effects</li><li>Reuse logic easily</li></ul><p>Hooks make code <strong>clean and simple</strong>.</p><h3>12. What is useEffect?</h3><p>useEffect is a React hook used to <strong>perform side effects</strong> in a component.</p><p>Side effects include:</p><ul><li>Fetching data from an API</li><li>Updating the document title</li><li>Running a timer</li></ul><p>useEffect runs <strong>after the component renders</strong>.</p><h3>13. What is Lifting State Up?</h3><p>Lifting state up means <strong>moving state to a parent component</strong>.</p><p>This is done when <strong>multiple child components need the same data</strong>.</p><p>The parent manages the state and sends data to children using props.</p><h3>14. What is a Controlled Component?</h3><p>A controlled component is an input element <strong>controlled by React state</strong>.</p><p>The input value comes from state, and changes are handled using events.</p><p>Controlled components help keep data <strong>predictable and secure</strong>.</p><h3>15. What is an Uncontrolled Component?</h3><p>An uncontrolled component <strong>manages its own data</strong> using the DOM.</p><p>It uses refs instead of React state.</p><p>Uncontrolled components are simple but <strong>less flexible</strong> than controlled components.</p><h3>16. What is React Router?</h3><p>React Router is a library used for <strong>navigation in React applications</strong>.</p><p>It allows users to move between different pages <strong>without reloading the page</strong>.</p><p>React Router is mostly used to build <strong>single-page applications</strong>.</p><h3>17. What is a Key in React Lists?</h3><p>A key is a <strong>unique value</strong> given to items in a list.</p><p>Keys help React understand:</p><ul><li>Which item is added</li><li>Which item is removed</li><li>Which item is updated</li></ul><p>This improves <strong>performance and rendering speed</strong>.</p><h3>18. What is React.memo?</h3><p>React.memo is used to <strong>optimize performance</strong>.</p><p>It prevents a component from re-rendering if its props have not changed.</p><p>This is useful when working with <strong>large or complex components</strong>.</p><h3>19. What is Context API?</h3><p>Context API is used to <strong>share data globally</strong> in a React app.</p><p>It avoids passing props again and again.</p><p>Context is useful for:</p><ul><li>User login data</li><li>Theme (dark/light mode)</li><li>Language settings</li></ul><h3>20. What is Prop Drilling?</h3><p>Prop drilling means <strong>passing props through many levels</strong> of components.</p><p>This makes code <strong>hard to read and manage</strong>.</p><p>Context API or Redux is used to solve this problem.</p><h3>🔹 Advanced React Interview Questions (For Experienced Developers)</h3><h3>21. What is Reconciliation in React?</h3><p>Reconciliation is the process React uses to <strong>update the user interface efficiently</strong>.</p><p>React compares:</p><ul><li>Old virtual DOM</li><li>New virtual DOM</li></ul><p>Then it updates <strong>only the changed parts</strong> in the real DOM.</p><p>This makes React <strong>fast and efficient</strong>.</p><h3>22. What is useCallback?</h3><p>useCallback is a React hook used to <strong>remember a function</strong>.</p><p>It prevents a function from being created again on every render.</p><p>This improves performance, especially when passing functions to child components.</p><h3>23. What is useMemo?</h3><p>useMemo is used to <strong>remember a value</strong>.</p><p>It helps avoid repeating <strong>heavy calculations</strong> on every render.</p><p>useMemo improves performance when working with large data or complex logic.</p><h3>24. What is a Higher-Order Component (HOC)?</h3><p>A Higher-Order Component is a function that <strong>takes a component and returns a new component</strong>.</p><p>It is used to <strong>reuse common logic</strong> between components.</p><p>HOCs help keep code <strong>clean and reusable</strong>.</p><h3>25. What is Lazy Loading in React?</h3><p>Lazy loading means <strong>loading components only when needed</strong>.</p><p>This reduces the initial load time of the application.</p><p>Lazy loading helps improve <strong>performance and user experience</strong>.</p><h3>26. What is Code Splitting in React?</h3><p>Code splitting means <strong>breaking the app into smaller parts</strong>.</p><p>Instead of loading the full app at once, React loads <strong>only what is needed</strong>.</p><p>This helps:</p><ul><li>Reduce loading time</li><li>Improve performance</li></ul><p>Code splitting is often used with lazy loading.</p><h3>27. What is Redux?</h3><p>Redux is a <strong>state management library</strong>.</p><p>It is used to manage <strong>global data</strong> in a React application, like:</p><ul><li>User login data</li><li>App settings</li><li>Cart data</li></ul><p>Redux makes data flow <strong>clear and predictable</strong>.</p><h3>28. What is Middleware in Redux?</h3><p>Middleware is used to <strong>add extra logic</strong> between action and reducer.</p><p>It helps with:</p><ul><li>API calls</li><li>Logging</li><li>Error handling</li></ul><p>Middleware makes Redux more <strong>powerful and flexible</strong>.</p><h3>29. What is Server-Side Rendering (SSR)?</h3><p>Server-side rendering means the page is <strong>rendered on the server</strong>, not the browser.</p><p>Benefits:</p><ul><li>Faster first page load</li><li>Better SEO</li><li>Better performance</li></ul><p>Frameworks like Next.js use SSR.</p><h3>30. How can you improve React app performance?</h3><p>You can improve performance by:</p><ul><li>Using React.memo</li><li>Using useCallback and useMemo</li><li>Avoiding unnecessary re-renders</li><li>Using lazy loading</li><li>Managing state properly</li></ul><p>These steps make the app <strong>faster and smoother</strong>.</p><h3>✅ Conclusion</h3><p>React interview questions are very important for frontend developers.<br> If you understand <strong>basics, hooks, performance, and state management</strong>, you can crack most interviews.</p><p>Practice these questions and build real projects.<br> That is the best way to master React 💪</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=772d70edda36" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Set Up React + Flowbite (New or Existing Project) — With Demo & Folder Structure]]></title>
            <link>https://medium.com/@crbodarya05/how-to-set-up-react-flowbite-new-or-existing-project-with-demo-folder-structure-691bb5b24460?source=rss-6b7bf528f501------2</link>
            <guid isPermaLink="false">https://medium.com/p/691bb5b24460</guid>
            <category><![CDATA[tailwind-css]]></category>
            <category><![CDATA[flowbite]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[CHIRAG BODARYA]]></dc:creator>
            <pubDate>Wed, 16 Apr 2025 19:53:35 GMT</pubDate>
            <atom:updated>2025-04-16T19:53:35.072Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to Set Up React + Flowbite (New or Existing Project) — With Demo &amp; Folder Structure</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nVfh559h3EkD7PN4XYDfWQ.png" /></figure><p>Want to <strong>speed up your UI development in React</strong> using <strong>modern, responsive, and ready-to-use components</strong>? Meet <strong>Flowbite</strong> — a popular UI library built on top of <strong>Tailwind CSS</strong>. Whether you’re starting fresh or adding Flowbite to an existing app, this blog will walk you through the setup — <strong>step-by-step</strong>, with a <strong>live GitHub demo</strong>, and a suggested <strong>folder structure</strong> for better project management.</p><h3>What is Flowbite?</h3><p><strong>Flowbite</strong> is a component library built with <strong>Tailwind CSS</strong>, designed to help developers build stylish UIs faster. It provides pre-built and fully customizable components like:</p><ul><li>Buttons</li><li>Navbars</li><li>Modals</li><li>Forms</li><li>Cards</li><li>Tabs<br> …and much more — all styled using the utility-first approach of Tailwind CSS.</li></ul><p>For React users, there’s a dedicated package: <strong>flowbite-react</strong>, which brings Flowbite components into your JSX world seamlessly.</p><p><strong>Flowbite</strong> is a component library built with <strong>Tailwind CSS</strong>. It provides beautifully styled components like buttons, navbars, modals, forms, and more — ready to use in your React projects via <strong>flowbite-react</strong>.</p><h3>Setting Up Flowbite in a New React Project (Recommended Method)</h3><p>If you’re starting from scratch, the best and fastest way is using Flowbite’s official boilerplate, which comes pre-configured with:</p><ul><li>React</li><li>Vite</li><li>Tailwind CSS v4</li><li>Flowbite</li><li>Flowbite-React</li></ul><p><strong>Step-by-Step Instructions</strong></p><p>1. Create a New React + Flowbite Project</p><pre>npx create-flowbite-react@latest</pre><p>This will scaffold a complete starter template using Vite.</p><p>2. Move into the Project Directory</p><pre>cd your-project-name</pre><p>3. Install All Dependencies</p><pre>npm install</pre><p>4. Run Your Project</p><pre>npm run dev</pre><p>That’s it — your project is now live and ready to use Flowbite components!</p><h3>Setting Up Flowbite in an Existing React Project</h3><p>If you already have a React app running, you can still integrate Flowbite without starting over.</p><p><strong>Step-by-Step Instructions</strong></p><p>1. Initialize Flowbite Setup</p><pre>npx flowbite-react@latest init</pre><blockquote>This command will install the required packages, configure tailwind.config.js, and set up necessary files to get Flowbite running in your app — with <strong>Tailwind CSS v4</strong> support.</blockquote><h3>Recommended Folder Structure</h3><pre>react-flowbite-demo/<br>├── public/<br>├── src/<br>│   ├── components/<br>│   │   └── Navbar.jsx<br>│   ├── pages/<br>│   │   └── Home.jsx<br>│   ├── App.js<br>│   ├── index.css<br>│   └── index.js<br>├── tailwind.config.js<br>├── package.json</pre><h3>GitHub Demo</h3><p>Here’s a working demo with React + Flowbite: 👉 <strong>GitHub Repository: </strong><a href="https://github.com/chiragbodarya/flowbite-react-template-vite"><strong>react-flowbite-demo</strong></a></p><p>Includes:</p><ul><li>Fully functional Tailwind + Flowbite setup</li><li>Responsive Navbar built with Flowbite</li><li>Modular folder structure for scalability</li></ul><h3>Why Flowbite is a Great Choice for React Projects</h3><p>Here are some reasons why developers love using Flowbite:</p><ul><li>⚡ <strong>Faster UI Development</strong> — Use professionally designed components right out of the box.</li><li>🎨 <strong>Fully Customizable</strong> — Built with Tailwind, so it adapts to your design system easily.</li><li>🌙 <strong>Dark Mode Support</strong> — Native support for dark/light themes.</li><li>📱 <strong>Responsive &amp; Clean UI</strong> — Built with mobile-first design in mind.</li><li>🔗 <strong>Seamless React Integration</strong> — Use Flowbite’s components directly in your JSX.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=691bb5b24460" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Set Up Prettier in a React App (The Right Way)]]></title>
            <link>https://medium.com/@crbodarya05/data-how-to-set-up-prettier-in-a-react-app-the-right-way-f5fe45d40bf4?source=rss-6b7bf528f501------2</link>
            <guid isPermaLink="false">https://medium.com/p/f5fe45d40bf4</guid>
            <category><![CDATA[codeformatter]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[prettier]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[CHIRAG BODARYA]]></dc:creator>
            <pubDate>Sun, 06 Apr 2025 20:17:31 GMT</pubDate>
            <atom:updated>2025-04-07T18:08:46.409Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="prettier" src="https://cdn-images-1.medium.com/max/600/1*f19Uc7lpW2nUiK31cvjsxw.png" /></figure><p>Keeping your React code clean, consistent, and readable is essential for any project — whether you’re working solo or with a team. That’s where <strong>Prettier</strong> comes in: an opinionated code formatter that makes code style decisions for you, so you can focus on building features.</p><p>In this blog, we’ll walk through the <strong>best way to set up Prettier in a React project</strong>, including:</p><ul><li>Installing Prettier</li><li>Creating config files</li><li>Setting up VS Code for auto-formatting</li><li>Integrating with ESLint (optional)</li><li>Useful Prettier shortcuts</li></ul><p>Let’s get started! 🚀</p><p>Already have a project? Great — skip this step!</p><p><strong>Step 1: Create a React App (If You Haven’t Already)</strong></p><p>If you’re starting fresh, run:</p><pre>npx create-react-app my-app<br>cd my-app</pre><p><strong>Step 2: Install Prettier</strong></p><p>Install Prettier as a <strong>development dependency</strong>:</p><pre>npm install --save-dev prettier<br># OR<br>yarn add -D prettier</pre><p>Installing locally ensures your whole team uses the same Prettier version.</p><p><strong>Step 3: Add a .prettierrc Configuration File</strong></p><p>This file controls how Prettier formats your code. Create a .prettierrc file in your project root:</p><pre>module.exports = {<br>  semi: true, // Add semicolons<br>  singleQuote: true, // Use single quotes<br>  tabWidth: 2, // Number of spaces per indent<br>  trailingComma: &#39;es5&#39;, // Trailing commas for cleaner diffs<br>  printWidth: 100, // Max characters per line<br>  bracketSpacing: true, // Spaces inside object literals<br>  arrowParens: &#39;avoid&#39;, // Skip parens when possible in arrow functions<br>};</pre><p><strong>Summary Table of .prettierrc Settings</strong></p><figure><img alt="Data table image" src="https://cdn-images-1.medium.com/max/981/1*9iTzfFCqmc5O1cNd_TCIFA.png" /></figure><p>You can also add .prettierignore (similar to .gitignore) to skip formatting specific files/folders:</p><pre>node_modules<br>build<br>dist<br>public</pre><p><strong>Step 4: Configure VS Code for Auto-Formatting</strong></p><p>1. Install the <strong>Prettier — Code Formatter</strong> extension from the VS Code Marketplace.</p><p>2. Open your VS Code <strong>settings.json</strong>:</p><p>· Press Ctrl + Shift + P → “Preferences: Open Settings (JSON)”</p><p>3. Add the following settings:</p><pre>{<br>  &quot;editor.formatOnSave&quot;: true,<br>  &quot;editor.defaultFormatter&quot;: &quot;esbenp.prettier-vscode&quot;,<br>  &quot;[javascript]&quot;: {<br>    &quot;editor.defaultFormatter&quot;: &quot;esbenp.prettier-vscode&quot;<br>  },<br>  &quot;[javascriptreact]&quot;: {<br>    &quot;editor.defaultFormatter&quot;: &quot;esbenp.prettier-vscode&quot;<br>  },<br>  &quot;[typescript]&quot;: {<br>    &quot;editor.defaultFormatter&quot;: &quot;esbenp.prettier-vscode&quot;<br>  },<br>  &quot;[typescriptreact]&quot;: {<br>    &quot;editor.defaultFormatter&quot;: &quot;esbenp.prettier-vscode&quot;<br>  }<br>}</pre><p>Now, Prettier will format your files <strong>automatically every time you save</strong>! 🔥</p><p><strong>Step 5: Add a Format Script (Optional)</strong></p><p>For quick formatting across the entire project, add a script to your package.json:</p><pre>&quot;scripts&quot;: {<br>  &quot;format&quot;: &quot;prettier --write \&quot;src/**/*.{js,jsx,ts,tsx,json,css,md}\&quot;&quot;<br>}</pre><p>Then run:</p><pre>npm run format&lt;Your Project name&gt;</pre><p>This command will format all relevant files in your project.</p><p><strong>Useful Prettier Shortcuts in VS Code</strong></p><p>Here are some handy shortcuts:</p><figure><img alt="data table image" src="https://cdn-images-1.medium.com/max/999/1*I7TJnpM1Au8VHC5bdeMSXg.png" /></figure><p>You can also format manually from the command palette:</p><p>Format Document With… → Prettier</p><p><strong>Final Folder Structure Example</strong></p><p>After setup, your project root might look like this:</p><pre>my-app/<br>├── .prettierrc<br>├── .prettierignore<br>├── .eslintrc (optional)<br>├── node_modules/<br>├── public/<br>├── src/<br>├── package.json<br>└── ...</pre><p><strong>Conclusion</strong></p><p>Setting up Prettier in your React app helps you write <strong>cleaner</strong>, <strong>more consistent</strong>, and <strong>more professional code</strong>. Once it’s configured to run on save, you’ll never have to worry about indentation, spacing, or semicolons again.</p><p><strong>When and Why You Should Customize These Settings</strong></p><ul><li>For <strong>team projects</strong>, standardizing styles prevents style conflicts in PRs.</li><li>For <strong>solo devs</strong>, it speeds up coding by reducing decision fatigue.</li><li>For <strong>open source</strong>, using Prettier increases code quality and contribution ease.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f5fe45d40bf4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Create Custom Classes in Tailwind CSS]]></title>
            <link>https://medium.com/@crbodarya05/create-custom-classes-in-tailwind-css-18757c62f070?source=rss-6b7bf528f501------2</link>
            <guid isPermaLink="false">https://medium.com/p/18757c62f070</guid>
            <category><![CDATA[web-design]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[tailwind-css]]></category>
            <category><![CDATA[frontend-development]]></category>
            <dc:creator><![CDATA[CHIRAG BODARYA]]></dc:creator>
            <pubDate>Thu, 03 Apr 2025 19:56:25 GMT</pubDate>
            <atom:updated>2025-04-04T19:12:35.423Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="React+Taiwiend CSs" src="https://cdn-images-1.medium.com/max/1024/1*M69KJyzmsM8_H9Ot9lZ8fw.png" /></figure><p>Tailwind CSS is a utility-first CSS framework that makes styling your React applications efficient and customizable. In this guide, we’ll explore how to create custom classes in Tailwind CSS by extending the default configuration. This tutorial is perfect for beginners who want to learn how to modify Tailwind settings while keeping the default functionality intact.</p><h4><strong>Let’s go step by step to create a custom class in Tailwind CSS.</strong></h4><ol><li><strong>Setting Up Tailwind CSS in a React App</strong></li></ol><p>To get started, install Tailwind CSS in a React application. If you don’t have a React app set up yet, create one using Vite:</p><pre>npx create-vite my-tailwind-app --template react<br>cd my-tailwind-app<br>npm install</pre><p>Next, install Tailwind CSS and its peer dependencies:</p><pre>npm install -D tailwindcss postcss autoprefixer<br>npx tailwindcss init -p</pre><p>This will generate two configuration files: tailwind.config.js (or tailwind.config.ts if using TypeScript) and postcss.config.js.</p><p>Now, add Tailwind’s base styles to your index.css or global.css:</p><pre>@tailwind base;<br>@tailwind components;<br>@tailwind utilities;</pre><p>Your Tailwind CSS is now ready to use in the React project.</p><p><strong>2. Modifying the Tailwind Configuration (tailwind.config.ts)</strong></p><p>To add custom classes, open tailwind.config.ts and extend the theme:</p><pre>import type { Config } from &#39;tailwindcss&#39;;<br><br>const config: Config = {<br>  content: [<br>    &quot;./index.html&quot;,<br>    &quot;./src/**/*.{js,ts,jsx,tsx}&quot;<br>  ],<br>  theme: {<br>    extend: {<br>      colors: {<br>        &quot;custom-blue&quot;: &quot;#1e40af&quot;, // Custom text color<br>        &quot;custom-bg&quot;: &quot;#f0f9ff&quot; // Custom background color<br>        &quot;custom-text&quot;:{<br>          100: #d65120, // Light Color<br>          200: #8c2904, // Dark Color<br>        }<br>      },<br>    },<br>  },<br>  plugins: [],<br>};<br><br>export default config;</pre><p><strong>3. Creating a Simple Demo Component</strong></p><p>Let’s create a simple React component that uses both built-in Tailwind classes and custom classes.</p><p><strong>DemoComponent.tsx</strong></p><pre>const DemoComponent = () =&gt; {<br>  return (<br>    &lt;div className=&quot;flex justify-center items-center h-screen bg-custom-bg&quot;&gt;<br>      &lt;h1 className=&quot;text-4xl font-bold text-custom-blue&quot;&gt;Hello, Tailwind CSS!&lt;/h1&gt;<br>      &lt;h3 className=&quot;text-4xl font-bold text-custom-text-100&quot;&gt;Custom Class in Tailwind CSS!&lt;/h3&gt;<br>    &lt;/div&gt;<br>  );<br>};<br><br>export default DemoComponent;</pre><p><strong>Conclusion</strong></p><p>In this tutorial, we learned how to:</p><ul><li>Set up Tailwind CSS in a React application using Tailwind v4.</li><li>Create a simple demo component.</li><li>Extend Tailwind’s configuration to include custom colors.</li></ul><p>This approach allows you to maintain Tailwind’s default functionality while adding your own styles in a structured manner. Happy coding!</p><h3>Why Use Custom Classes in Tailwind CSS?</h3><p>By default, Tailwind provides a vast range of utility classes. But in some cases, you might need to:</p><ul><li>Reuse the same set of utility classes across multiple components.</li><li>Simplify your JSX structure by avoiding long class lists.</li><li>Apply styles dynamically based on conditions.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=18757c62f070" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Create Your First React App — A Beginner’s Guide]]></title>
            <link>https://medium.com/@crbodarya05/how-to-create-your-first-react-app-a-beginners-guide-e9f96dabfa6e?source=rss-6b7bf528f501------2</link>
            <guid isPermaLink="false">https://medium.com/p/e9f96dabfa6e</guid>
            <dc:creator><![CDATA[CHIRAG BODARYA]]></dc:creator>
            <pubDate>Tue, 01 Apr 2025 19:38:00 GMT</pubDate>
            <atom:updated>2025-04-04T18:34:55.112Z</atom:updated>
            <content:encoded><![CDATA[<h3>Getting Started with React: How to Build Your First App</h3><figure><img alt="react_app_image" src="https://cdn-images-1.medium.com/max/1024/1*9kmss-cVjODvlb92GkqHtA.png" /></figure><p>Want to create your first React app? This beginner’s guide shows you how to install Node.js, set up Create React App, and run your project in minutes.</p><p><strong>Step 1: Install Node.js for React.js Development</strong></p><p>To start with <strong>React.js</strong>, you need to install <strong>Node.js</strong>, which is required for running JavaScript outside the browser. <strong>Node.js</strong> also includes <strong>npm (Node Package Manager)</strong>, which is essential for installing React dependencies.</p><p><strong>Check If Node.js is Installed</strong></p><p>Before installing, check if <strong>Node.js</strong> is already available on your system. Open your terminal or command prompt and type:</p><pre>node -v</pre><p>If <strong>Node.js</strong> is installed, you will see a version number. If not, download and install it from the <a href="https://nodejs.org/">official Node.js website</a>.</p><p><strong>Step 2: Choose the Best Code Editor for React.js</strong></p><p>A <strong>code editor</strong> is necessary for writing and managing your <strong>React.js project</strong>. The most recommended editor is:</p><ul><li><strong>Visual Studio Code (VS Code)</strong> — A powerful and user-friendly editor for JavaScript and <strong>React.js</strong> development. <a href="https://code.visualstudio.com/">Download VS Code</a></li><li>Other options include <strong>Atom</strong> and <strong>Sublime Text</strong>.</li></ul><p><strong>Step 3: Create a React.js Application Using Create React App</strong></p><p><strong>Create React App (CRA)</strong> is the easiest way to set up a new <strong>React.js project</strong> with a good default structure.</p><p><strong>Command to Create a React.js App</strong></p><p>Once <strong>Node.js</strong> is installed, open your terminal or command prompt and run:</p><pre>npx create-react-app my-first-react-app</pre><ul><li><strong>npx</strong>: Runs a package without installing it globally.</li><li><strong>create-react-app</strong>: A tool that sets up a new <strong>React.js project</strong> with essential configurations.</li><li><strong>my-first-react-app</strong>: This is the project folder name (you can rename it as needed).</li></ul><p>After running the command, it will take a few minutes to set up all dependencies.</p><p><strong>Step 4: Navigate to Your React.js Project Folder</strong></p><p>Once the setup is complete, move into your newly created <strong>React.js project</strong> folder using:</p><pre>cd my-first-react-app</pre><p><strong>Step 5: Start Your First React.js App</strong></p><p>Now, start the <strong>React.js development server</strong> using:</p><pre>npm start</pre><p>This will open your default browser and display the <strong>React.js welcome page</strong> at:</p><pre>http://localhost:3000/</pre><p><strong>Why Use React.js for Web Development?</strong></p><p>React.js is a widely used <strong>JavaScript library</strong> for building interactive user interfaces. Here are some key benefits:</p><ul><li><strong>Fast and Efficient</strong> — React.js updates only necessary components, making the app faster.</li><li><strong>Reusable Components</strong> — Develop modular UI elements that can be reused across projects.</li><li><strong>Strong Community Support</strong> — React.js has extensive documentation and support from developers worldwide.</li></ul><p><strong>Conclusion</strong></p><p>Congratulations! You have successfully created your first <strong>React.js application</strong>. Now, you can start learning React.js by modifying files inside the <strong>src</strong> folder.</p><p>For more tutorials on <strong>React.js development</strong>, stay tuned! 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e9f96dabfa6e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>