<?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 Shuvam Kumar on Medium]]></title>
        <description><![CDATA[Stories by Shuvam Kumar on Medium]]></description>
        <link>https://medium.com/@shuvamk?source=rss-add96e76290a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*aG4GksfG-3M2z731jwuyMw.png</url>
            <title>Stories by Shuvam Kumar on Medium</title>
            <link>https://medium.com/@shuvamk?source=rss-add96e76290a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 06:30:25 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@shuvamk/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[The performance benefits of destructuring: how to write faster and more scalable JavaScript]]></title>
            <link>https://shuvamk.medium.com/the-performance-benefits-of-destructuring-how-to-write-faster-and-more-scalable-javascript-6e00cdfa0390?source=rss-add96e76290a------2</link>
            <guid isPermaLink="false">https://medium.com/p/6e00cdfa0390</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[react-performance]]></category>
            <dc:creator><![CDATA[Shuvam Kumar]]></dc:creator>
            <pubDate>Sun, 04 Dec 2022 16:07:18 GMT</pubDate>
            <atom:updated>2022-12-04T16:07:18.478Z</atom:updated>
            <content:encoded><![CDATA[<p>If you’re a JavaScript developer, you’ve probably heard of the concept of destructuring. But did you know that destructuring can have substantial performance benefits for your code? In this blog post, we will explore the performance benefits of destructuring and show you how to write faster and more scalable JavaScript using this powerful technique.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1RDGBOoVYGRLTqfX74eW1A.jpeg" /></figure><h3>What is destructuring?</h3><p>Before we dive into the performance benefits of destructuring, let’s first take a step back and explain what destructuring is. In short, destructuring is a syntax feature in JavaScript that allows you to extract values from arrays and objects and assign them to variables. This can be useful in various scenarios, such as extracting values from function arguments or extracting values from objects returned by functions or methods.</p><p>For example, consider the following code that extracts values from an array and assigns them to variables:</p><pre>const arr = [1, 2, 3, 4, 5];<br><br>const a = arr[0];<br>const b = arr[1];<br>const c = arr[2];<br>const d = arr[3];<br>const e = arr[4];<br><br>console.log(a); // 1<br>console.log(b); // 2<br>console.log(c); // 3<br>console.log(d); // 4<br>console.log(e); // 5</pre><p>This code works, but it’s a bit verbose and repetitive. With destructuring, you can rewrite this code as follows:</p><pre>const arr = [1, 2, 3, 4, 5];<br><br>const [a, b, c, d, e] = arr;<br><br>console.log(a); // 1<br>console.log(b); // 2<br>console.log(c); // 3<br>console.log(d); // 4<br>console.log(e); // 5</pre><p>As you can see, this code is much shorter and more readable. The destructuring syntax allows you to extract the values from the arr array and assign them to the a, b, c, d, and e variables in a single line of code.</p><h3>The performance benefits of destructuring</h3><p>Now that you know what destructuring is, let’s talk about the performance benefits of using it in your JavaScript code. In general, destructuring can improve the performance of your code by reducing the amount of memory allocated and the number of function calls made.</p><p>For example, consider the following code that uses destructuring to extract values from an array:</p><pre>const arr = [1, 2, 3, 4, 5];<br>const [a, b, c, d, e] = arr;</pre><p>This code uses destructuring to extract the values from the arr array and assign them to the a, b, c, d, and e variables. This is faster and more efficient than the equivalent code that doesn&#39;t use destructuring because it reduces the amount of memory allocated and the number of function calls made.</p><p>Here’s how this code would look without destructuring:</p><pre>const arr = [1, 2, 3, 4, 5];<br>const a = arr[0];<br>const b = arr[1];<br>const c = arr[2];<br>const d = arr[3];<br>const e = arr[4];</pre><p>As you can see, this code is longer and more repetitive than the code that uses destructuring. It also requires more memory allocation and more function calls, which can impact performance.</p><h3>Example: optimizing a filter function</h3><p>To see the performance benefits of destructuring in action, let’s consider an example where we use destructuring to optimize a filter function.</p><p>Suppose we have the following filter function, which takes in an array and a callback function, and returns a new array that contains only the elements that pass the callback function:</p><pre>function filter(arr, cb) {<br>  const result = [];<br>  for (let i = 0; i &lt; arr.length; i++) {<br>    if (cb(arr[i])) {<br>      result.push(arr[i]);<br>    }<br>  }<br>  return result;<br>}</pre><p>This function works, but it can be slow and inefficient when dealing with large arrays. To optimize this function, we can use destructuring to reduce the amount of memory allocated and the number of function calls made.</p><p>Here’s how we can use destructuring to optimize the filter function:</p><pre>function filter(arr, cb) {<br>  const result = [];<br>  for (const [index, value] of arr.entries()) {<br>    if (cb(value)) {<br>      result.push(value);<br>    }<br>  }<br>  return result;<br>}</pre><p>As you can see, this code uses destructuring to extract the index and value from each element of the arr array. This allows us to avoid calling the arr[i] expression in each iteration of the loop, which reduces the number of function calls made and improves the performance of the filter function.</p><h3>Conclusion</h3><p>In this blog post, we’ve explored the performance benefits of using destructuring in your JavaScript code. We’ve seen how destructuring can reduce the amount of memory allocated and the number of function calls made, which can improve the performance of your code. We’ve also looked at an example of how to use destructuring to optimize a filter function.</p><p>Overall, destructuring is a powerful and useful tool for writing faster and more scalable JavaScript code. Whether you’re working with arrays, objects, or function arguments, destructuring can help you write cleaner and more efficient code. So why not give destructuring a try, and see how it can improve the performance of your JavaScript applications?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6e00cdfa0390" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React Portals: the ultimate solution for complex and dynamic UI components]]></title>
            <link>https://shuvamk.medium.com/react-portals-the-ultimate-solution-for-complex-and-dynamic-ui-components-eac81fb85549?source=rss-add96e76290a------2</link>
            <guid isPermaLink="false">https://medium.com/p/eac81fb85549</guid>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react-portal]]></category>
            <dc:creator><![CDATA[Shuvam Kumar]]></dc:creator>
            <pubDate>Sun, 04 Dec 2022 15:56:35 GMT</pubDate>
            <atom:updated>2022-12-04T15:56:35.614Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HSVdgQrYXiqfLL7wMcNQQg.jpeg" /></figure><p>React Portals are a powerful and versatile tool for building complex and dynamic user interfaces in React applications. They allow you to render your React components anywhere on the page, outside of their parent component’s DOM tree. This can be useful in a variety of scenarios, such as rendering modal windows, dropdown menus, and tooltips, or integrating third-party libraries that require access to the DOM.</p><p>Using React Portals, you can easily integrate your components into any part of the page, without worrying about conflicts or inconsistencies with the parent component’s styles or layout. This not only simplifies the development process, but also makes your code more maintainable and scalable in the long run.</p><p>To create a React Portal, you can use the createPortal method, which is part of the ReactDOM package. This method takes in two arguments: the React element to be rendered, and the DOM element where the element should be rendered. For example, you could use the following code to create a portal that renders a modal window in the &lt;body&gt; element:</p><pre>const modal = (<br>  &lt;div className=&quot;modal&quot;&gt;<br>    &lt;h1&gt;This is a modal window&lt;/h1&gt;<br>  &lt;/div&gt;<br>);<br><br>const portal = ReactDOM.createPortal(modal, document.body);</pre><p>Once you have created a portal, you can render it like any other React component. For example, you could use it in a parent component like this:</p><pre>function App() {<br>  return (<br>    &lt;div&gt;<br>      &lt;h1&gt;My React App&lt;/h1&gt;<br>      {portal}<br>    &lt;/div&gt;<br>  );<br>}</pre><p>In this example, the App component renders a h1 element with the text &quot;My React App&quot;, followed by the portal element that was created earlier. This will cause the modal window to be rendered in the &lt;body&gt; element, outside of the App component&#39;s DOM tree.</p><p>One of the key benefits of using React Portals is that they allow you to manage the lifecycle of your components independently from their parent components. This means that you can use the same component in multiple portals, without worrying about conflicts or inconsistencies. For example, you could use the same modal window component in different parts of your app, and each instance of the component will be rendered and managed independently.</p><p>In addition to this, React Portals also provide a seamless and intuitive way to integrate third-party libraries that require access to the DOM. For example, you could use a portal to integrate a charting library like D3 or Highcharts, or a map library like Google Maps or Leaflet. This allows you to easily add complex and interactive features to your app, without having to deal with the challenges of integrating the library directly into your React components.</p><p>In conclusion, React Portals are a powerful and versatile tool for building complex and dynamic user interfaces in React applications. They allow you to render your components anywhere on the page, manage their lifecycle independently from their parent components, and integrate third-party libraries that require access to the DOM. With React Portals, you can maximize the performance and flexibility of your React app, and deliver a seamless and engaging user experience.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eac81fb85549" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unlock the Power of React Suspense: Get Ready to Enhance Your User Experience!]]></title>
            <link>https://shuvamk.medium.com/unlock-the-power-of-react-suspense-get-ready-to-enhance-your-user-experience-afbfe172f4e0?source=rss-add96e76290a------2</link>
            <guid isPermaLink="false">https://medium.com/p/afbfe172f4e0</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[hooks]]></category>
            <category><![CDATA[react-hook]]></category>
            <dc:creator><![CDATA[Shuvam Kumar]]></dc:creator>
            <pubDate>Sat, 03 Dec 2022 17:46:30 GMT</pubDate>
            <atom:updated>2022-12-03T17:46:30.995Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/556/1*aEwH4GsajQx3ZaoG1hoalg.png" /></figure><p>React Suspense is a new feature in React that allows components to “suspend” rendering until something else has loaded. This is especially useful for loading asynchronous data, such as images or data from an API. Suspense can also be used for fallback loading states, such as a loading spinner.</p><pre>import React, { Suspense } from &quot;react&quot;;<br>const Image = React.lazy(() =&gt; import(&quot;./Image&quot;));<br>const App = () =&gt; {<br>  return (<br>    &lt;div&gt;<br>      &lt;Suspense fallback={&lt;div&gt;Loading…&lt;/div&gt;}&gt;<br>        &lt;Image src=&quot;image.jpg&quot; alt=&quot;example image&quot; /&gt;{&quot; &quot;}<br>      &lt;/Suspense&gt;{&quot; &quot;}<br>    &lt;/div&gt;<br>  );<br>};<br>export default App;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/556/1*aEwH4GsajQx3ZaoG1hoalg.png" /></figure><p>In this example, the Image component is being loaded using React.lazy(). This tells React that the component should be loaded asynchronously, and React Suspense will handle the loading state. The fallback prop is used to display a loading spinner or other content while the component is being loaded. Once the component is ready, it will be rendered in place of the fallback.</p><h3>How exactly user-experience is enhanced 🤔?</h3><p>React Suspense allows developers to create components that can suspend rendering while they load data. This can improve user experience by allowing users to continue interacting with the application while data is being fetched, rather than having to wait for all data to be loaded before they can do anything.</p><p>For example, imagine a social media app that displays a feed of posts. Without React Suspense, the user would have to wait for all of the posts to be loaded before they could start scrolling or interacting with the feed. With React Suspense, the user could start scrolling and interacting with the feed immediately, and the posts would be loaded as they are needed. This would provide a much smoother and more responsive user experience.</p><p>Additionally, React Suspense allows developers to show a loading indicator or placeholder content while data is being fetched, rather than displaying nothing at all. This can make the application feel more responsive and provide the user with feedback about what is happening.</p><h3>Is there any disadvantage to using React Suspense?</h3><p>React Suspense is a relatively new feature, and it is still being developed and refined. As such, it may not be as stable or well-supported as other parts of the React ecosystem.</p><p>Additionally, using React Suspense effectively requires a different approach to data fetching and rendering than traditional techniques. This may require developers to learn new concepts and practices, which could be a disadvantage if they are already familiar with other approaches.</p><p>Furthermore, React Suspense only works with asynchronous data fetching, and it relies on throwing and catching promises to suspend and resume rendering. This can add complexity to the code and make it more difficult to debug and maintain.</p><p>Overall, the disadvantages of React Suspense largely stem from its novelty and the fact that it requires a different approach to data fetching and rendering. However, as the feature continues to evolve and improve, these disadvantages may become less significant.</p><h3>A practical and fun implementation of React Suspense:</h3><p>One fun example of using React Suspense could be to create a virtual pet that the user can interact with. The pet could be a simple 2D character that the user can feed, play with, and take care of.</p><p>Here’s how the application could be implemented using React Suspense:</p><pre>import React, { Suspense } from &#39;react&#39;;<br><br>const Pet = () =&gt; {<br>  // Declare state variables for the pet&#39;s hunger, happiness, and image<br>  const [hunger, setHunger] = useState(50);<br>  const [happiness, setHappiness] = useState(50);<br>  const [image, setImage] = useState(null);<br><br>  // Use the useEffect hook to load the pet&#39;s image<br>  useEffect(() =&gt; {<br>    // Start an asynchronous operation to load the pet&#39;s image<br>    const loadImage = async () =&gt; {<br>      const response = await fetch(&#39;https://my-api.com/pet-image.png&#39;);<br>      const imageData = await response.blob();<br>      setImage(URL.createObjectURL(imageData));<br>    };<br><br>    // Start loading the image<br>    loadImage();<br>  }, []);<br><br>  // If the pet&#39;s image hasn&#39;t been loaded yet, suspend rendering<br>  if (!image) throw new Promise(() =&gt; {});<br><br>  // Return the pet&#39;s image and buttons for interacting with the pet<br>  return (<br>    &lt;div&gt;<br>      &lt;img src={image} alt=&quot;Pet&quot; /&gt;<br>      &lt;p&gt;Hunger: {hunger}&lt;/p&gt;<br>      &lt;p&gt;Happiness: {happiness}&lt;/p&gt;<br>      &lt;button onClick={() =&gt; setHunger(hunger - 10)}&gt;Feed&lt;/button&gt;<br>      &lt;button onClick={() =&gt; setHappiness(happiness + 10)}&gt;Play&lt;/button&gt;<br>    &lt;/div&gt;<br>  );<br>};<br><br>const App = () =&gt; (<br>  &lt;Suspense fallback={&lt;div&gt;Loading pet...&lt;/div&gt;}&gt;<br>    &lt;Pet /&gt;<br>  &lt;/Suspense&gt;<br>);</pre><p>In this example, the Pet component loads its image using the useEffect hook. While the image is being loaded, the Pet component suspends rendering by throwing a promise. The parent Suspense component catches the promise and renders a loading indicator instead. Once the image has been loaded, the Pet component resumes rendering and displays the image, along with buttons for interacting with the pet.</p><p>This example demonstrates how React Suspense can be used to create a more engaging and responsive user experience, by allowing the user to interact with the virtual pet while its image is being loaded.</p><p>Overall, React Suspense is a promising addition to the React ecosystem, and it has the potential to greatly enhance the user experience of applications that make use of it. As the feature continues to evolve and improve, it will be interesting to see how it is adopted and used by developers.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=afbfe172f4e0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why exactly do we need a Virtual DOM?]]></title>
            <link>https://shuvamk.medium.com/why-exactly-do-we-need-a-virtual-dom-7e6821d2b17d?source=rss-add96e76290a------2</link>
            <guid isPermaLink="false">https://medium.com/p/7e6821d2b17d</guid>
            <category><![CDATA[virtual-dom]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[react-interview]]></category>
            <dc:creator><![CDATA[Shuvam Kumar]]></dc:creator>
            <pubDate>Sat, 14 Aug 2021 20:04:40 GMT</pubDate>
            <atom:updated>2021-08-14T20:05:39.864Z</atom:updated>
            <content:encoded><![CDATA[<p><em>NOTE: Watch the Youtube video here : </em><a href="https://youtu.be/zEuO9cyc4RE">https://youtu.be/zEuO9cyc4RE</a></p><p>Before getting into Virtual Dom you should be clear with DOM (Document object model), and in order to understand it clearly, we’re going to understand the following and then jump to Virtual DOM.</p><ul><li>Browser Structure</li><li>Rendering Engine</li><li>Critical Rendering Path</li><li>Why not just DOM?</li></ul><h4><strong>Browser Structure</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SxmPYZMJ7K72CTcO1yk0HA.jpeg" /><figcaption>Photo by Overreacted Youtube Channel</figcaption></figure><ul><li><strong>User Interface: </strong>Everything that you interact with is the user interface component, the address bar, the bookmark button, the forward-backward button, etc.</li><li><strong>Browser Engine: </strong>This is the link between Rendering Engine and the UI component, it acts as a bridge for all actions between these two.</li><li><strong>Rendering Engine: </strong>This is the elephant in the room, our primary focus here. This component is solely responsible for parsing requested HTML, XML, etc., creating the layout, and finally painting it on the screen. We will come back to this in a moment.</li><li><strong>Networking: </strong>This is responsible for all those network requests that your browser sends through various protocols such as HTTP, FTP, etc. It is also a watchman for security-related issues with internet communication.</li><li><strong>Javascript Interpreter: </strong>Name says it all, this interprets the JS code. JS code is parsed and executed here and then it is transferred to the render engine. (Also JS is a compiled language or is it an interpreted language? Scratch your head )</li><li><strong>UI Backend: </strong>This is a platform-independent component that uses the operating system user interface, mainly used for drawing combo boxes and windows.</li><li><strong>Data Persistence: </strong>All those cookies, tokens that you store are handled by this persistence layer.</li></ul><h4>Now let’s bring our render engine back:</h4><p>Let’s say you requested an <em>index.html</em> file in your browser, now a series of events will happen in the render engine, firstly the engine here will start fetching the contents for index.html, and here the networking layer will help. The engine will receive contents in chunks of 8KBs and once it is fetched the basic flow begins:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DoQ51s2vvEMNJPYA7Hb9Dw.jpeg" /><figcaption>Photo by Overreacted Youtube Channel</figcaption></figure><ul><li>The HTML is parsed and tokens are created, these tokens contain the information of HTML tags and have their own set of rules, these are then created into Objects which act as NODES in the DOM Tree, and hence DOM is created. Here the DOM is containing all the content on the page, what about the style then? Well, for style in a similar manner a CSS Object Model is created also called CSSOM and it contains nodes with all the styles for the page.</li><li>Till now we have both styles and content, we just have to stitch them together. For this, we have another tree (yes one more:\ ) and for that, we move to the second step of the render engine.</li><li>A render tree is created by combining DOM and CSSOM. To do this browser starts from the root of the DOM tree and for every node determines which rules are to be applied. Interestingly it only captures the visible content so if CSS is “display: none” for some HTML object it is ignored and therefore the head section of HTML (in most cases) is not included in the render tree. Now we have styles for each DOM node what next?</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rMGpQiU160D0_gidvOz0hw.jpeg" /><figcaption>Photo by Overreacted Youtube Channel</figcaption></figure><ul><li>Then the render engine calculates the exact position and size for each node of the render tree. Imagine your screen to be a graph and in the “Layout Process” the render engine assigns coordinates to the nodes. This ensures that every content is shown at an accurate position on the screen. Finally, once the size and position are calculated render engines move to the last step.</li><li>To paint the render tree, the engine traverses the tree and invokes the rendering engine’s paint() method to paint every node on the screen and hence we get our document index.html on our screen.</li></ul><p>So the path followed here by rendering engine in four steps is known as <strong>Critical Rendering Path</strong>, there are ways to increase the efficiency and speed of this path but this too has limitations.</p><h4>Finally, before going to the Virtual DOM question is where DOM fails?</h4><h3>Finally, before going to the Virtual DOM question is where DOM fails?</h3><p>Many developers say that DOM fails because updating DOM is slow and inefficient, well truth be spoken it is not the manipulation that takes time it is the rendering process that happens after every update which makes the DOM Manipulation slower. I just explained what happens in the render engine, you get my point, right?</p><p>But then even in React, we manipulate the DOM, we change the states and everything does that mean React is changing the rendering process? NO</p><p>The rendering process is still the same, React helps in reducing the number of times we change our DOM and hence reduces the number of times we have to render the document.</p><p>Let us say we have a list of 3 List Items in our document:</p><pre>let items=[&quot;pikachu&quot;,&quot;squirtle&quot;,&quot;ratata&quot;]</pre><p>and we decided to change one of the items here:</p><pre>items=[&quot;pikachu&quot;,&quot;squirtle&quot;,&quot;charizard&quot;]</pre><p>even for this one change, the whole list will be re-created and the document will update, one such operation is fine. Imagine thousands and millions of such manipulations in the DOM and for each manipulation rendering the UI by critical rendering path, this is what makes it slower to update the UI for the user.</p><h4>Now let us introduce Virtual DOM:</h4><p>According to React docs,</p><blockquote><em>The virtual DOM (VDOM) is a programming concept where an ideal, or “virtual”, representation of a UI is kept in memory and synced with the “real” DOM by a library such as ReactDOM</em></blockquote><p>Notice that the virtual DOM is never rendered by the browser it is always kept in the memory. The virtual DOM is like a blueprint of the actual DOM and helps in making React faster. How exactly does this work?</p><ul><li>In React we have React elements, remember React.createElement?</li><li>When we render() our React component for the first time these React Elements of JSX are used to create DOM and simultaneously a virtual DOM is also created.</li><li>Imaging we made certain changes and called the render() method again, now unlike DOM which blindly manipulates, React is smart it goes into reconciliation and the magic happens here.</li><li>Right before updating the change in its virtual DOM React takes a snapshot of it and calls it previous Virtual DOM and updates the current Virtual DOM. At this point, we have two Virtual DOMs previous and current. React compares both of these using its “Diffing Algorithm” which picks only those nodes which are changed and then calculates the minimum number of steps required in order to make those changes in the actual DOM.</li><li>In our above example only items[2] was changed so it picks that node, now imagine there are hundreds of such changes, and by comparing the two virtual DOMs React calculates the minimum number of steps to make all the changes and it then creates a batch.</li><li>This batch of all the steps is executed by the event loop in one go and hence the actual DOM is patched only once. So here React reduced the number of rendering UI. Since an entire batch is updated to actual DOM in one go, if in between something else is changed it has to go in another batch once the event loop is free and this cycle continues.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q-Hx8D5aDkgwoNEFo6YCVA.jpeg" /><figcaption>Photo by Overreacted Youtube Channel</figcaption></figure><p>There are some generic solutions to this algorithmic problem of generating the minimum number of operations to transform one tree into another. However, even the <a href="https://grfia.dlsi.ua.es/ml/algorithms/references/editsurvey_bille.pdf">state-of-the-art algorithms</a> have a complexity in the order of O(n3) where n is the number of elements in the tree.</p><p>If we used this in React, displaying 1000 elements would require in the order of one billion comparisons. This is far too expensive. Instead, React implements a heuristic O(n) algorithm based on two assumptions:</p><ol><li>Two elements of different types will produce different trees.</li><li>The developer can hint at which child elements may be stable across different renders with a key prop.</li><li>You must have seen those key attribute warnings in the console while creating React Apps, now you know why :)</li></ol><p>This was all about VIRTUAL DOM and why we use this in React and other such SPAs.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7e6821d2b17d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why reading books is overrated today?]]></title>
            <link>https://shuvamk.medium.com/why-reading-books-is-overrated-today-2659ded960d8?source=rss-add96e76290a------2</link>
            <guid isPermaLink="false">https://medium.com/p/2659ded960d8</guid>
            <category><![CDATA[readers]]></category>
            <category><![CDATA[reading-habits]]></category>
            <category><![CDATA[books]]></category>
            <category><![CDATA[bookworm]]></category>
            <category><![CDATA[bibliophile]]></category>
            <dc:creator><![CDATA[Shuvam Kumar]]></dc:creator>
            <pubDate>Mon, 16 Nov 2020 14:25:32 GMT</pubDate>
            <atom:updated>2020-11-16T14:25:32.208Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*01WUDbitdFpOGCOaYFY71A.png" /></figure><p>Before you judge me for this unconventional statement I must tell you that I am a bookworm myself and I personally love reading books. Growing up we all have been told to develop a habit of reading books, which is really good for a number of reasons but there’s a lot of history behind it. Book readers generally think of themselves as an alpha human just because they have this habit of completing a book overnight. If you’ve been ever judged by a bibliophile for not reading books then you’re at the right place, because I too believe “Reading Books Is Overrated Today”. Let’s take a look WHY?</p><p><strong><em>History:</em></strong> Looking back at history when sources of entertainment were limited when there was no Netflix or YouTube that’s when people started reading printed books. We all love stories, stories from our grandmother, stories from our friends over tea, and literally story in any form. Today people get enough stories from OTT Platforms, from Social Media that there’s no need to get stories from books anymore. Books are a medium of thought, and the medium changed with technology. Today when I can get the same amount of knowledge from a 30 minutes podcast why should I read a 500 Page book?</p><p>Someone might flex saying he/she was awake all night reading a book, the book might be a fictional novel of 400 Pages and they were literally just watching a show in their mind while reading the book, I believe they’re no different than a millennial who binge-watched a show overnight.</p><p>If you’ll ask your teacher why we should read books, they might say it increases your vocabulary, it increases your knowledge, etc. The point is if you are watching a movie adaptation of the same book, or listening to an audiobook, here also your vocabulary is increasing and at the same time, you’re learning the correct pronunciation of the word.</p><p>Today the most popular books apart from religious books are either Harry Potter, the work of Sir Arthur Conan Doyle in the form of Sherlock Holmes, Books of Dan Brown, Agatha Christie, etc. People spend hours and hours reading these books which is perfectly fine but then they force others to read as well. WHY? The same story is adapted into a movie with excellent acting and it takes so much less time to watch it. Reading books was a flex once, same as collecting stamps but today the world has changed and the “Bookworms” are too stubborn to adapt to this change.</p><p>There are counterpoints to my statements and these are just my thoughts <em>(although completely correct)</em>. To be honest I have never met a reader who recommended me a textbook or some reference book they always recommend some fictional novel and that’s the same as my friend recommending a web series to binge-watch. I like both.😁</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*01WUDbitdFpOGCOaYFY71A.png" /></figure><p>So, next time when someone is flexing their ability to finish a book overnight just ask WHY?😁</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2659ded960d8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why did we fail in the first launch of our app?]]></title>
            <link>https://shuvamk.medium.com/why-did-we-fail-in-the-first-launch-of-our-app-32debda1fcc7?source=rss-add96e76290a------2</link>
            <guid isPermaLink="false">https://medium.com/p/32debda1fcc7</guid>
            <category><![CDATA[ebooks-online]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[app-development]]></category>
            <category><![CDATA[play-store]]></category>
            <dc:creator><![CDATA[Shuvam Kumar]]></dc:creator>
            <pubDate>Thu, 12 Nov 2020 09:29:29 GMT</pubDate>
            <atom:updated>2020-11-12T09:29:29.962Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ep0fBC_19HRZfMnWY9_gNA.png" /></figure><p>When we open the Google Play Store we are overwhelmed with the number of apps we see there, for literally every basic need there are hundreds of apps. Statistically, there are nearly 3 Million android apps on the Play Store as of now. At the beginning of this year, we<em>(me and my team)</em> decided to publish our own app on the play store. What once was an Instagram Page and a website to deliver Free Ebooks upon request was about to be launched as an App, we were all thrilled with the thought.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fAj8hmnTyCHPGEq80_MJlg.png" /></figure><p>After months of planning, procrastination, and surviving a pandemic we somehow managed to publish our app on the Play Store. But we failed terribly, and there are a number of reasons for that which you should avoid if you’re looking forward to doing the same. Keep on reading 😁</p><ol><li><strong>Multiple rejections from Google Play Store:</strong> While we were pretty sure our app is in compliance with the developer policies of uploading apps, we were wrong and there were huge mistakes on our part. Just because of a payment QR code in the app, and copyright issues we had to wait for more than a month just to get approval from Play Store. This badly affected the timing and overall enthusiasm. <em>Pro tip: There are workarounds for everything, use Jugaad 😉</em></li><li><strong>Lack of remote coordination:</strong> We were used to working together sitting in a hostel room late at night, this pandemic came as a surprise and we were not ready for it like the rest of you all. It was difficult to manage remote communication while this whole development phase was going on, with a lot on the plate we were distracted from time to time and there were unnecessary delays. <em>A team needs to be together at-least in the beginning.</em></li><li><strong>We were not aware of Firebase payment policy:</strong> In order to upload a large number of books and for readers to download it, we needed to upgrade from the free plan of the firebase. Unfortunately, it wasn’t easy. Google Firebase doesn’t accept Indian Credit Cards and there’s no prepaid credit option. Due to this, we had to shift our complete backend and it was a nightmare. It consumed a lot of time which jeopardized our timeline.</li><li><strong>No reference documentation in the beginning:</strong> It is known that an idea evolves as you start developing it, but you need to plan the basics in the beginning. Which all languages you’re going to use, how the flow will work and etc. Although we had all this in mind it wasn’t documented, make sure you write those flows and tech stack for reference in the future, things can get messy later on. Research on the technologies you’re going to use, their scalability, the economical factors of implementation, etc. <em>After all, prevention is better than cure.</em></li><li><strong>You will only sell if you do the marketing well:</strong> While we were estimating 4 figure downloads in the beginning we hardly reached 1000 downloads and to be honest, it isn’t a very motivating figure. We overestimated our target and were not up to the mark in terms of Marketing. A strategy needs to be made in the beginning, a roadmap with milestones is more achievable.</li></ol><p>So, these were the major factors where we failed with our “Million Download Idea” it is still a ‘Million Download Idea’ and we are working on it. The next version will come with a bang and hopefully, all the above mistakes will be avoided. The idea has grown a lot and the team has evolved as well. I hope you enjoyed reading this 😁. If you want to check out our app, it’s on the Play Store: <a href="https://play.google.com/store/apps/details?id=com.ebooq.ebooq">“Ebooq: Millions of free books to read and share”</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ox6rmEGeqHhZH_aIBBMIRQ.png" /></figure><p>Make sure you don’t repeat the same mistakes and till then keep reading, keep learning.❤️</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=32debda1fcc7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Beginner’s Guide to Candlestick Charts: How and Why?]]></title>
            <link>https://shuvamk.medium.com/beginners-guide-to-candlestick-charts-how-and-why-8c61e1d1bce7?source=rss-add96e76290a------2</link>
            <guid isPermaLink="false">https://medium.com/p/8c61e1d1bce7</guid>
            <category><![CDATA[stock-market]]></category>
            <category><![CDATA[candlesticks]]></category>
            <category><![CDATA[trading]]></category>
            <category><![CDATA[technical-analysis]]></category>
            <category><![CDATA[share-market-training]]></category>
            <dc:creator><![CDATA[Shuvam Kumar]]></dc:creator>
            <pubDate>Fri, 06 Nov 2020 08:22:09 GMT</pubDate>
            <atom:updated>2020-11-06T08:22:09.986Z</atom:updated>
            <content:encoded><![CDATA[<p>If you’ve ever searched “Stock Market” on Google or if you’ve ever seen someone watching the share prices on a laptop you must’ve seen those fancy charts consisting of Red and Green candles, it’s the Candlestick chart. In this blog, I’ll be covering why we use Candlesticks and how to interpret those candles. Keep Reading 😁</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C3WzEEdmQv03q2x24OKoLA.png" /></figure><p><strong><em>History: </em></strong>The use of Candles to represent price movements was started in Japan years ago. Candlesticks were first used to represent the price of rice in the market, then when traders found this very convenient way of representing price of goods they started implementing the same in almost all trades and eventually in the stock market.</p><p><strong>Why Candlesticks?</strong> To understand why we use Candlesticks you must know how the stock market actually works. So, a person holding a particular share <em>let’s say x</em> places an order to sell it for a price of <em>let’s say “y” </em>and at the same time there’s another person who places an order for the same “x” share for exact same price “y” then it’s a match and the shares are transferred from one Demat account to another, all this happens in seconds. So in a busy exchange such as NSE/BSE millions of such transactions take place every day and it’s impossible to keep track of the price of a share because it keeps on changing after every transaction.</p><p>To overcome this problem we use Candlesticks. So basically, there are 3 parts to a candlestick: <strong>1) Real Body 2) Upper Shadow 3) Lower Shadow</strong> <em>(note: a shadow is also called a wick, both are same here).</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/288/1*UaGOINppi5t_BJxwBLFW8g.png" /></figure><p>As you can see, A candlestick represents 4 things: <strong>1) Open 2) High 3) Low and 4) Close </strong><em>(</em>T<em>hese 4 are also called OHLC)</em>. We’ll see all these in detail.</p><p>Before starting you should know what is Timeframe: <em>When you’re watching candlesticks on a software/website you have the freedom to change the timeframe from 1 minute to 5 Years depending on the software.</em></p><p><em>For better illustration, we’ll take the example of Reliance Company and time frame of 1 day (9:15 AM to 3:30 PM).</em></p><ol><li>Open: Open or better called Open Price is the price at which trading starts in a given timeframe. Suppose shares of Reliance started trading at Rs.1985 at 9:15 AM (<em>start of the trading session</em>) then the Open for the candlestick will be 1985.</li><li>High: It is the topmost point of a candlestick. Suppose throughout the day, the maximum price for Reliance Share went to Rs. 2022 (<em>this means that a transaction took place at Rs. 2022 when both seller and buyer placed an order for the same amount</em>) then the High or High Price of the Candlestick will be 2022.</li><li>Low: It is the lowest point of a Candlestick. Similar to High Price, suppose the lowest price at which Reliance Share was traded is Rs.1976 then the Low will be 1976.</li><li>Close: This is the price at which the last transaction took place during our timeframe i.e at 3:30 PM, suppose the last trading was at Rs.1999 then the Close of Candlestick will be 1999.</li></ol><p>I guess by now everything about a candlestick is clear and you can make your own candlestick from the data in this example. Let’s now look at 2 types of candlesticks:</p><ol><li>Bullish Candlestick: If the Close is higher than Open then it is called a Bullish Candlestick. It is generally represented in Green Color (it can be changed based on software). It shows that price of shares is increased.</li><li>Bearish Candlestick: If the Close is lower than the Open then it is called a Bearish Candlestick. It is generally represented in Red Color. It shows that price of shares is decreased.</li></ol><p>Now explaining the 3 parts of Candlestick:</p><p><strong>Real Body:</strong> The real body is the difference between Open and Close. The size of the body will vary with the difference between open and close price.</p><p><strong>Lower and Upper Shadow:</strong> If it’s a Bullish Candle then the difference between Close and High is Upper Shadow while the difference between Open and Low is Lower Shadow and vice-versa in the case of a Bearish Candle.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-GCXWZf_erhBxVSjDGJIGw.png" /></figure><p>So, these are the basics of Candlestick Charts I hope you’ll be able to read them now. Candlesticks form the base for technical analysis and trading patterns which I’ll cover in coming blogs. Candlestick patterns help in predicting the price of a share and it’s really an interesting topic.</p><p>Till then keep exploring and Keep Investing 👍</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8c61e1d1bce7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Most basic things you should know before entering the Stock Market.]]></title>
            <link>https://shuvamk.medium.com/most-basic-things-you-should-know-before-entering-the-stock-market-344f5fb24598?source=rss-add96e76290a------2</link>
            <guid isPermaLink="false">https://medium.com/p/344f5fb24598</guid>
            <category><![CDATA[stock-market]]></category>
            <category><![CDATA[trading]]></category>
            <category><![CDATA[sensex]]></category>
            <category><![CDATA[nifty]]></category>
            <category><![CDATA[demat-account]]></category>
            <dc:creator><![CDATA[Shuvam Kumar]]></dc:creator>
            <pubDate>Wed, 04 Nov 2020 01:04:35 GMT</pubDate>
            <atom:updated>2020-11-04T01:04:35.517Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dk4XsujCntvFfZrH4AIdpA.png" /></figure><p>After watching <strong><em>Scam 1992: The Harshad Mehta Story </em></strong>there is a sudden urge in all of us to explore the Indian stock market, to get our hands dirty in stocks and shares, but life is not a movie and you are not the next Harshad Mehta (wink). If you want to take a deep dive into the Indian Stock Market and don’t know where to start, this is the right blog for you, keep reading.😄</p><ol><li><strong>Demat Account: </strong>Demat Account is just like your bank account but instead of depositing and withdrawing money here you buy and sell shares. You need to get a Demat Account from a registered broker such as Zerodha, Upstox, or OnePaisa Capital. Some of them are free while some charge an account opening fee, and each of them provides various features on their platform. Opening a Demat Account is quite simple, all you need is Mobile Linked Aadhar Card, PAN card, and you must be older than 18 years.</li><li><strong>NSE/BSE: </strong>NSE stands for National Stock Exchange and BSE stands for Bombay Stock Exchange. All the public companies that you see and hear about are either listed on BSE or NSE or both. These are like a shop where you can trade(buy/sell) shares of a public company. Although NSE is quite new as compared to BSE still it’s everyone’s favorite, the huge volume of trading makes it easy for price discovery on NSE. (You don’t have to know much about NSE and BSE, just know that they exist 😅)</li><li><strong>Market Time: </strong>Every exchange in the world has a fixed time for trading. In India, the trading starts at 9:15 AM (<em>remember Harshad Mehta’s bell?</em>)and closes at 3:30 PM. That doesn’t mean you can’t place an order out of this time bracket, you can place an order (through your broker’s website/app) at any time but it’ll only be executed when the market will open. The time between 9:15 AM and 3:30 PM is known as a trading session when millions of shares are bought and sold. <em>Interesting fact: In India, only once trading is done from 6:15 PM to 7:15 PM that is on Diwali and this session is known as </em><strong><em>Muhurat Trading</em></strong><em>.</em></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H8krlZUSO-akkygcOG_LtQ.png" /></figure><p>4. <strong>Placing an order and SL: </strong>Buying a share is very easy once you have a Demat account, just deposit money through UPI, Card, Bank Transfer and place a buy order, it’s as simple as buying something on Amazon. But with more power comes more responsibility, buying a share is very easy but you must know when to exit the position. (<em>Taking a position in the stock market means either buying or selling a share, if you’re buying and thinking of selling in the future you’re taking a </em><strong><em>long position, </em></strong><em>and if you’re selling first with an aim of buying later at a low price then you’re taking a </em><strong><em>short position.</em></strong><em>) </em>SL stands for Stop-Loss and a stop loss saves you from unwanted risk. Remember <strong><em>Risk hai toh ishq hai </em></strong>but take risk according to your appetite.</p><p>5.<strong>Charges and Brokerage Fee: </strong>Although all the brokers advertise themselves as “<em>Zero Charge Brokerage” </em>but that doesn’t mean buying and selling shares are free of cost. There are many hidden charges such as DP Charges, GST, etc. that you should be aware of before taking any trade. I recommend using a <a href="https://zerodha.com/brokerage-calculator#tab-equities">brokerage calculator</a> to calculate how much you’ll be paying beforehand. We all like surprises but not these ones 😁.</p><p>6. <strong>Stay away from Telegram channels: </strong>This is my most important advice to everyone new who’s reading this, there are thousands of channels on Telegram and other social media who might lure you with screenshots showing lakhs of profit, but you should never join and take tips from them. In the long run, if you’re taking advice from some stranger you’ll end up blowing your bank account (<em>then you’ll call stock trading gambling </em>😢). Always do your own research (fundamental and technical both) before buying any share.</p><p>So these were the most basic things you should know before entering the stock market. Stock Trading is a very vast topic and can’t be covered in one blog. I’ll be writing soon explaining other jargon of the trading, keep buying keep selling. 😄</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bgK5HxOaCOIvmbNkWEYBEQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=344f5fb24598" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>