<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Raunak Sharma</title>
    <description>The latest articles on DEV Community by Raunak Sharma (@sharma572).</description>
    <link>https://dev.to/sharma572</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F911657%2F3b3c8634-3d4c-436a-bf76-e333c2a61652.jpeg</url>
      <title>DEV Community: Raunak Sharma</title>
      <link>https://dev.to/sharma572</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sharma572"/>
    <language>en</language>
    <item>
      <title>🚀 Mastering Object.groupBy(): The Game-Changer for JavaScript Data Handling!</title>
      <dc:creator>Raunak Sharma</dc:creator>
      <pubDate>Tue, 25 Mar 2025 11:50:54 +0000</pubDate>
      <link>https://dev.to/sharma572/mastering-objectgroupby-the-game-changer-for-javascript-data-handling-2neg</link>
      <guid>https://dev.to/sharma572/mastering-objectgroupby-the-game-changer-for-javascript-data-handling-2neg</guid>
      <description>&lt;p&gt;JavaScript developers often find themselves grouping arrays of objects based on a specific property. Before ES2023, this required using reduce() or external libraries like Lodash. But now, JavaScript has introduced the built-in Object.groupBy(), making data transformation cleaner and more efficient.&lt;/p&gt;

&lt;h2&gt;
  
  
  🔥 What is Object.groupBy()?
&lt;/h2&gt;

&lt;p&gt;The Object.groupBy() method allows you to group elements of an array into an object based on a callback function.&lt;/p&gt;

&lt;h2&gt;
  
  
  💡 Why Should You Use It?
&lt;/h2&gt;

&lt;p&gt;✅ Cleaner Code: Eliminates the need for complex reduce() logic.&lt;br&gt;
✅ Performance Boost: Native implementation is optimized for speed.&lt;br&gt;
✅ Readability: Enhances code clarity and maintainability.&lt;/p&gt;
&lt;h2&gt;
  
  
  🛠️ How It Works (Example in Action)
&lt;/h2&gt;

&lt;p&gt;Consider you have an array of users, and you want to group them by role:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const users = [
  { name: "Alice", role: "admin" },
  { name: "Bob", role: "user" },
  { name: "Charlie", role: "admin" },
  { name: "David", role: "user" }
];

const groupedUsers = Object.groupBy(users, user =&amp;gt; user.role);

console.log(groupedUsers);

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;🎯 Output&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "admin": [
    { "name": "Alice", "role": "admin" },
    { "name": "Charlie", "role": "admin" }
  ],
  "user": [
    { "name": "Bob", "role": "user" },
    { "name": "David", "role": "user" }
  ]
}

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;🚀 Real-World Use Cases&lt;/strong&gt;&lt;br&gt;
1️⃣ Grouping Transactions by Status:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const transactions = [
  { id: 1, amount: 500, status: "pending" },
  { id: 2, amount: 1000, status: "completed" },
  { id: 3, amount: 750, status: "pending" }
];

const groupedTransactions = Object.groupBy(transactions, t =&amp;gt; t.status);
console.log(groupedTransactions);

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

&lt;/div&gt;



&lt;p&gt;2️⃣ Categorizing Products by Type:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const products = [
  { name: "iPhone", category: "electronics" },
  { name: "Shirt", category: "clothing" },
  { name: "Laptop", category: "electronics" }
];

const groupedProducts = Object.groupBy(products, p =&amp;gt; p.category);
console.log(groupedProducts);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;p&gt;The Object.groupBy() method simplifies array grouping, making JavaScript code more readable and efficient. If you’re still using reduce(), it’s time to embrace this new feature! 🚀&lt;/p&gt;

&lt;p&gt;What do you think? Have you tried Object.groupBy() yet? Let me know in the comments! 👇&lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>frontend</category>
    </item>
    <item>
      <title>"🚀 React Quirks Explained: What You Don't Know Can Hurt You! 🤯"</title>
      <dc:creator>Raunak Sharma</dc:creator>
      <pubDate>Mon, 18 Nov 2024 10:41:35 +0000</pubDate>
      <link>https://dev.to/sharma572/-react-quirks-explained-what-you-dont-know-can-hurt-you--56db</link>
      <guid>https://dev.to/sharma572/-react-quirks-explained-what-you-dont-know-can-hurt-you--56db</guid>
      <description>&lt;p&gt;React is amazing, but it comes with its own set of quirks that can catch you off guard. Whether you're a beginner or an experienced developer, these surprising behaviors are a reminder of React's complexity and flexibility. Let’s dive in! 🚀&lt;/p&gt;

