<?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 Fuad Hasan SaFfAt on Medium]]></title>
        <description><![CDATA[Stories by Fuad Hasan SaFfAt on Medium]]></description>
        <link>https://medium.com/@fuadsafat16?source=rss-6833e1c1e422------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*e5KH_V_t7mDQl85P.jpg</url>
            <title>Stories by Fuad Hasan SaFfAt on Medium</title>
            <link>https://medium.com/@fuadsafat16?source=rss-6833e1c1e422------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 09:14:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@fuadsafat16/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[Why useEffect Is Overused in React]]></title>
            <link>https://medium.com/@fuadsafat16/why-useeffect-is-overused-in-react-12f655a53664?source=rss-6833e1c1e422------2</link>
            <guid isPermaLink="false">https://medium.com/p/12f655a53664</guid>
            <category><![CDATA[react-hook]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[rerender-issue]]></category>
            <category><![CDATA[useeffect-hook]]></category>
            <category><![CDATA[modernhook]]></category>
            <dc:creator><![CDATA[Fuad Hasan SaFfAt]]></dc:creator>
            <pubDate>Tue, 20 Jan 2026 18:02:03 GMT</pubDate>
            <atom:updated>2026-01-20T18:02:03.125Z</atom:updated>
            <content:encoded><![CDATA[<p>In modern React applications, useEffect is one of the most commonly used hooks—and one of the most misunderstood. Many developers reach for useEffect by default whenever they want to “run code after render.” This habit leads to unnecessary complexity, subtle bugs, and harder-to-maintain components.</p><p>The overuse of useEffect stems from a misunderstanding of <strong>what React already does for you</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T3x4dtOXiODAGJXLo-4aUg.png" /><figcaption>useEffect</figcaption></figure><h3>React Automatically Re-Renders on State and Prop Changes</h3><p>React’s core responsibility is to re-render components when state or props change. This means that any value derived directly from state or props is already kept up to date during rendering.</p><p>However, developers often write code like this:</p><pre>useEffect(() =&gt; {<br>  setFullName(firstName + &quot; &quot; + lastName);<br>}, [firstName, lastName]);</pre><p>In this case, useEffect is unnecessary. The value can be derived directly:</p><pre>const fullName = firstName + &quot; &quot; + lastName;</pre><p>Using useEffect here introduces:</p><ol><li>extra state</li></ol><p>2. additional re-renders</p><p>3. more code to reason about</p><p>React already guarantees correctness without the effect.</p><h3>useEffect Is for Synchronization, Not Computation</h3><p>The primary purpose of useEffect is <strong>synchronizing React with external systems</strong>. Examples include:</p><ul><li>fetching data from an API</li><li>subscribing to events</li><li>interacting with browser APIs</li><li>managing timers of WebSockets</li></ul><p>When useEffect is used for simple computations, it blurs the line between rendering logic and side effects. This makes components harder to understand and increases the risk of bugs related to stale data or incorrect dependencies.</p><h3>Dependency Arrays Are Easy to Get Wrong</h3><p>One of the biggest sources of bugs in React comes from incorrect dependency arrays.</p><p>Missing dependencies can cause:</p><ul><li>state value</li><li>inconsistent UI behavior</li><li>difficult-to-reproduce bugs</li></ul><p>Unnecessary dependencies can cause:</p><ul><li>infinite loops</li><li>performance issues</li><li>excessive re-renders</li></ul><p>When useEffect is used only when truly needed, dependency management becomes simpler and more reliable.</p><h3>Overusing useEffect Hides Simpler Design Problems</h3><p>In many cases, excessive useEffect usage is a symptom of poor component design:</p><ul><li>state that should be derived instead of stored</li><li>logic that belongs in render</li><li>responsibilities that should be split into smaller components or custom hooks</li></ul><p>Removing unnecessary effects often leads to cleaner, more predictable code.</p><h3>Conclusion</h3><p>useEffect is a powerful tool, but it is not a general-purpose solution. When used incorrectly, it adds complexity without providing value.</p><p>A good rule of thumb is:</p><blockquote><em>If something can be calculated during render, it should not be inside </em><em>useEffect.</em></blockquote><p>Use useEffect only when React needs to interact with something <strong>outside</strong> its rendering model. Doing so results in simpler components, fewer bugs, and more maintainable applications.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=12f655a53664" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>