<?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: Jeet Singh</title>
    <description>The latest articles on DEV Community by Jeet Singh (@jeet_singh_63644d9175a9f6).</description>
    <link>https://dev.to/jeet_singh_63644d9175a9f6</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%2F3573564%2F3ca4955d-9f60-430f-985b-f99c7dd1690c.png</url>
      <title>DEV Community: Jeet Singh</title>
      <link>https://dev.to/jeet_singh_63644d9175a9f6</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jeet_singh_63644d9175a9f6"/>
    <language>en</language>
    <item>
      <title>This was a feature not a bug🐞</title>
      <dc:creator>Jeet Singh</dc:creator>
      <pubDate>Sun, 19 Oct 2025 08:52:50 +0000</pubDate>
      <link>https://dev.to/jeet_singh_63644d9175a9f6/this-was-a-feature-not-a-bug-mc3</link>
      <guid>https://dev.to/jeet_singh_63644d9175a9f6/this-was-a-feature-not-a-bug-mc3</guid>
      <description>&lt;p&gt;A single ESLint error took me on an unexpected journey into the heart of the React Compiler this week. It was a powerful reminder that there's a deep story behind every rule. Here’s what I learned. 👇&lt;/p&gt;

&lt;p&gt;The Problem&lt;br&gt;
It started with a simple pattern: using an async function inside a useEffect hook. A lint rule flagged my setState call, which I thought was a mistake. Since the state update happened after an await, I was convinced it had to be a false positive.&lt;/p&gt;

&lt;p&gt;The Investigation&lt;br&gt;
My curiosity led me down a rabbit hole. I started by opening an issue on GitHub, but I wanted to understand the root cause. I decided to dive into the React repository myself and trace the logic.&lt;br&gt;
The journey took me from the eslint-plugin-react-compiler wrapper, deep into the babel-plugin-react-compiler, and eventually to the exact file responsible for the logic: src/Validation/ValidateNoSetStateInEffects.ts.&lt;/p&gt;

&lt;p&gt;The "Aha!" Moment 💡&lt;br&gt;
After analyzing the compiler's validation code, I had my 'aha!' moment. The rule isn't a bug; it's a crucial feature designed to prevent memory leaks.&lt;br&gt;
It correctly flags any setState call in the main body of an effect to protect against a classic race condition: the component could unmount while waiting for the await to finish, leading to an attempt to update a non-existent component.&lt;/p&gt;

&lt;p&gt;The Takeaway&lt;br&gt;
My biggest takeaway wasn't just about compilers, but about appreciating the "why" behind the Rules of Hooks. What seems like a simple linting error is often a carefully designed safeguard built on years of experience by the React team.&lt;br&gt;
It was a humbling and incredibly valuable deep dive!&lt;br&gt;
hashtag#ReactJS hashtag#WebDevelopment hashtag#OpenSource hashtag#JavaScript hashtag#LearnInPublic&lt;/p&gt;

</description>
      <category>tooling</category>
      <category>learning</category>
      <category>javascript</category>
      <category>react</category>
    </item>
  </channel>
</rss>
