<?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: Anfal Ratul</title>
    <description>The latest articles on DEV Community by Anfal Ratul (@anfal_ratul).</description>
    <link>https://dev.to/anfal_ratul</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%2F1140940%2Fc1f532bc-c9be-48d0-9d0e-ddebe6ccf5e9.JPG</url>
      <title>DEV Community: Anfal Ratul</title>
      <link>https://dev.to/anfal_ratul</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/anfal_ratul"/>
    <language>en</language>
    <item>
      <title>Understanding useEffect in React: Managing Side Effects</title>
      <dc:creator>Anfal Ratul</dc:creator>
      <pubDate>Fri, 16 Feb 2024 23:51:25 +0000</pubDate>
      <link>https://dev.to/anfal_ratul/understanding-useeffect-in-react-managing-side-effects-hbb</link>
      <guid>https://dev.to/anfal_ratul/understanding-useeffect-in-react-managing-side-effects-hbb</guid>
      <description>&lt;p&gt;&lt;strong&gt;What's a Side-Effect? 🤔&lt;/strong&gt;&lt;br&gt;
In programming, side-effects are operations that affect the outside world, such as API calls, DOM manipulation with setTimeout or intervals, and accessing or modifying global objects like document or window. Incorporating these directly into our React components can lead to inefficient re-renders, affecting the performance of our application.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Enter useEffect ✨&lt;/strong&gt;&lt;br&gt;
To address this issue, React introduced the useEffect hook. This hook enables us to perform side-effects in a controlled manner, executing them after the component has rendered. This helps avoid unnecessary re-renders, ensuring smooth performance for our React applications.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How to Use It:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;useEffect(() =&amp;gt; {&lt;br&gt;
  // Your side-effect code here&lt;br&gt;
}, []); // The second argument is an optional dependency array&lt;/p&gt;

&lt;p&gt;What you put inside the dependency array determines when the effect should re-run. Understanding the dependency array is crucial for effectively managing side-effects.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An empty dependency array ([]) indicates that the effect runs only once after the initial render. This is useful for effects such as data fetching, setting up subscriptions, or manual DOM manipulation that only need to occur once.&lt;/li&gt;
&lt;li&gt;A populated dependency array ([dep1, dep2, ...]) means the effect will re-run whenever any of the listed dependencies change. This is ideal for effects that need to update in response to changes in state or props.&lt;/li&gt;
&lt;li&gt;If no dependency array is provided, the effect will run after every render. This approach is rarely used as it can lead to performance issues, but it's necessary when an effect needs to adjust to every change.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The beauty of useEffect is that it doesn't return anything (undefined), focusing solely on side-effect management.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Synchronous and Asynchronous in JavaScript</title>
      <dc:creator>Anfal Ratul</dc:creator>
      <pubDate>Wed, 14 Feb 2024 17:48:31 +0000</pubDate>
      <link>https://dev.to/anfal_ratul/synchronous-and-asynchronous-in-javascript-56n9</link>
      <guid>https://dev.to/anfal_ratul/synchronous-and-asynchronous-in-javascript-56n9</guid>
      <description>&lt;p&gt;In JavaScript, synchronous operations block instructions until the task is completed, while asynchronous operations can execute without blocking other operations.&lt;/p&gt;

&lt;p&gt;Synchronous JavaScript: In a synchronous operation, each step is performed one after the previous one is finished. This means that it blocks or waits for each operation to complete before moving on to the next.&lt;/p&gt;

&lt;p&gt;Asynchronous JavaScript: In an asynchronous operation, operations don’t wait for each other to finish. This means multiple operations can be going on at the same time. When you start an operation, you can move on to another operation before the previous one finishes. This is particularly useful for tasks that take a lot of time, such as requests to servers.&lt;/p&gt;

&lt;p&gt;For example, if you have a function that fetches data from a server and it takes two seconds to get the response, you wouldn’t want your entire application to stop and wait for these two seconds. Instead, you would want to perform other tasks and deal with the response when it’s ready. This is where asynchronous JavaScript comes into play.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
