<?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 Firat Atalay on Medium]]></title>
        <description><![CDATA[Stories by Firat Atalay on Medium]]></description>
        <link>https://medium.com/@firatatalay?source=rss-c1e3328b1012------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*nh-BL5dEAGPZgVQvzclmUA.jpeg</url>
            <title>Stories by Firat Atalay on Medium</title>
            <link>https://medium.com/@firatatalay?source=rss-c1e3328b1012------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 11:48:32 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@firatatalay/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[ Fuzzing for Zero-Day Vulnerabilities: Step by Step Understanding]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/firat-on-frontend/fuzzing-for-zero-day-vulnerabilities-step-by-step-understanding-676e71c2b72b?source=rss-c1e3328b1012------2"><img src="https://cdn-images-1.medium.com/max/1016/1*u_bbenN2-_DXvwvd3Q0RUQ.png" width="1016"></a></p><p class="medium-feed-snippet">&#x2733;&#xFE0F; What Is a Zero-Day Vulnerability and Why Does It Matter?</p><p class="medium-feed-link"><a href="https://medium.com/firat-on-frontend/fuzzing-for-zero-day-vulnerabilities-step-by-step-understanding-676e71c2b72b?source=rss-c1e3328b1012------2">Continue reading on AyFi Tech »</a></p></div>]]></description>
            <link>https://medium.com/firat-on-frontend/fuzzing-for-zero-day-vulnerabilities-step-by-step-understanding-676e71c2b72b?source=rss-c1e3328b1012------2</link>
            <guid isPermaLink="false">https://medium.com/p/676e71c2b72b</guid>
            <dc:creator><![CDATA[Firat Atalay]]></dc:creator>
            <pubDate>Wed, 09 Jul 2025 21:45:21 GMT</pubDate>
            <atom:updated>2025-07-09T21:45:21.592Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Object-Oriented Programming 101: Abstraction, Encapsulation, Inheritance, and Polymorphism…]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/huawei-developers/object-oriented-programming-101-abstraction-encapsulation-inheritance-and-polymorphism-46e3cbee86bd?source=rss-c1e3328b1012------2"><img src="https://cdn-images-1.medium.com/max/600/0*T4l6v6MU5PZeWmek.gif" width="600"></a></p><p class="medium-feed-snippet">A concise look at how Abstraction, Encapsulation, Inheritance, and Polymorphism keep code organized, modular, and easy to maintain.</p><p class="medium-feed-link"><a href="https://medium.com/huawei-developers/object-oriented-programming-101-abstraction-encapsulation-inheritance-and-polymorphism-46e3cbee86bd?source=rss-c1e3328b1012------2">Continue reading on Huawei Developers »</a></p></div>]]></description>
            <link>https://medium.com/huawei-developers/object-oriented-programming-101-abstraction-encapsulation-inheritance-and-polymorphism-46e3cbee86bd?source=rss-c1e3328b1012------2</link>
            <guid isPermaLink="false">https://medium.com/p/46e3cbee86bd</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[objectorientedprogramming]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Firat Atalay]]></dc:creator>
            <pubDate>Sun, 16 Feb 2025 18:31:00 GMT</pubDate>
            <atom:updated>2025-02-16T18:31:00.609Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[What is React? A Beginner’s Guide to the Popular JavaScript Library]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/huawei-developers/what-is-react-a-beginners-guide-to-the-popular-javascript-library-757dc266e5f0?source=rss-c1e3328b1012------2"><img src="https://cdn-images-1.medium.com/max/690/0*sIhjOtCI-vYO-Pip.jpg" width="690"></a></p><p class="medium-feed-snippet">Discover what makes React the most popular JavaScript library for building dynamic and interactive user interfaces.</p><p class="medium-feed-link"><a href="https://medium.com/huawei-developers/what-is-react-a-beginners-guide-to-the-popular-javascript-library-757dc266e5f0?source=rss-c1e3328b1012------2">Continue reading on Huawei Developers »</a></p></div>]]></description>
            <link>https://medium.com/huawei-developers/what-is-react-a-beginners-guide-to-the-popular-javascript-library-757dc266e5f0?source=rss-c1e3328b1012------2</link>
            <guid isPermaLink="false">https://medium.com/p/757dc266e5f0</guid>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Firat Atalay]]></dc:creator>
            <pubDate>Mon, 16 Dec 2024 17:44:49 GMT</pubDate>
            <atom:updated>2024-12-16T17:44:49.451Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Understanding React: Framework vs. Library]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/huawei-developers/understanding-react-framework-vs-library-2b68f6b10383?source=rss-c1e3328b1012------2"><img src="https://cdn-images-1.medium.com/max/2560/1*oF63bH1hbIn7aiakFLTyvw.png" width="2560"></a></p><p class="medium-feed-snippet">Wondering why React is a library and not a framework? Discover what this means for your development approach and the flexibility it offers.</p><p class="medium-feed-link"><a href="https://medium.com/huawei-developers/understanding-react-framework-vs-library-2b68f6b10383?source=rss-c1e3328b1012------2">Continue reading on Huawei Developers »</a></p></div>]]></description>
            <link>https://medium.com/huawei-developers/understanding-react-framework-vs-library-2b68f6b10383?source=rss-c1e3328b1012------2</link>
            <guid isPermaLink="false">https://medium.com/p/2b68f6b10383</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[reactjs]]></category>
            <dc:creator><![CDATA[Firat Atalay]]></dc:creator>
            <pubDate>Sun, 01 Dec 2024 09:53:52 GMT</pubDate>
            <atom:updated>2024-12-01T09:53:52.655Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Key Takeaways from React’s Internal Workings]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://blog.stackademic.com/key-takeaways-from-reacts-internal-workings-04077868156a?source=rss-c1e3328b1012------2"><img src="https://cdn-images-1.medium.com/max/847/1*7c0pqEhas1N9T7nCmOJ2DQ.png" width="847"></a></p><p class="medium-feed-snippet">Welcome to the final lecture of this section on React!</p><p class="medium-feed-link"><a href="https://blog.stackademic.com/key-takeaways-from-reacts-internal-workings-04077868156a?source=rss-c1e3328b1012------2">Continue reading on Stackademic »</a></p></div>]]></description>
            <link>https://blog.stackademic.com/key-takeaways-from-reacts-internal-workings-04077868156a?source=rss-c1e3328b1012------2</link>
            <guid isPermaLink="false">https://medium.com/p/04077868156a</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Firat Atalay]]></dc:creator>
            <pubDate>Mon, 14 Oct 2024 06:28:35 GMT</pubDate>
            <atom:updated>2024-10-14T06:28:35.584Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Understanding Render Logic and Event Handlers in React: A Simple Guide]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://blog.stackademic.com/understanding-render-logic-and-event-handlers-in-react-a-simple-guide-f317ac18fe8c?source=rss-c1e3328b1012------2"><img src="https://cdn-images-1.medium.com/max/944/1*Wq8-XagZecs-dbTFe3dAfg.png" width="944"></a></p><p class="medium-feed-snippet">When developing in React, understanding the difference between render logic and event handler functions.</p><p class="medium-feed-link"><a href="https://blog.stackademic.com/understanding-render-logic-and-event-handlers-in-react-a-simple-guide-f317ac18fe8c?source=rss-c1e3328b1012------2">Continue reading on Stackademic »</a></p></div>]]></description>
            <link>https://blog.stackademic.com/understanding-render-logic-and-event-handlers-in-react-a-simple-guide-f317ac18fe8c?source=rss-c1e3328b1012------2</link>
            <guid isPermaLink="false">https://medium.com/p/f317ac18fe8c</guid>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Firat Atalay]]></dc:creator>
            <pubDate>Thu, 10 Oct 2024 11:10:54 GMT</pubDate>
            <atom:updated>2024-10-10T11:10:54.303Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Understanding State Batching in React: A Simple Explanation]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@firatatalay/understanding-state-batching-in-react-a-simple-explanation-8e58b24ea7d2?source=rss-c1e3328b1012------2"><img src="https://cdn-images-1.medium.com/max/862/1*ZRSUC7PIxRFpCdaZ20IDXA.png" width="862"></a></p><p class="medium-feed-snippet">In React, there are many things going on under the hood when it comes to rendering and updating the user interface.</p><p class="medium-feed-link"><a href="https://medium.com/@firatatalay/understanding-state-batching-in-react-a-simple-explanation-8e58b24ea7d2?source=rss-c1e3328b1012------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@firatatalay/understanding-state-batching-in-react-a-simple-explanation-8e58b24ea7d2?source=rss-c1e3328b1012------2</link>
            <guid isPermaLink="false">https://medium.com/p/8e58b24ea7d2</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Firat Atalay]]></dc:creator>
            <pubDate>Thu, 10 Oct 2024 03:28:36 GMT</pubDate>
            <atom:updated>2025-06-22T22:35:24.670Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Understanding the Key Prop in React: Why It’s Important and How to Use It]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://blog.stackademic.com/understanding-the-key-prop-in-react-why-its-important-and-how-to-use-it-936510f09631?source=rss-c1e3328b1012------2"><img src="https://cdn-images-1.medium.com/max/897/1*7yf3_IbMMJR4FV0O4i8WqQ.png" width="897"></a></p><p class="medium-feed-snippet">If you&#x2019;ve been learning React, you&#x2019;ve probably come across the term key prop.</p><p class="medium-feed-link"><a href="https://blog.stackademic.com/understanding-the-key-prop-in-react-why-its-important-and-how-to-use-it-936510f09631?source=rss-c1e3328b1012------2">Continue reading on Stackademic »</a></p></div>]]></description>
            <link>https://blog.stackademic.com/understanding-the-key-prop-in-react-why-its-important-and-how-to-use-it-936510f09631?source=rss-c1e3328b1012------2</link>
            <guid isPermaLink="false">https://medium.com/p/936510f09631</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[reactjs]]></category>
            <dc:creator><![CDATA[Firat Atalay]]></dc:creator>
            <pubDate>Tue, 08 Oct 2024 02:50:08 GMT</pubDate>
            <atom:updated>2024-10-09T03:23:51.985Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Understanding React’s Diffing Algorithm in Simple Terms]]></title>
            <link>https://blog.stackademic.com/understanding-reacts-diffing-algorithm-in-simple-terms-35142c977eb5?source=rss-c1e3328b1012------2</link>
            <guid isPermaLink="false">https://medium.com/p/35142c977eb5</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Firat Atalay]]></dc:creator>
            <pubDate>Mon, 07 Oct 2024 03:23:31 GMT</pubDate>
            <atom:updated>2024-10-07T03:23:31.227Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/876/1*RqHACMVBa_Tt8N9zpqkgEg.png" /></figure><h4>INTRODUCTION</h4><p>In our previous discussions about React’s render phase, we skipped over an important concept: the diffing algorithm, which plays a key role in React’s reconciliation process. We briefly mentioned it, but now it’s time to dive deeper into how it actually works. Let’s break it down in a clear and easy-to-understand way.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Dw9VGMgNVzB-TThMXeHm-g.png" /></figure><h3>What is Diffing?</h3><p>Diffing is the process React uses to compare the changes between two versions of a component tree during re-rendering. Essentially, it helps React figure out what changed in the UI and what needs to be updated in the most efficient way possible.</p><p>The diffing algorithm operates based on two important assumptions:</p><ol><li><strong>Different element types will result in different trees.</strong><br>This means that if you have two elements with different types (e.g., a &lt;div&gt; and a &lt;header&gt;), React treats them as completely different elements.</li><li><strong>Elements with a stable key remain the same across renders.</strong><br>If an element has a key (like in lists) that doesn’t change between renders, React will assume it’s the same element and will reuse it, instead of creating a new one.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/593/1*DFC90UMRlsPNXVEY_kwMmw.png" /></figure><h3>Why Are These Assumptions Important?</h3><p>At first glance, these assumptions may seem obvious, especially the first one. But they play a critical role in making React faster. For example, instead of comparing each element in the tree individually — which could take millions or billions of operations — React reduces the number of comparisons to just a few thousand operations, dramatically improving performance.</p><h3>How Does Diffing Work?</h3><p>When React compares two renders, it checks elements based on their position in the component tree. Here’s how the algorithm applies the assumptions:</p><ul><li>If React finds that the elements are of <strong>different types</strong> (like changing a &lt;div&gt; to a &lt;header&gt;), it assumes that the entire part of the UI has changed. So, it destroys the old elements and creates new ones from scratch.</li><li>If React finds that the elements have <strong>the same key</strong> (or are of the same type), it will keep the element and only update its properties as needed.</li></ul><p>This simple approach allows React to efficiently update only the parts of the UI that actually changed, without unnecessarily re-rendering everything.</p><h3>Understanding React’s Diffing Process :</h3><p>When React updates the UI, it uses a process called “diffing” to compare the current version of the component tree to the previous version. This helps React figure out what changed and how to update the DOM efficiently. In this article, we’ll break down two important situations React faces during the diffing process and how it handles each one.</p><h3>What is Diffing?</h3><p>In React, diffing is the step-by-step comparison between two renders based on the position of elements in the component tree. React looks at each position and compares whether the elements have changed or stayed the same. The key idea here is that there are only <strong>two scenarios</strong> that React needs to deal with:</p><ol><li><strong>Different elements at the same position</strong> in the tree.</li><li><strong>The same element at the same position</strong> in the tree.</li></ol><p>These are the core cases React handles when updating the UI, so let’s break them down.</p><h3>Scenario 1: Different Elements at the Same Position</h3><p>Let’s imagine your app re-renders, and React notices that an element in the tree has changed at a certain position. For example, say a &lt;div&gt; has been replaced with a &lt;header&gt; in the JSX code.</p><p>In this case, React assumes that both the element and all of its children have been completely replaced. As a result, React will:</p><ul><li><strong>Remove the old element</strong> and its children from the DOM.</li><li><strong>Create and insert new elements</strong>, even if the new structure looks similar to the old one.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XfG9r1ZO5o0cU_UcRH4NPg.png" /></figure><p>This process is crucial because it also destroys any state associated with the old elements. For example, if the replaced element was a component like a search bar with user-entered data or other states, all that information will be lost. React will treat the new component as a completely fresh instance, so the state won’t carry over.</p><h4>Key Takeaway:</h4><ul><li>When an element changes type, React <strong>removes the old element</strong> and <strong>rebuilds the new one</strong>, wiping out any saved state.</li></ul><h3>Scenario 2: The Same Element at the Same Position</h3><p>Now, let’s look at the second scenario, where the same element is rendered in the same position during both renders. This situation is much simpler. If React finds that nothing has changed structurally, it will <strong>keep the element in the DOM</strong>.</p><p>More importantly, if the element is a React component, its <strong>state is preserved</strong>. This means that any user input, changes, or internal states will remain intact because React didn’t need to remove or recreate the element.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SjXiCZWB7725GCAX1zh10w.png" /></figure><p>In this scenario, React might update some small things, like changing an element’s class name or modifying props. But other than that, the DOM stays as it is. The important thing here is that React will update only what’s necessary, making the process efficient without losing any of the saved state.</p><h4>Key Takeaway:</h4><ul><li>If the element stays the same, React <strong>keeps it in the DOM</strong> and <strong>preserves its state</strong>, while updating only the properties that have changed.</li></ul><h3>When You Want a Fresh Start: Using Keys</h3><p>There are times when you might want React to treat a component as a completely new instance, even if the element looks the same. This is where the <strong>key prop</strong> comes in. By changing the key, you can force React to recreate the component from scratch, which also resets its state.</p><p>For example, if you want to reset a form component every time a user switches tabs, you can assign a different key to the form component. This way, React knows it needs to create a fresh instance each time the key changes.</p><h3>Wrapping It Up</h3><p>React’s diffing algorithm is all about efficiency. By handling just two key situations — different elements at the same position or the same element — React can minimize updates while keeping the UI consistent.</p><ul><li><strong>Different element type</strong>? React removes the old element and its children, wiping out state.</li><li><strong>Same element type</strong>? React keeps the element and preserves its state, only making small updates like prop changes.</li></ul><p>And when you need more control, the <strong>key prop</strong> lets you force React to recreate components whenever you need. This balance of efficiency and flexibility is what makes React powerful and performant in real-world applications!</p><h3>Scenario Overview</h3><p>We will build a simple tab component. Each tab will have a button that increases the number of likes and a checkbox that hides or shows a paragraph. We’ll also switch between tabs, and observe when the state is preserved and when it is reset.</p><h3>Code Example</h3><pre>import React, { useState } from &#39;react&#39;;</pre><pre>function App() {<br>  const [activeTab, setActiveTab] = useState(1);</pre><pre>  return (<br>    &lt;div&gt;<br>      &lt;h1&gt;React Diffing Example&lt;/h1&gt;<br>      &lt;div&gt;<br>        &lt;button onClick={() =&gt; setActiveTab(1)}&gt;Tab 1&lt;/button&gt;<br>        &lt;button onClick={() =&gt; setActiveTab(2)}&gt;Tab 2&lt;/button&gt;<br>        &lt;button onClick={() =&gt; setActiveTab(3)}&gt;Tab 3&lt;/button&gt;<br>      &lt;/div&gt;</pre><pre>      {activeTab === 1 &amp;&amp; &lt;TabContent /&gt;}<br>      {activeTab === 2 &amp;&amp; &lt;TabContent /&gt;}<br>      {activeTab === 3 &amp;&amp; &lt;DifferentContent /&gt;}<br>    &lt;/div&gt;<br>  );<br>}</pre><pre>function TabContent() {<br>  const [likes, setLikes] = useState(0);<br>  const [isHidden, setIsHidden] = useState(false);</pre><pre>  return (<br>    &lt;div&gt;<br>      &lt;h2&gt;Tab Content&lt;/h2&gt;<br>      &lt;button onClick={() =&gt; setLikes(likes + 1)}&gt;Likes: {likes}&lt;/button&gt;<br>      &lt;label&gt;<br>        &lt;input<br>          type=&quot;checkbox&quot;<br>          checked={isHidden}<br>          onChange={() =&gt; setIsHidden(!isHidden)}<br>        /&gt;<br>        Hide Text<br>      &lt;/label&gt;<br>      {!isHidden &amp;&amp; &lt;p&gt;This is some text that can be hidden.&lt;/p&gt;}<br>    &lt;/div&gt;<br>  );<br>}</pre><pre>function DifferentContent() {<br>  return (<br>    &lt;div&gt;<br>      &lt;h2&gt;Different Content&lt;/h2&gt;<br>      &lt;p&gt;This content is completely different from the TabContent component.&lt;/p&gt;<br>    &lt;/div&gt;<br>  );<br>}</pre><pre>export default App;</pre><h3>Explanation of the Code</h3><p><strong>State Preservation in Same Components</strong>:</p><ul><li>We have three buttons that allow switching between tabs (Tab 1, Tab 2, and Tab 3).</li><li>Both <strong>Tab 1</strong> and <strong>Tab 2</strong> render the same component (TabContent).</li><li>The TabContent component has two states: likes: a number that increments when the &quot;Likes&quot; button is clicked. isHidden: a boolean to hide or show the paragraph.</li><li>Since <strong>Tab 1</strong> and <strong>Tab 2</strong> render the same component (TabContent), React will preserve the component’s state when switching between these tabs. For example, if you hide the text or increase the likes count on Tab 1, this state will persist when switching to Tab 2 and back to Tab 1.</li></ul><p><strong>State Reset in Different Components</strong>:</p><ul><li><strong>Tab 3</strong> renders a completely different component (DifferentContent).</li><li>When switching from Tab 1 or Tab 2 to Tab 3, React will <strong>destroy</strong> the TabContent component, removing it from the DOM.</li><li>If you return to Tab 1 or Tab 2 after visiting Tab 3, the state of TabContent (i.e., likes and hidden text) will be <strong>reset</strong> because React creates a fresh instance of the TabContent component.</li></ul><h3>Observing the Behavior</h3><h4><strong>Step-by-step Testing</strong>:</h4><p><strong>Click Tab 1</strong>:</p><ul><li>Increase the likes or hide the text.</li><li>Now switch to <strong>Tab 2</strong> and back to <strong>Tab 1</strong>.</li><li>You’ll notice the likes and hidden state <strong>stay the same</strong>. This happens because React recognizes that the component instance in Tab 1 and Tab 2 is the same.</li></ul><p><strong>Click Tab 3</strong>:</p><ul><li>Now switch to <strong>Tab 3</strong> and then return to <strong>Tab 1</strong>.</li><li>You’ll notice the likes count and hidden state are <strong>reset</strong>. This happens because TabContent was destroyed when you moved to Tab 3, so React creates a new instance of TabContent when you return to Tab 1.</li></ul><h3><strong>Why It Happens</strong>:</h3><ul><li>React’s diffing algorithm identifies that both Tab 1 and Tab 2 are rendering the <strong>same component</strong> (TabContent), so it preserves the state.</li><li>When switching to Tab 3, React sees that you are rendering a <strong>different component</strong> (DifferentContent), so it destroys the old component and resets the state when you come back to Tab 1.</li></ul><h3>Key Learning Points</h3><ul><li><strong>Same component, same position</strong>: State is preserved. React recognizes it’s the same component in the same position in the tree.</li><li><strong>Different component or different position</strong>: State is reset. React treats it as a new component and resets its state.</li></ul><h3>Conclusion</h3><p>This example illustrates how React’s diffing algorithm works to either preserve or reset state depending on whether the component is the same or different between renders. By understanding this, you can better control how your app behaves when components update, leading to more predictable and efficient UI rendering.</p><h3>🎉 Enjoyed This Article?</h3><p>If you found this article valuable, please give it a thumbs up! 👍 Your support inspires me to create more insightful content.</p><p>✨ <a href="https://medium.com/@firatatalay"><strong>Follow me on Medium</strong></a> to keep up with my latest posts and coding tips. Let’s explore the world of programming together!</p><p>🌟 Stay connected:</p><ul><li>🚀 <a href="https://github.com/mrfiratatalay"><strong>GitHub</strong></a>: Check out my projects and contributions.</li><li>💼 <a href="https://www.linkedin.com/in/f%C4%B1rat-atalay-2581142b6/"><strong>LinkedIn</strong></a>: Let’s network and chat about tech trends and opportunities!</li></ul><p>Thank you for reading, and happy coding! 🚀</p><h3>Stackademic 🎓</h3><p>Thank you for reading until the end. Before you go:</p><ul><li>Please consider <strong>clapping</strong> and <strong>following</strong> the writer! 👏</li><li>Follow us <a href="https://twitter.com/stackademichq"><strong>X</strong></a> | <a href="https://www.linkedin.com/company/stackademic"><strong>LinkedIn</strong></a> | <a href="https://www.youtube.com/c/stackademic"><strong>YouTube</strong></a> | <a href="https://discord.gg/in-plain-english-709094664682340443"><strong>Discord</strong></a></li><li>Visit our other platforms: <a href="https://plainenglish.io/"><strong>In Plain English</strong></a> | <a href="https://cofeed.app/"><strong>CoFeed</strong></a> | <a href="https://differ.blog/"><strong>Differ</strong></a></li><li>More content at <a href="https://stackademic.com/"><strong>Stackademic.com</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=35142c977eb5" width="1" height="1" alt=""><hr><p><a href="https://blog.stackademic.com/understanding-reacts-diffing-algorithm-in-simple-terms-35142c977eb5">Understanding React’s Diffing Algorithm in Simple Terms</a> was originally published in <a href="https://blog.stackademic.com/">Stackademic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding React’s Render Phase: A Simplified Guide]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://blog.stackademic.com/understanding-reacts-render-phase-a-simplified-guide-3a84ea7aacba?source=rss-c1e3328b1012------2"><img src="https://cdn-images-1.medium.com/max/934/1*LNzgDBUiweTphfeZNPb85Q.png" width="934"></a></p><p class="medium-feed-snippet">Welcome to what might be the most complex lecture in the React journey, but don&#x2019;t worry!</p><p class="medium-feed-link"><a href="https://blog.stackademic.com/understanding-reacts-render-phase-a-simplified-guide-3a84ea7aacba?source=rss-c1e3328b1012------2">Continue reading on Stackademic »</a></p></div>]]></description>
            <link>https://blog.stackademic.com/understanding-reacts-render-phase-a-simplified-guide-3a84ea7aacba?source=rss-c1e3328b1012------2</link>
            <guid isPermaLink="false">https://medium.com/p/3a84ea7aacba</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Firat Atalay]]></dc:creator>
            <pubDate>Mon, 07 Oct 2024 03:22:18 GMT</pubDate>
            <atom:updated>2024-10-07T03:22:18.714Z</atom:updated>
        </item>
    </channel>
</rss>