&lt;h2&gt;
  
  
  1. State Updates Are Asynchronous🕒
&lt;/h2&gt;

&lt;p&gt;React batches state updates for better performance, which means changes to state aren’t immediate.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const [count, setCount] = useState(0);

const handleClick = () =&amp;gt; {
    setCount(count + 1);
    console.log(count); // Still logs 0
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Why? React doesn’t update the state until the end of the event loop. Use the functional form of setState to get the latest value:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;setCount(prevCount =&amp;gt; prevCount + 1);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. Keys Aren't Just For Performance 🗝️
&lt;/h2&gt;

&lt;p&gt;Keys help React identify elements during reconciliation. But using unstable keys, like array indices, can break your UI.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const items = ['React', 'JS', 'CSS'];
items.map((item, index) =&amp;gt; &amp;lt;div key={index}&amp;gt;{item}&amp;lt;/div&amp;gt;);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Problem:&lt;/strong&gt; If the array changes (e.g., sorting), React might lose track of elements. Always use unique and stable keys, like IDs.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. useEffect Runs Twice in Strict Mode 🌀
&lt;/h2&gt;

&lt;p&gt;Strict Mode in development deliberately calls useEffect twice to detect bugs.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;useEffect(() =&amp;gt; {
    console.log('Effect runs!');
}, []);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Gotcha:&lt;/strong&gt; This happens only in development. In production, useEffect runs once as expected.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Props Are Read-Only 🚫
&lt;/h2&gt;

&lt;p&gt;Props are immutable in React, and modifying them directly can cause errors.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const MyComponent = ({ name }) =&amp;gt; {
    name = 'New Name'; // ❌ Illegal
    return &amp;lt;h1&amp;gt;{name}&amp;lt;/h1&amp;gt;;
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt; Use state if you need mutable data.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Re-renders Happen Even If Props Don't Change 🔁
&lt;/h2&gt;

&lt;p&gt;React re-renders components even if props remain the same.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const Child = ({ value }) =&amp;gt; {
    console.log('Child renders');
    return &amp;lt;div&amp;gt;{value}&amp;lt;/div&amp;gt;;
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Why? React doesn’t automatically optimize performance. Use React.memo to prevent unnecessary re-renders:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export default React.memo(Child);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  6. Conditional Rendering Can Break Lists 💥
&lt;/h2&gt;

&lt;p&gt;Rendering lists conditionally can lead to unpredictable outcomes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{items.length &amp;amp;&amp;amp; items.map(item =&amp;gt; &amp;lt;div&amp;gt;{item}&amp;lt;/div&amp;gt;)}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Gotcha:&lt;/strong&gt; If items.length is 0, React renders 0 before the list. Use explicit checks:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{items.length &amp;gt; 0 &amp;amp;&amp;amp; items.map(item =&amp;gt; &amp;lt;div&amp;gt;{item}&amp;lt;/div&amp;gt;)}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  7. JSX Is Not HTML 🖋️
&lt;/h2&gt;

&lt;p&gt;JSX looks like HTML but isn’t! For example, the class attribute is className, and self-closing tags must end with a /.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div className="my-class" /&amp;gt;;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  8. Infinite Loops With useEffect 🔄
&lt;/h2&gt;

&lt;p&gt;Forgetting to add dependencies in useEffect can create infinite loops.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;useEffect(() =&amp;gt; {
    fetchData();
}, [data]); // Missing `data` can cause repeated calls
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt; Use the dependency array carefully or useRef for stable references.&lt;/p&gt;

&lt;h2&gt;
  
  
  9. Fragments Don’t Accept Keys By Default 🔑
&lt;/h2&gt;

&lt;p&gt;When using React.Fragment to wrap multiple elements, you might need to add a key, especially in lists.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;&amp;gt;
    &amp;lt;div key="1"&amp;gt;Item 1&amp;lt;/div&amp;gt;
    &amp;lt;div key="2"&amp;gt;Item 2&amp;lt;/div&amp;gt;
&amp;lt;/&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt; Use  instead if required.&lt;/p&gt;

&lt;h2&gt;
  
  
  10. Updating State Doesn’t Merge Objects ✂️
&lt;/h2&gt;

&lt;p&gt;Unlike this.setState in class components, useState doesn’t merge object state automatically.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const [state, setState] = useState({ name: 'React', version: 18 });

setState({ version: 19 }); 
// Name is lost because the state isn’t merged!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt; Spread the previous state:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;setState(prevState =&amp;gt; ({ ...prevState, version: 19 }));
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Conclusion:&lt;/strong&gt; &lt;strong&gt;&lt;em&gt;React Is Full of Surprises! 🎉&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
Understanding these quirks will make you a better React developer. What are some quirks you’ve encountered? Drop your answers in the comments below! Let’s discuss! 😎&lt;/p&gt;

</description>
      <category>react</category>
      <category>development</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Boost Your Productivity: React.js Is Magic: How It Changed the Game for Developers 🎩✨</title>
      <dc:creator>Raunak Sharma</dc:creator>
      <pubDate>Mon, 18 Nov 2024 09:18:39 +0000</pubDate>
      <link>https://dev.to/sharma572/boost-your-productivity-reactjs-is-magic-how-it-changed-the-game-for-developers-2lpi</link>
      <guid>https://dev.to/sharma572/boost-your-productivity-reactjs-is-magic-how-it-changed-the-game-for-developers-2lpi</guid>
      <description>&lt;p&gt;Once upon a time in the chaotic world of web development, developers wrestled with manual DOM manipulation, tangled code, and unmanageable UI logic. Creating even simple dynamic web apps felt like a never-ending battle. Then came React.js—a tool that rewrote the rules and made developers’ lives magical.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Pain Before React
&lt;/h2&gt;

&lt;p&gt;Imagine you want to update a counter when a button is clicked:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;button id="incrementBtn"&amp;gt;Click Me&amp;lt;/button&amp;gt;  
&amp;lt;p id="counter"&amp;gt;Count: 0&amp;lt;/p&amp;gt;  

&amp;lt;script&amp;gt;  
  let count = 0;  
  const button = document.getElementById('incrementBtn');  
  const counter = document.getElementById('counter');  

  button.addEventListener('click', () =&amp;gt; {  
    count++;  
    counter.textContent = `Count: ${count}`;  
  });  
&amp;lt;/script&amp;gt;

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

&lt;/div&gt;



&lt;p&gt;It works, but every update requires manual DOM manipulation—a nightmare to maintain as apps grow.&lt;/p&gt;

&lt;h2&gt;
  
  
  Enter React.js 🪄
&lt;/h2&gt;

&lt;p&gt;With React, building dynamic UIs became as simple as snapping together LEGO blocks. Here’s the same counter in React:&lt;br&gt;
&lt;/p&gt;

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

function Counter() {  
  const [count, setCount] = useState(0);  

  return (  
    &amp;lt;div&amp;gt;  
      &amp;lt;button onClick={() =&amp;gt; setCount(count + 1)}&amp;gt;Click Me&amp;lt;/button&amp;gt;  
      &amp;lt;p&amp;gt;Count: {count}&amp;lt;/p&amp;gt;  
    &amp;lt;/div&amp;gt;  
  );  
}  

export default Counter;  

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;What Changed?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Declarative Syntax: Describe what should happen; React handles the "how."&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Automatic Updates: The UI updates seamlessly when the state changes—no need to touch the DOM.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Reusable Components: Build once, use anywhere.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Real Magic&lt;/strong&gt;: &lt;em&gt;A Simple To-Do App&lt;/em&gt;&lt;br&gt;
&lt;em&gt;The Old Way&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;input id="taskInput" placeholder="Add a task" /&amp;gt;  
&amp;lt;button id="addTaskBtn"&amp;gt;Add Task&amp;lt;/button&amp;gt;  
&amp;lt;ul id="taskList"&amp;gt;&amp;lt;/ul&amp;gt;  

&amp;lt;script&amp;gt;  
  const input = document.getElementById('taskInput');  
  const button = document.getElementById('addTaskBtn');  
  const list = document.getElementById('taskList');  

  button.addEventListener('click', () =&amp;gt; {  
    const task = input.value;  
    if (task) {  
      const li = document.createElement('li');  
      li.textContent = task;  
      list.appendChild(li);  
      input.value = '';  
    }  
  });  
&amp;lt;/script&amp;gt;  

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;The React Way&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

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

function TodoApp() {  
  const [tasks, setTasks] = useState([]);  
  const [input, setInput] = useState("");  

  const addTask = () =&amp;gt; {  
    if (input.trim()) {  
      setTasks([...tasks, input]);  
      setInput("");  
    }  
  };  

  return (  
    &amp;lt;div&amp;gt;  
      &amp;lt;input  
        type="text"  
        placeholder="Add a task"  
        value={input}  
        onChange={(e) =&amp;gt; setInput(e.target.value)}  
      /&amp;gt;  
      &amp;lt;button onClick={addTask}&amp;gt;Add Task&amp;lt;/button&amp;gt;  
      &amp;lt;ul&amp;gt;  
        {tasks.map((task, index) =&amp;gt; (  
          &amp;lt;li key={index}&amp;gt;{task}&amp;lt;/li&amp;gt;  
        ))}  
      &amp;lt;/ul&amp;gt;  
    &amp;lt;/div&amp;gt;  
  );  
}  

export default TodoApp;  

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

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;React simplifies:&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;State Management with useState.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Dynamic Updates that "just work."&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Scalable Code that’s easy to extend.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Why React Will Always Be Magic&lt;/strong&gt;&lt;br&gt;
React lets us focus on what to build, not how to manage the DOM. From the Virtual DOM to hooks, it’s a toolkit that turns developer dreams into reality.&lt;/p&gt;

&lt;p&gt;React isn’t just a library—it’s a philosophy, and for developers like us, it’s nothing short of magic.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What’s Your React Story?&lt;/strong&gt;&lt;br&gt;
How has React transformed your development experience? Share your story in the &lt;strong&gt;comments&lt;/strong&gt;, and let’s celebrate the magic of React.js together! ✨&lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>mern</category>
    </item>
    <item>
      <title>"10 Game-Changing HTML Tricks for Modern Web Developers"</title>
      <dc:creator>Raunak Sharma</dc:creator>
      <pubDate>Mon, 14 Oct 2024 11:53:57 +0000</pubDate>
      <link>https://dev.to/sharma572/10-game-changing-html-tricks-for-modern-web-developers-1klp</link>
      <guid>https://dev.to/sharma572/10-game-changing-html-tricks-for-modern-web-developers-1klp</guid>
      <description>&lt;p&gt;&lt;strong&gt;1. Lazy Loading Images&lt;/strong&gt;&lt;br&gt;
Why? Boosts page load speed by loading images only when they enter the viewport.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;img src="image.jpg" loading="lazy" alt="Lazy loading image"&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. Responsive Images with&lt;/strong&gt; &lt;code&gt;&amp;lt;picture&amp;gt;&lt;/code&gt;&lt;br&gt;
Why? Serve different image sizes based on screen width, optimizing performance.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;picture&amp;gt;
  &amp;lt;source srcset="image-large.jpg" media="(min-width: 800px)"&amp;gt;
  &amp;lt;img src="image-default.jpg" alt="Responsive image"&amp;gt;
&amp;lt;/picture&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;3. Auto-fill Prevention for Forms&lt;/strong&gt;&lt;br&gt;
Why? Improves security by preventing browsers from automatically filling sensitive fields.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;form autocomplete="off"&amp;gt;
  &amp;lt;input type="password" autocomplete="new-password"&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;4. Native Modal Dialogs with&lt;/strong&gt; &lt;code&gt;&amp;lt;dialog&amp;gt;&lt;/code&gt;&lt;br&gt;
Why? Simplifies modal creation without external libraries.&lt;br&gt;
This is a native modal&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;button onclick="document.getElementById('myDialog').showModal()"&amp;gt;Open Modal&amp;lt;/button&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;5. Preload Critical Resources with&lt;/strong&gt; &lt;code&gt;&amp;lt;link&amp;gt;&lt;/code&gt;&lt;br&gt;
Why? Speeds up page load times by preloading key assets like fonts or images.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;link rel="preload" href="font.woff2" as="font" type="font/woff2" crossorigin="anonymous"&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;6. Pattern Validation on Inputs&lt;/strong&gt;&lt;br&gt;
Why? Enforces input validation without JavaScript.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;input type="text" pattern="\d{3}-\d{3}-\d{4}" title="123-456-7890"&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;7. Using&lt;/strong&gt; &lt;code&gt;&amp;lt;template&amp;gt;&lt;/code&gt; &lt;strong&gt;for Reusable HTML&lt;/strong&gt;&lt;br&gt;
Why? Efficiently create reusable HTML elements dynamically with JavaScript.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;template id="cardTemplate"&amp;gt;
  &amp;lt;div class="card"&amp;gt;Card Content&amp;lt;/div&amp;gt;
&amp;lt;/template&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;8. Semantic HTML for Better SEO&lt;/strong&gt;&lt;br&gt;
Why? Improves accessibility and search engine ranking by using semantic tags.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;article&amp;gt;
  &amp;lt;header&amp;gt;
    &amp;lt;h1&amp;gt;Article Title&amp;lt;/h1&amp;gt;
  &amp;lt;/header&amp;gt;
  &amp;lt;p&amp;gt;Article content...&amp;lt;/p&amp;gt;
  &amp;lt;footer&amp;gt;Author&amp;lt;/footer&amp;gt;
&amp;lt;/article&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;9.  Custom Data Attributes (data-*)&lt;/strong&gt;&lt;br&gt;
Why? Store custom data in HTML elements that you can easily access via JavaScript.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;button data-id="12345"&amp;gt;Product&amp;lt;/button&amp;gt;
&amp;lt;script&amp;gt;
  let productId = document.querySelector('button').dataset.id;
&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;10. Viewport Meta Tag for Mobile Optimization&lt;/strong&gt;&lt;br&gt;
Why? Ensures a responsive layout on mobile devices.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>html</category>
      <category>development</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>"10 Essential VS Code Extensions for React Developers"</title>
      <dc:creator>Raunak Sharma</dc:creator>
      <pubDate>Mon, 14 Oct 2024 11:28:13 +0000</pubDate>
      <link>https://dev.to/sharma572/10-essential-vs-code-extensions-for-react-developers-4b6j</link>
      <guid>https://dev.to/sharma572/10-essential-vs-code-extensions-for-react-developers-4b6j</guid>
      <description>&lt;p&gt;&lt;strong&gt;1. ES7+ React/Redux/React-Native snippets&lt;/strong&gt;&lt;br&gt;
This extension provides handy snippets for React, Redux, React Native, and GraphQL. It allows you to generate boilerplate code for common tasks, like creating components, importing React, or setting up hooks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Features:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Snippets for functional components, hooks, and Redux.&lt;br&gt;
Shortcuts for commonly used imports and JSX.&lt;br&gt;
&lt;strong&gt;2. Prettier - Code formatter&lt;/strong&gt;&lt;br&gt;
Prettier is an opinionated code formatter that enforces consistent style across your codebase. It automatically formats your code based on the configured settings when you save files.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Features:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Supports formatting JavaScript, TypeScript, CSS, and more.&lt;br&gt;
Ensures consistent code style.&lt;br&gt;
&lt;strong&gt;3. ESLint&lt;/strong&gt;&lt;br&gt;
ESLint is a popular tool for identifying and fixing problematic code patterns in JavaScript and TypeScript. The VS Code extension helps you catch linting issues in real time as you write your React code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Features:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Linting for React/JavaScript/TypeScript.&lt;br&gt;
Automatic fixing of code errors and warnings.&lt;br&gt;
&lt;strong&gt;4. Bracket Pair Colorizer 2&lt;/strong&gt;&lt;br&gt;
This extension helps you easily identify matching brackets by colorizing pairs of brackets. It’s very useful for JSX in React components where there are lots of nested tags.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Features:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Visual color matching for opening/closing brackets.&lt;br&gt;
Helps track nested JSX elements.&lt;br&gt;
&lt;strong&gt;5. React PropTypes Intellisense&lt;/strong&gt;&lt;br&gt;
This extension provides IntelliSense support for React PropTypes, which is helpful when you're working with components and passing props. It gives you autocompletion for PropTypes in React components.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Features:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;IntelliSense autocompletion for PropTypes.&lt;br&gt;
Helps with PropTypes documentation and definitions.&lt;br&gt;
&lt;strong&gt;6. Auto Rename Tag&lt;/strong&gt;&lt;br&gt;
When editing JSX, this extension automatically renames paired tags as you change them. It is very convenient when working with complex React components with nested tags.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Features:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Automatically renames paired tags in JSX/HTML.&lt;br&gt;
Increases productivity when editing component structure.&lt;br&gt;
&lt;strong&gt;7. GitLens — Git supercharged&lt;/strong&gt;&lt;br&gt;
GitLens is an extension that supercharges Git capabilities in VS Code. It helps you visualize code authorship, explore Git history, and gain insights into your code repository.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Features:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It shows who made code changes and when.&lt;br&gt;
It enhanced Git blame and repository navigation.&lt;br&gt;
These extensions will make your workflow smoother and more efficient as a React developer. You can install them directly from the VS Code extensions marketplace.&lt;/p&gt;

</description>
      <category>vscode</category>
      <category>react</category>
      <category>extensions</category>
      <category>developer</category>
    </item>
    <item>
      <title>5 Simple Ways to Improve Your React JS Code</title>
      <dc:creator>Raunak Sharma</dc:creator>
      <pubDate>Thu, 26 Sep 2024 07:45:36 +0000</pubDate>
      <link>https://dev.to/sharma572/5-simple-ways-to-improve-your-react-js-code-4ceg</link>
      <guid>https://dev.to/sharma572/5-simple-ways-to-improve-your-react-js-code-4ceg</guid>
      <description>&lt;p&gt;Writing good code in React JS is important to make sure your project runs smoothly and is easy to work with. Here are 5 easy tips to make your code cleaner and better!&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;Avoid Writing Functions Directly in JSX&lt;/strong&gt;
Writing functions directly inside JSX can slow down your app. Instead, write the function outside and pass it to your component.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Instead of this:
&amp;lt;button onClick={() =&amp;gt; doSomething()} /&amp;gt;

// Do this:
const handleClick = () =&amp;gt; doSomething();
&amp;lt;button onClick={handleClick} /&amp;gt;

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

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Organize Your Files&lt;br&gt;
Keep your files neat by creating folders for components, utilities, hooks, etc. This helps keep your project clean and easy to find what you need.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use Functional Components &amp;amp; Hooks&lt;br&gt;
Instead of using class components, use functional components with hooks like useState and useEffect. They are easier to write and read.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Example of a Functional Component
const Counter = () =&amp;gt; {
  const [count, setCount] = useState(0);

  return (
    &amp;lt;div&amp;gt;
      &amp;lt;p&amp;gt;{count}&amp;lt;/p&amp;gt;
      &amp;lt;button onClick={() =&amp;gt; setCount(count + 1)}&amp;gt;Increment&amp;lt;/button&amp;gt;
    &amp;lt;/div&amp;gt;
  );
};

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

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Create Reusable Components
Don't repeat yourself! Write components that can be reused by passing props to them. This saves time and makes your code cleaner.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const Button = ({ label, onClick }) =&amp;gt; (
  &amp;lt;button onClick={onClick}&amp;gt;{label}&amp;lt;/button&amp;gt;
);

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

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Use PropTypes or TypeScript
PropTypes or TypeScript help you make sure the data you pass to your components is correct, preventing bugs early on.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import PropTypes from 'prop-types';

const Greeting = ({ name }) =&amp;gt; &amp;lt;h1&amp;gt;Hello, {name}!&amp;lt;/h1&amp;gt;;

Greeting.propTypes = {
  name: PropTypes.string.isRequired,
};

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

&lt;/div&gt;



</description>
      <category>react</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
