<?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 Arbaz Ajaz on Medium]]></title>
        <description><![CDATA[Stories by Arbaz Ajaz on Medium]]></description>
        <link>https://medium.com/@arbaz5256?source=rss-c157fa6f197f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*iikhTIpT0Xady-xs.jpg</url>
            <title>Stories by Arbaz Ajaz on Medium</title>
            <link>https://medium.com/@arbaz5256?source=rss-c157fa6f197f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 10:33:56 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@arbaz5256/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[Effortlessly Manage Your Finances with Wallet Buddy]]></title>
            <link>https://arbaz5256.medium.com/effortlessly-manage-your-finances-with-wallet-buddy-5bbe60a79f43?source=rss-c157fa6f197f------2</link>
            <guid isPermaLink="false">https://medium.com/p/5bbe60a79f43</guid>
            <category><![CDATA[pwa]]></category>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[fintech]]></category>
            <dc:creator><![CDATA[Arbaz Ajaz]]></dc:creator>
            <pubDate>Tue, 16 Jul 2024 13:08:16 GMT</pubDate>
            <atom:updated>2024-07-16T13:08:16.269Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DlXmmRBV3paYvdiTdPB_9g.png" /></figure><p>In today’s fast-paced world, keeping track of finances, especially when shared with friends, family, or housemates, can be a daunting task. That’s why we’re excited to introduce <strong>Wallet Buddy</strong> — an innovative web app designed to simplify expense tracking, bill splitting, and gaining insights into your spending, all in one place.</p><p><a href="https://wallet-buddy-app.netlify.app/">Application/website</a> | <a href="https://www.linkedin.com/company/wallet-buddy-app">LinkedIn</a></p><h3>Meet the Team Behind Wallet Buddy</h3><p>Our journey started with a simple yet ambitious goal: to create a seamless financial management tool that caters to the needs of everyone, from students sharing rent to families managing household expenses. The Wallet Buddy team is comprised of three dedicated individuals:</p><p><a href="https://www.linkedin.com/in/arbaz-ajaz/"><strong>Arbaz Ajaz</strong> </a>— A full stack developer with a passion for creating robust and user-friendly applications.<br><a href="https://www.linkedin.com/in/saqib-ejaz-75678818b/"><strong>Saqib Ejaz</strong></a>— A talented React intern who brings fresh perspectives and innovative solutions to the front-end experience.<br><a href="https://www.linkedin.com/in/badria-arbaz-119808205/"><strong>Badria Arbaz</strong></a>— Our skilled content writer who ensures that our messaging is clear, engaging, and accessible to all users.</p><h3>Key Features of Wallet Buddy</h3><p><strong>Wallet Buddy</strong> is designed to offer a comprehensive suite of features that make managing shared finances a breeze:</p><p><strong>1. Add Bills and Split Them with Friends</strong><br>Easily add expenses and split them among friends, family, or housemates. Whether it’s a dinner bill, rent, or a group gift, Wallet Buddy ensures everyone pays their fair share.</p><p><strong>2. Keep Track of Who You Owe and Who Owes You </strong><br>No more awkward reminders or forgotten IOUs. Wallet Buddy keeps a detailed record of all transactions, so you always know who you owe and who owes you.</p><p><strong>3. Settle Debts </strong><br>Settling debts has never been easier. With Wallet Buddy, you can quickly and efficiently settle outstanding balances, making sure that everyone is on the same page.</p><p><strong>4. Gain Insights on How You’re Spending </strong><br>Understanding your spending habits is crucial for better financial management. Wallet Buddy provides detailed insights into your daily, weekly, and monthly transactions, helping you make informed financial decisions.</p><p><strong>5. Offline Support</strong><br>We understand that internet access isn’t always guaranteed. That’s why Wallet Buddy is designed to work offline, allowing you to add expenses and track debts even when you’re not connected.</p><h3>Why Wallet Buddy?</h3><p>In a world where financial management tools are abundant, Wallet Buddy stands out for its simplicity, functionality, and focus on shared expenses. Our app is not just about tracking money; it’s about fostering transparency and accountability among friends and family. With Wallet Buddy, managing finances becomes a collaborative and stress-free experience.</p><p>We are thrilled to bring Wallet Buddy to you and are confident that it will revolutionize the way you handle shared finances. Join us on this exciting journey and take control of your expenses with ease and confidence.</p><p>Stay tuned for more updates and features as we continue to enhance Wallet Buddy to meet your needs. Happy budgeting!</p><p>— -</p><p>Feel free to share your thoughts and feedback. We’d love to hear how Wallet Buddy is making a difference in your financial management!</p><p><a href="https://wallet-buddy-app.netlify.app/">https://wallet-buddy-app.netlify.app</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5bbe60a79f43" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Bottom Sheet with React Native]]></title>
            <link>https://arbaz5256.medium.com/bottom-sheet-with-react-native-c249130bed63?source=rss-c157fa6f197f------2</link>
            <guid isPermaLink="false">https://medium.com/p/c249130bed63</guid>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[animated]]></category>
            <category><![CDATA[bottomsheet]]></category>
            <category><![CDATA[typescript]]></category>
            <dc:creator><![CDATA[Arbaz Ajaz]]></dc:creator>
            <pubDate>Mon, 22 Jan 2024 06:28:05 GMT</pubDate>
            <atom:updated>2024-01-22T06:35:22.185Z</atom:updated>
            <content:encoded><![CDATA[<h4>Let’s build ourselves a basic bottom sheet in react native.</h4><p>Github: <a href="https://github.com/arbaz52/react-native-bottom-sheet">https://github.com/arbaz52/react-native-bottom-sheet</a></p><figure><img alt="Demo of implementation." src="https://cdn-images-1.medium.com/max/600/1*g3lOm7pq96BHnoFEDXYFMw.gif" /></figure><p>We’ll start with a bare react-native project. Start with following react native’s documentation on how to setup a project. Once you have the project all set. Open it in your editor of choice. I go with VSCode.</p><h3>Imports</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IgmIJqlPkiOu-UGOZ4EmFA.png" /></figure><h3>Constants</h3><p>The reason we’re using Dimension of window instead of screen is because we’ll be displaying an overlay behind the bottom sheet and over the actual content, and we want it to draw over the status bar as well, otherwise status bar will look odd.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3x8IjZcCOQBlXlajaYkhPQ.png" /></figure><h3>Styles</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yzkU4QpospIf5q3yK36V8A.png" /></figure><h3>Bottom Sheet Component</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Vs_k94F5e2i6zIaQQxzi5g.png" /></figure><p>The reason we’re using forwardRef is we want our bottom sheet to be opened/closed by outside as well so we’ll be exposing functions that will let us do that.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hG72ij2-djgrBuuga0QO7g.png" /></figure><p>We’ll use the state expanded to render/not-render our overlay so it does not render over the content if the bottom sheet is closed.</p><p>We’re starting with bottom sheet closed that is why the opacity that we will use for our overlay is set to 0</p><p>The reason we’re doing WINDOW_HEIGHT — BOTTOM_SHEET_HEIGHT.min is because we’re starting from the top, we move to the window’s bottom and then moving up the same amount as the minimum height for the bottom sheet. Notice that we’re not chaging our bottom sheet’s height, that would always be the max height we’ve set it, we’re just moving it so the rest goes out of screen.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6F7BYSK9wbWM8pcw4FPMPA.png" /></figure><p>I’ll explain why we’re using translateY.flattenOffset once I show you the implementation of PanResponder but other than that, we’re just writing two animations, one for overlay and the other for our bottom sheet and then playing them in parallel.</p><p>Also, we’re now exposing these functions that will be used externally (outside the component) to open/close the bottom sheet.</p><h3><strong>Butter (Using PanResponder)</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*miQ5kULOeqLZ3cF71FFGBA.png" /></figure><p>onMoveShouldSetPanResponder : We’re returning true so we get access to events when a gesture is performed.</p><p>onPanResponderGrant : When the gesture begins, we extract the current value of our translateY, use it as its offset and set its value to 0. Otherwise, when the user will perform the gesture, the bottom sheet will stutter.</p><p>onPanResponderMove : During the time when the gesture is being performed, we’re getting its change in y/vertical axis and using it as value for our translateY</p><p>onPanResponderRelease : When the gesture ends, we extract the value of how much was dragged in y/vertical axis and if it’s less than our threshold value, we ignore the drag and animate our translateY value to 0 . If it’s greater, we’re checking the gesture direction, if it’s upwards or -ive, we open the sheet, otherwise we close it using functions we’ve defined earlier.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N0rQQzYs4oKRK0fMalytYA.png" /></figure><p>Final piece in the puzzle is the rendering:</p><ul><li>Status bar is translucent because we want to draw our overlay on top of it.</li><li>We do not render the overlay if the bottom sheet is closed.</li><li>We’re using Animted.View instead of simple View because we want to animate its transform property.</li><li>We’re attaching panResponder.panHandlers responsible for accessing/handling gesture events to allow user to drag the bottom sheet vertically.</li><li>We’re rendering the content of the bottom sheet passed by the parent after the drag handle.</li></ul><h3>Usage</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eXdJMWfaWGtjMZKNJlBehw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c249130bed63" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using Import Aliases in React JS/TS]]></title>
            <link>https://arbaz5256.medium.com/using-import-aliases-in-react-js-ts-9e7da686b93f?source=rss-c157fa6f197f------2</link>
            <guid isPermaLink="false">https://medium.com/p/9e7da686b93f</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[react-typescript]]></category>
            <category><![CDATA[alias]]></category>
            <category><![CDATA[import-export]]></category>
            <dc:creator><![CDATA[Arbaz Ajaz]]></dc:creator>
            <pubDate>Tue, 15 Nov 2022 12:35:30 GMT</pubDate>
            <atom:updated>2022-11-15T12:35:30.142Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j583USChNcmomglHnUmw8Q.jpeg" /><figcaption>Photo by <a href="https://www.pexels.com/photo/construction-worker-on-a-scaffolding-5432294/">Chester Zhao</a></figcaption></figure><p>Import aliases play a major role in keeping the codebase clean. But integrating it inReact project is a headache. This article assumes that you already know how to write import aliases. We will cover the integration part in this article.</p><h4>Installing Dependencies</h4><p>Let’s add the dependencies by running the following command:</p><p>yarn add --dev react-app-rewired react-app-rewire-alias</p><h3>Javascript</h3><p><em>You can skip this step if your project uses typescript.</em></p><p>Create jsconfig.json file inside the root directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bbQNBiL7i583BcuzaD02cA.png" /><figcaption>jsconfig.json</figcaption></figure><p>Update package.json and replace react-scripts with react-app-rewired.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*qEKZ5otc2QE0Sj_V82fPUQ.png" /><figcaption>package.json</figcaption></figure><p>Create config-overrides.js file in the root directory with following code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8zS6e9BOtkMTgsmGFzzZvQ.png" /><figcaption>config-overrides.js</figcaption></figure><h3>Typescript</h3><p><em>You can skip this step if your project uses javascript.</em></p><p>Create tsconfig.alias.json file inside the root directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bbQNBiL7i583BcuzaD02cA.png" /><figcaption>jsconfig.json</figcaption></figure><p>Add the following line inside the tsconfig.json file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/902/1*ddeXy5fVaXfjRVeHm31U7Q.png" /><figcaption>Add the following inside tsconfig.json file</figcaption></figure><p>Update package.json and replace react-scripts with react-app-rewired.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*qEKZ5otc2QE0Sj_V82fPUQ.png" /><figcaption>package.json</figcaption></figure><p>Create config-overrides.js file in the root directory with following code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dj_EXRRxSqQzWFJgJ5UfUw.png" /><figcaption>config-overrides.js</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9e7da686b93f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Inspirational React.JS Project Structure!]]></title>
            <link>https://arbaz5256.medium.com/inspirational-react-js-project-structure-662b0d4e9c1a?source=rss-c157fa6f197f------2</link>
            <guid isPermaLink="false">https://medium.com/p/662b0d4e9c1a</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[project-management]]></category>
            <category><![CDATA[file-structure]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[motivation]]></category>
            <dc:creator><![CDATA[Arbaz Ajaz]]></dc:creator>
            <pubDate>Sun, 13 Nov 2022 00:42:21 GMT</pubDate>
            <atom:updated>2022-11-13T00:42:21.382Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tbLeTPFrveYv5OV4SnFabw.jpeg" /><figcaption>Photo by <a href="https://www.pexels.com/photo/crop-unrecognizable-multiethnic-colleagues-joining-hands-3865544/">Andrea Piacquadio</a></figcaption></figure><p>A project includes assets, services, stylesheets, reusable components, routes, test cases, custom hooks, multiple developers and much more. The project structure I am about to explain provides easier navigation, onboarding process and maintainability.</p><h3>Design Pattern</h3><p>We will be following <strong>Container/Component</strong> pattern. Basically separating the business logic from the presentation. This helps us in faster bug fixing, creating reusable UI components and keeping the codebase fairly light.</p><h4>Component</h4><p>A component is a building block of a React project. It is responsible for the presentation of data. Ideally it should not have any dependencies nor should it be managing state, and should render the same view if passed the same props.</p><h4>Container</h4><p>A container contains the business logic that includes managing states, events, calling services, consuming hooks and what not.</p><h3>Building Blocks</h3><p>We will split the functionality into building blocks based on the work they do. This is to improve development experience.</p><p><strong>Note: Do not export anything as default but follow named exports.</strong></p><pre>`-- src/<br>  |-- atoms/<br>    `-- &lt;atomName&gt;.atom.ts<br>  |-- hooks/<br>    `-- use&lt;HookName&gt;.ts<br>  |-- services/<br>    `-- &lt;serviceName&gt;.service.ts<br>  |-- contexts/<br>    `-- &lt;contextName&gt;.context.ts<br>  |-- components/<br>    `-- &lt;ComponentName&gt;/<br>      |-- &lt;ComponentName&gt;.tsx<br>      |-- &lt;ComponentName&gt;.types.ts<br>      |-- &lt;ComponentName&gt;.styled.ts     # css in js (styled-components)<br>      |-- &lt;ComponentName&gt;.container.ts  # access atoms, contexts, callbacks etc.<br>      |-- hooks/     # follows src/hooks structure<br>      |-- atoms/     # follows src/atoms structure<br>      |-- services/  # follows src/services structure<br>      `-- contexts/  # follows src/contexts structure<br>  `-- routes/<br>    `-- &lt;ComponentName&gt;Route/<br>      |-- &lt;ComponentName&gt;Route.tsx        # extract route params, auth check etc.<br>      |-- &lt;ComponentName&gt;Route.types.ts   # i.e. route params structure/interface<br>      |-- &lt;ComponentName&gt;/    # follows src/components structure<br>      `-- routes/             # follows src/routes structure</pre><h4>Components</h4><p>A component is a building block of a React project. It is responsible for the presentation of data. Ideally it should not have any dependencies nor should it be managing state, and should render the same view if passed the same props. For example: Button, Input etc.</p><h4>Routes</h4><p>A route is a React component, responsible for providing the component based on current URL/path. It is also responsible for extracting any route/query parameters and passing them to required component/container and/or managing nested routes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b58lxjK9Vpmg0GhJ3S2koA.png" /><figcaption>Table for naming route components.</figcaption></figure><h4>Services</h4><p>A service is a wrapper for side-effects. This can be used outside the eco-system of react. For example, running mutations. As cache of Apollo GraphQL lives outside the eco-system, it can be mutated outside the React’s eco-system.</p><h4>Hooks</h4><p>Hooks are similar to services but can only be used inside the React eco-system. In most cases, a service would be sufficient but in some cases where reactivity is required, hooks are preferred. For example, fetching data from GraphQL because returned data is in sync with Apollo GraphQL’s cache and any changes to it will update the react update the react component too.</p><h3>Project Structure</h3><p>Now that we know the building blocks, where do we look for them; like where do they live. So, we have divided building block into two categories based on the scope.</p><h4>Global</h4><p>If anything building block is shared across the app, it usually lives inside src/&lt;building-block-type&gt;/&lt;building-block&gt;.</p><h4>Local</h4><p>If the building block is only used by one component, it is stored at **/&lt;ParentComponent&gt;/&lt;building-block-type&gt;/&lt;building-block&gt;/. A building-block is mostly created locally, as it is required by multiple components, it is moved to the nearest common parent component (up in the directory tree) shared by the components that require it.</p><h3>Naming Convention</h3><h4>Pascal Case (PascalCase)</h4><p>Types, interfaces, components, container-components, route-components, styled-components should follow &quot;PascalCase&quot;.</p><p><strong>Components</strong></p><ul><li>Suffix &quot;Route&quot; to route-component. For example: NetworkTestRoute.</li><li>Suffix &quot;Container&quot; to container-component. For example: NetworkTestContainer.</li></ul><p><strong>Types/Interfaces</strong></p><ul><li>Prefix &quot;I&quot; to types and interfaces. For example: IWebinar.</li><li>Suffix &quot;Props&quot; to types/interfaces to define component&#39;s props. For example: INetworkTestProps, INetworkTestContainerProps.</li></ul><h4>Camel Case (camelCase)</h4><ul><li>Suffix &quot;Service&quot; to services.</li><li>Prefix &quot;use&quot; to hooks.</li><li>Suffix &quot;Atom&quot; to atoms.</li><li>Suffix “Atom” to atoms.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=662b0d4e9c1a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Enable Intellisense in JSON files]]></title>
            <link>https://arbaz5256.medium.com/enable-intellisense-in-json-files-c4d9e4d661e1?source=rss-c157fa6f197f------2</link>
            <guid isPermaLink="false">https://medium.com/p/c4d9e4d661e1</guid>
            <category><![CDATA[intellisense]]></category>
            <category><![CDATA[json]]></category>
            <category><![CDATA[vscode]]></category>
            <category><![CDATA[json-schema]]></category>
            <category><![CDATA[validation]]></category>
            <dc:creator><![CDATA[Arbaz Ajaz]]></dc:creator>
            <pubDate>Thu, 31 Mar 2022 22:54:20 GMT</pubDate>
            <atom:updated>2022-03-31T22:54:20.753Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://json-schema.org/">JSON Schema</a> helps you in <strong>annotating</strong> and <strong>validating</strong> your JSON documents.</p><h4>Example</h4><p>Let’s take an example of a typescript project. A typescript project mainly contains a tsconfig.json file. For more information about the file, take a look at its <a href="https://www.typescriptlang.org/docs/handbook/tsconfig-json.html">documentation</a>. Normally, VSCode provides intellisense for this file but…</p><p>Say we need to maintain a separate configuration file for alias imports, but how do we enable intellisense for it? Easy, we can look for JSON Schema for tsconfig file on the web, I found one <a href="https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/tsconfig.json">here</a>. All we need to do now is to add the following in our newly created json file that we need intellisense for:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SeyUG8QtvBrVQY72rEOZRQ.png" /></figure><pre>{<br>  &quot;$schema&quot;: &quot;&lt;paste url for json schema here&gt;&quot;, <br>  ... rest of the content<br>}</pre><p>and here is the result!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/732/1*Kt4cBxJ5XjIcrsp9HfYE2g.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c4d9e4d661e1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ReactJS: Taking a Look at useEffect Hook’s Execution.]]></title>
            <link>https://arbaz5256.medium.com/reactjs-taking-a-look-at-useeffect-hooks-execution-17f1f12e141d?source=rss-c157fa6f197f------2</link>
            <guid isPermaLink="false">https://medium.com/p/17f1f12e141d</guid>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[useeffect]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[hooks]]></category>
            <dc:creator><![CDATA[Arbaz Ajaz]]></dc:creator>
            <pubDate>Tue, 31 Aug 2021 18:32:29 GMT</pubDate>
            <atom:updated>2021-09-01T05:37:27.745Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C1pL_FNwp1AKqoLfoekyDQ.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@xps?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">XPS</a> on <a href="https://unsplash.com/?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>This article assumes that you’ve used or have been using useEffect hook. I shall be covering its execution and following this article,</p><p><em>I will be posting more articles on this hook covering the caveats, bad practices, how to use </em><em>useEffect effectively when dependencies change frequently and how to use </em><em>useEffect as a callback.</em></p><p>In this article, we’ll take a look at the following:</p><ul><li>Execution: <strong>When</strong> and <strong>order</strong> in which the hook is rendered.</li><li>Execution: When a<strong> child component</strong> is involed.</li><li>Execution: When a <strong>custom hook</strong> that uses useEffect is involved.</li></ul><h4>Sandbox</h4><p>Following is the link to codesandbox containing the code used in this article. <a href="https://codesandbox.io/s/github/arbaz52/reactjs-useEffect-hook-execution">https://codesandbox.io/s/github/arbaz52/reactjs-useEffect-hook-execution</a></p><h3>Execution</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/925/1*mGmSCB8mOSBnsiEklrUPmg.png" /><figcaption>Screenshot from ReactJS <a href="https://reactjs.org/docs/hooks-effect.html#:~:text=If%20you%E2%80%99re%20familiar%20with%20React%20class%20lifecycle%20methods%2C%20you%20can%20think%20of%20useEffect%20Hook%20as%20componentDidMount%2C%20componentDidUpdate%2C%20and%20componentWillUnmount%20combined.">Documentation</a> on useEffect</figcaption></figure><p><a href="https://reactjs.org/docs/hooks-effect.html#:~:text=What%20does%20useEffect%20do%3F%20By%20using%20this%20Hook%2C%20you%20tell%20React%20that%20your%20component%20needs%20to%20do%20something%20after%20render.%20React%20will%20remember%20the%20function%20you%20passed%20(we%E2%80%99ll%20refer%20to%20it%20as%20our%20%E2%80%9Ceffect%E2%80%9D)%2C%20and%20call%20it%20later%20after%20performing%20the%20DOM%20updates">Documentation</a> mentions that by using this hook, we tell react that your component needs to do something after the it is done rendering.</p><blockquote><strong>IMPORTANT: </strong>After the component is done rendering, it checks each useEffect hook sequentially in order which they are written. Going through each useEffect hook in the component (that has done rendering). If any of the entry in the dependency array has changed, the callback associated with it/passed to it is run.</blockquote><p>Following example sandbox demonstrates the execution of this hook.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e1IlNnAOLIodT9PpQdvQEw.png" /><figcaption>Example Code to Demonstrate useEffect Hook’s Execution.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/219/1*uzdmfVhs3WMa658Ik1JAaQ.png" /><figcaption>Result: Console Logs</figcaption></figure><h4>Explaination</h4><p>If you look at the above picture, we can trace out when and in which order the callbacks are executed/called.</p><p>Firstly, the component is rendered that is why the 1) &amp; 2) are executed first. After the component has finished rendering, the first useEffect is processed and its callback is executed, then the next useEffect is processed and then the last one.</p><h4>Before moving forward</h4><p>Now that you know the execution of useEffect hook is executed, we can move to the next example.</p><h3>Scenario 1: Introducing Child Component</h3><p>During the execution of the parent component, if a child component needs to be rendered, the parent component’s render is halted. The child component starts rendering and after its (child component’s) rendering is complete, its (child component’s) set of useEffect hooks are processed. After it’s done, parent component’s render is resumed.</p><p>Following example sandbox demonstrates the scenario:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fs3sWniZgKiLWgkVXeAkyg.png" /><figcaption>Example Code to Demo Execution when a Child Component is Involved.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/758/1*3c8NSc77EiPxomH0dIfH6Q.png" /><figcaption>Result: Console Logs</figcaption></figure><h3>Scenario 2: Introducing Custom Hooks</h3><p>When a custom hook is involved which has a useEffect hook inside it, it follows the execution pattern of the component in which it is being used.</p><p>The set of useEffect hooks written inside the custom hook are processed after the component it is written in completes rendering. The order of execution depends in the order they’re written inside the component. If the custom hook is called at the start of the component before the component’s set of useEffect hooks, custom hook’s set of useEffect are processed first and vice versa.</p><p>The following example sandbox demonstrates the scenario:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iRQE1uFUWzYEBaKeyoRI4Q.png" /><figcaption>Example Code to Demo Execution when a Custom Hook using useEffect hook is used.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/759/1*vOgX6OS8S7v2kiK2GCTrqg.png" /><figcaption>Result: Console Logs</figcaption></figure><p>Firstly, the component is rendered, after it has finished rendering, the custom hook’s set of useEffect hooks are processed, after that the set of useEffect hooks written after the custom hook’s usage are processed.</p><h4>Embedded Sandbox</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodesandbox.io%2Fembed%2Fi74x2&amp;display_name=CodeSandbox&amp;url=https%3A%2F%2Fcodesandbox.io%2Fs%2Fi74x2&amp;image=https%3A%2F%2Fcodesandbox.io%2Fapi%2Fv1%2Fsandboxes%2Fi74x2%2Fscreenshot.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codesandbox" width="1000" height="500" frameborder="0" scrolling="no"><a href="https://medium.com/media/a8f19cdc6d6bb1d9c9b6fb74baef6f06/href">https://medium.com/media/a8f19cdc6d6bb1d9c9b6fb74baef6f06/href</a></iframe><h3>Conclusion:</h3><p>Basic understanding of how, when and in what order useEffect hook is processed helps a lot in coming up with an easy to understand, track-able and stable solution to a problem.</p><p>I hope you got something out of this article and would love to have a conversation about it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=17f1f12e141d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ReactJS: Selective Context Consumer]]></title>
            <link>https://arbaz5256.medium.com/reactjs-selective-context-consumer-939464e9ca02?source=rss-c157fa6f197f------2</link>
            <guid isPermaLink="false">https://medium.com/p/939464e9ca02</guid>
            <category><![CDATA[context-api]]></category>
            <category><![CDATA[optimization]]></category>
            <category><![CDATA[reduce-rerenders]]></category>
            <category><![CDATA[memoization]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Arbaz Ajaz]]></dc:creator>
            <pubDate>Sat, 03 Jul 2021 21:32:45 GMT</pubDate>
            <atom:updated>2021-07-04T00:58:50.908Z</atom:updated>
            <content:encoded><![CDATA[<h4>Re-render component if selected values/subset of values change</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/859/1*6PJJqHW_302QoaduS34ibA.png" /><figcaption>`React Profiler` Output</figcaption></figure><p>A while back, we came across an issue, while using an object as a context value which contains states and methods to update said states</p><h4>Relevant Links:</h4><p>The project repository (refactored source code) can be access at <a href="https://github.com/arbaz52/selective-context-consumer"><strong>Github</strong></a>. A link to sandbox can be accessed at <a href="https://codesandbox.io/s/github/arbaz52/raw-selective-context-values-consumer"><strong>CodeSandbox</strong></a>.</p><h4>Problem:</h4><p>If the context value updates when any one/more values inside the object change, it causes every component using the said context with useContext hook to re-render even if the component was not using that value(s) inside the context which updated.</p><p>This caused unnecessary re-renders and we did not want to use a library as the timeline was almost complete.</p><h4>How I Created a Work-Around:</h4><p>I used memoization techniques to reduce unnecessary re-renders.</p><p>I created a Functional Component that takes in the context and the selection function as props . I then cache the selection and pass the selection to a memoized React component.</p><p>The memoized React component then renders the result. I have written a custom function that checks if the props passed have been changed, if so i flag the component to render otherwise it does not re-render.</p><h4>Reason behind the above approach:</h4><p>The reason I created two components lies in the problem we are facing.</p><p>First/parent component uses the context with useContext and it re-renders every time the context value updates.</p><p>Child/second component accepts the selection as prop and the custom shouldComponentUpdate function passed as a second parameter to React.memo checks the next selection prop against old selection prop and if they do not match, it flags it to be rendered.</p><p>This way, the component passed as a children prop to first component only re-renders if the selection changes.</p><h3>Code Explanation</h3><h4>Project Structure:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/992/1*9yd9PO7JWsyTjTHNCRrupw.png" /><figcaption>Project Structure</figcaption></figure><h4>‘Selective Context Consumer’ Component:</h4><p>context accepts a React Context, selector accepts a function that has the context passed to component it as a prop and it returns the selection.</p><p>The component follows a render prop pattern and passes the selection as a parameter to the function passed as children which then returns a React Node.</p><p>name is just for debugging, so we can see what’s going on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P2ZJfRzttSjX4ZRD3pk7Hw.png" /></figure><p>It is simply using the context passed to it and extracting the required content from it using the selection function passed to it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NyqIKHNRDDPrt-j1qZ9zMA.png" /></figure><h4>Selective Context Consumer Child:</h4><p>It accepts the memoized selection and the render function as props. name is just for debugging the life cycle of the component.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V2YXGM_qnlew2GeD1w6Ilg.png" /></figure><p>It simply contains the rendering, the main logic comes when memoizing it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tCnR-Fg4cue-RAvkwvW7oA.png" /></figure><h4>Should Component Update:</h4><p>pvProps.value &amp; nxtProps.value contain the selection, so we’re checking if the selection has updated, if so, we re-render it. If not, we check if the render function passed to it has changed. If so, it re-renders it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kOimcH1iiuBaGMrsoRqTdg.png" /></figure><h4>State Context:</h4><p>Contains the two states: beer &amp; honey. Two functions to mutation states respectively addBeer &amp; addHoney.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ftYoKNmfRIp8sFvuG_ov7g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*PRVu8QZW7iAeDeN2MOV-GQ.png" /></figure><h4>App Component:</h4><p>Creating states and dispatches and wrapping the memoized component with the StateContext.Provider.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c3rOMvwKZvCtupr-GmSNlg.png" /><figcaption>App Component</figcaption></figure><h4>‘Component’ Component:</h4><p>Just a memoized component which holds the actual sugar.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z35JJD30Bv8EAVkf2lXI1Q.png" /></figure><h4>Honey Component:</h4><p>We’re passing in the selection function we’ve defined which extracts the honey and addHoney from the context. I had to memoize the selector function as it typecasts the selection so on line#21, we know the type of value.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M-YwqLXashoF04PirKL1Uw.png" /></figure><h3>Understanding the Components Life-Cycles:</h3><p>Using the console logs we can explain the flow after we increment honey value by calling the addHoney function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BEOuxPrP6ppQSXdNJ55LTw.png" /><figcaption>selection changed so render function for button that increments honey is called whereas the button to increment beer stays same.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/857/1*St4JEyQoV-1AgjsrkpHk8g.png" /><figcaption>the selective context consumer child with render function that has button which increments honey is re-rendered whereas the child with render function that has button which increments beer is not rendered.</figcaption></figure><h3>Conclusion</h3><p>Yes, there exists libraries which achieve the same/even better results. The motivation was to implement optimization in a way which is re-usable and learn in the process of making it. This article provides a solution to the problem and the brains behind the journey and the journey itself.</p><p>I would like to dedicate this article to my fiancé <strong>Badria Arshad </strong>who motivates me and stays with me during the journey.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=939464e9ca02" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using React.cloneElement() to Assess Validity of an Input Field.]]></title>
            <link>https://arbaz5256.medium.com/using-react-cloneelement-to-assess-validity-of-an-input-field-da11bf6c10a2?source=rss-c157fa6f197f------2</link>
            <guid isPermaLink="false">https://medium.com/p/da11bf6c10a2</guid>
            <category><![CDATA[clean-code]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[cloneelement]]></category>
            <category><![CDATA[react-top-level-api]]></category>
            <dc:creator><![CDATA[Arbaz Ajaz]]></dc:creator>
            <pubDate>Thu, 01 Jul 2021 07:55:20 GMT</pubDate>
            <atom:updated>2021-07-02T00:09:03.167Z</atom:updated>
            <content:encoded><![CDATA[<p>React has a set of Top Level APIs that can be used to write cleaner code in certain scenarios.</p><blockquote><em>But before you use them, you need to have all the people working with you to be on the same page. Writing a clean code means it can be easily read and understood by others.</em></blockquote><h4>Explaining the Implementation:</h4><p>You can read more from the <a href="https://reactjs.org/docs/react-api.html#cloneelement">documentation</a> on React.cloneElement . In this article, I have used React.cloneElement to access the pattern and onChange prop of the child element to assess if the value is valid or not. If the value is invalid, an error is displayed beside the input field.</p><h3>Implementation</h3><p>We are using props passed to child component and appending functionality to its callbacks to check if the value is valid, i.e. passes the regex pattern passed to the child/Input component.</p><h4>Sandbox:</h4><p>Following is the link to the sandbox: <a href="https://codesandbox.io/s/github/arbaz52/react-clone-element-assess-field-validity">https://codesandbox.io/s/github/arbaz52/react-clone-element-assess-field-validity</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lVAUIkzBuXMmxEYXnyeikw.png" /><figcaption><a href="https://codesandbox.io/s/github/arbaz52/react-clone-element-assess-field-validity?file=/src/App.tsx">App</a> Component</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bEIkgqFWFKHse2d-_JJmQA.png" /><figcaption>Utility <a href="https://codesandbox.io/s/github/arbaz52/react-clone-element-assess-field-validity?file=/src/utility.ts">Function</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6FQzSrlriiSwqYqro6sopA.png" /><figcaption><a href="https://codesandbox.io/s/github/arbaz52/react-clone-element-assess-field-validity?file=/src/types.ts">Props</a> required for <a href="https://codesandbox.io/s/github/arbaz52/react-clone-element-assess-field-validity?file=/src/ValidityInformer.tsx">ValidityInformer</a> Component</figcaption></figure><h4>Validity Informer Component</h4><p>The implementation requires the component to be an HTMLInputElement but you can any as you please.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JDd19-Aa0-nwytAYX_bE1g.png" /><figcaption><a href="https://codesandbox.io/s/github/arbaz52/react-clone-element-assess-field-validity?file=/src/ValidityInformer.tsx">ValidityInformer</a> Component</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/1*uXLIi3l6-9vE6JuK6WHO5Q.png" /><figcaption><a href="https://codesandbox.io/s/github/arbaz52/react-clone-element-assess-field-validity?file=/src/styles.css">Styles</a></figcaption></figure><h4>Live Demo:</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodesandbox.io%2Fembed%2Fkgxd9&amp;display_name=CodeSandbox&amp;url=https%3A%2F%2Fcodesandbox.io%2Fs%2Fkgxd9&amp;image=https%3A%2F%2Fcodesandbox.io%2Fapi%2Fv1%2Fsandboxes%2Fkgxd9%2Fscreenshot.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codesandbox" width="1000" height="500" frameborder="0" scrolling="no"><a href="https://medium.com/media/c0b345c382f412333e304217adbdc049/href">https://medium.com/media/c0b345c382f412333e304217adbdc049/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=da11bf6c10a2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Managing Forms and Input Fields in ReactJS]]></title>
            <link>https://arbaz5256.medium.com/managing-forms-and-input-fields-in-reactjs-c5cae53512f?source=rss-c157fa6f197f------2</link>
            <guid isPermaLink="false">https://medium.com/p/c5cae53512f</guid>
            <category><![CDATA[forms]]></category>
            <category><![CDATA[useref]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[usestate]]></category>
            <category><![CDATA[input-field]]></category>
            <dc:creator><![CDATA[Arbaz Ajaz]]></dc:creator>
            <pubDate>Tue, 29 Jun 2021 16:39:38 GMT</pubDate>
            <atom:updated>2021-07-01T01:29:51.187Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1Yb_EKHLP16hZk643VXoRw.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@anniespratt?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Annie Spratt</a> on <a href="https://unsplash.com/s/photos/small-pot?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>When you start creating websites in React that extensively depend on the forms and input from the user, you might come across the following issues, well; when we starting working on the project, we obviously did.</p><ul><li>Rendering of component that contains Form becomes expensive.</li><li>Implementing a work around for the first problem makes the state inconsistent with the UI.</li></ul><h3>Solution</h3><h4>Explanation</h4><p>We do not always need to maintain the state containing the values being input by the user, unless the component has to perform an action against it or whatever you’d prefer to call it. Maintaining a reference to the input fields and accessing the values through the refs when required i.e. after the user has submitted the form will always suffice, this will make the component that contains the form re-render only when required and we’ll have the UI and the values remain consistent.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*roQXU8chv0F8Z2MMWMD56Q.png" /><figcaption>`App` component</figcaption></figure><h4>Sandbox</h4><p>You can access the following sandbox that is developed following the said solution.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodesandbox.io%2Fembed%2Fglbf1&amp;display_name=CodeSandbox&amp;url=https%3A%2F%2Fcodesandbox.io%2Fs%2Fglbf1&amp;image=https%3A%2F%2Fcodesandbox.io%2Fapi%2Fv1%2Fsandboxes%2Fglbf1%2Fscreenshot.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codesandbox" width="1000" height="500" frameborder="0" scrolling="no"><a href="https://medium.com/media/1ea6bdb9defd5d95226754f00459afd1/href">https://medium.com/media/1ea6bdb9defd5d95226754f00459afd1/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c5cae53512f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ReactJS: Container/Presentation Pattern + Manage Countdowns Effectively]]></title>
            <link>https://arbaz5256.medium.com/reactjs-container-presentation-pattern-manage-countdowns-effectively-fdbb5ce383a2?source=rss-c157fa6f197f------2</link>
            <guid isPermaLink="false">https://medium.com/p/fdbb5ce383a2</guid>
            <category><![CDATA[container-presentation]]></category>
            <category><![CDATA[coding-patterns]]></category>
            <category><![CDATA[countdown]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[good-coding-practice]]></category>
            <dc:creator><![CDATA[Arbaz Ajaz]]></dc:creator>
            <pubDate>Tue, 22 Jun 2021 18:28:30 GMT</pubDate>
            <atom:updated>2021-06-23T01:49:48.972Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n5XzqIN0NN6tPhYoAifhFA.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@evieshaffer?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Evie S.</a> on <a href="https://unsplash.com/s/photos/pink-wallpaper?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><h3>Explanation</h3><p>Container/Presentation Pattern suggests containing the business logic inside the Container component whereas the Presentation components are used for rendering/displaying the results/outcome of the business logic.</p><h4>Scenario</h4><p>In the sandbox attached with this article, I have implemented a basic countdown app that when hits zero, calls a function. The business logic is implemented inside the Container component whereas the Presentation component is responsible for displaying how much time is left.</p><h4>How am I managing countdown in Container component</h4><p>Inside the Container component, I am using useRef to store the time left in realtime using Javascript’s setInterval which runs after every 500ms and checks if the time left is &lt;= 0s . If so, I am stopping the interval and calling the callback function I have written that unmounts the component after 1s when the time left goes to 0</p><h3>Explaining the Implementation/Sandbox</h3><p>Goto the following link to access the sandbox: <a href="https://codesandbox.io/s/github/arbaz52/container-presentation-pattern-react-with-effective-countdown-management/">https://codesandbox.io/s/github/arbaz52/container-presentation-pattern-react-with-effective-countdown-management/</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*poO3BVKQmpNMyUj2bHMFLQ.png" /><figcaption>Container Component with business logic</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y8h6IbnX1sfiHSkGhUB2cQ.png" /><figcaption>Presentation Component Re-rendering after 100ms to display updated time left.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sVwAVL4_jKZVUfAN0mfY_Q.png" /><figcaption>useForceUpdate Custom Hook that forces the component to rerender</figcaption></figure><h4>Live Demo of Implementation/Sandbox</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodesandbox.io%2Fembed%2Fv4gcx&amp;display_name=CodeSandbox&amp;url=https%3A%2F%2Fcodesandbox.io%2Fs%2Fv4gcx&amp;image=https%3A%2F%2Fcodesandbox.io%2Fapi%2Fv1%2Fsandboxes%2Fv4gcx%2Fscreenshot.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codesandbox" width="1000" height="500" frameborder="0" scrolling="no"><a href="https://medium.com/media/4a30a4e01ae1b51d744011f427af6fe4/href">https://medium.com/media/4a30a4e01ae1b51d744011f427af6fe4/href</a></iframe><h4>Motivation/Idea behind the article</h4><p><a href="https://github.com/arbaz52">Me</a> and the senior developer as well as my mentor <a href="https://github.com/taqimustafa">Taqi Mustafa</a> were having a discussion on what can be the best way of managing the countdown inside a Container/Presentation Pattern and he suggested the idea which I have implemented here.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fdbb5ce383a2" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>