<?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"><channel><title><![CDATA[Pranav Goswami's Blog]]></title><description><![CDATA[Pranav Goswami is a Full Stack Software Engineer who loves keeping up with the latest industry trends, continually refining his skills, and generously sharing h]]></description><link>https://pranavgoswami.hashnode.dev</link><image><url>https://cdn.hashnode.com/res/hashnode/image/upload/v1698075303346/CQ_wrwavM.svg</url><title>Pranav Goswami&apos;s Blog</title><link>https://pranavgoswami.hashnode.dev</link></image><generator>RSS for Node</generator><lastBuildDate>Wed, 17 Jun 2026 20:46:07 GMT</lastBuildDate><atom:link href="https://pranavgoswami.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Three Leadership Rules: Summary of The One Minute Manager]]></title><description><![CDATA[Effective management is super important in a successful organization, as it helps teams, makes smart decisions, and sets up how the company works. It also keeps people motivated, and productive and makes sure everyone follows the rules, which keeps t...]]></description><link>https://pranavgoswami.hashnode.dev/three-leadership-rules-summary-of-the-one-minute-manager</link><guid isPermaLink="true">https://pranavgoswami.hashnode.dev/three-leadership-rules-summary-of-the-one-minute-manager</guid><category><![CDATA[book summary]]></category><category><![CDATA[books]]></category><category><![CDATA[Self Improvement ]]></category><category><![CDATA[Productivity]]></category><category><![CDATA[management]]></category><category><![CDATA[leadership]]></category><dc:creator><![CDATA[Pranav Goswami]]></dc:creator><pubDate>Wed, 24 Jan 2024 18:43:59 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1706121803454/54969f3f-8425-4915-a9f5-7d85b82b2b3c.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Effective management is super important in a successful organization, as it helps teams, makes smart decisions, and sets up how the company works. It also keeps people motivated, and productive and makes sure everyone follows the rules, which keeps the company successful and its progress on track.</p>
<h1 id="heading-the-one-minute-manager-ken-blanchard-spencer-johnson"><strong>The One Minute Manager: Ken Blanchard, Spencer Johnson</strong></h1>
<p>Many believe effective management requires specific skills or training. However, “The One Minute Manager” by Ken Blanchard and Spencer Johnson simplifies it into three rules, suggesting that anyone can become an effective manager by following these principles.</p>
<h2 id="heading-the-fundamental-principles-are"><strong>The fundamental principles are:</strong></h2>
<ol>
<li><p>One-minute goals</p>
</li>
<li><p>One-minute praising</p>
</li>
<li><p>One-minute redirects</p>
</li>
</ol>
<p>Let us understand the principles well with a detailed summary.</p>
<h1 id="heading-summary-the-one-minute-manager"><strong>Summary: The One-Minute Manager</strong></h1>
<p>The book begins with a boy — let’s say, <strong><mark>Ethan</mark></strong> who was searching for a capable manager — someone skilled in both leadership and work-life balance. In his quest, Ethan interacted with many executives, entrepreneurs, and managers in shops, restaurants, and banks.</p>
<p>During his journey, Ethan met two types of managers: <strong><mark>Bottom line managers</mark></strong> <mark> and </mark> <strong><mark>Participative managers.</mark></strong></p>
<p><mark>Bottom-line managers prioritize work and outcomes,</mark> focusing on organizational growth above all else. Unfortunately, their team members weren’t content with this approach. These managers, often labeled as realistic and profit-minded, struggled to satisfy their teams.</p>
<p>On the flip side, <mark>Participative managers prioritize their team members,</mark> aiming to put people first. While their team members were satisfied, organizations led by participative managers didn’t perform as well.</p>
<p>Unhappy with his search so far, Ethan kept looking until he found a really good manager known for excellent leadership. Both his team and the company had a favorable impression of him. So, Ethan decided to ask the manager for tips on how to manage effectively.</p>
<p>The manager shared that his company used to follow a <mark>top-down management style,</mark> which used to work but was now seen as not so good. According to his philosophy, he believed that smart ideas could come from anyone in the organization, not just the top bosses. In today’s fast-paced world, where being quick is crucial, he preferred teamwork over old-fashioned ways of giving orders.</p>
<p>Digging deeper into the manager’s way of doing things, Ethan was told to talk to the team to get a better idea. When Ethan spoke with the manager’s team, he found out about three key things that made the manager stand out — a person everyone wanted to work with, helping the organization grow and succeed fast.</p>
<h1 id="heading-1-first-principle-one-minute-goals"><strong><mark>1. First Principle: One-Minute Goals</mark></strong></h1>
<p>The One-Minute Manager’s first rule is One-Minute Goals. Instead of bossing people around and setting goals for others,</p>
<ul>
<li><p>He reminds them of what they’re supposed to do.</p>
</li>
<li><p>He explains how to set goals for better performance.</p>
</li>
<li><p>He says goals should be super short, like 1–2 paragraphs you can read in under a minute. This makes it easy to get and remember. It also helps people see if they’re staying on the right path with their goals.</p>
</li>
</ul>
<h1 id="heading-why-one-minute-goals-are-super-effective"><strong>Why One-Minute Goals are Super Effective?</strong></h1>
<ul>
<li><p>It is based on the fact that people can easily feel lost when they’re uncertain about their goals or what the organization expects from them.</p>
</li>
<li><p>One-Minute Goals are great because they keep people from feeling lost. It’s like having a map for your work so you know exactly where you’re heading.</p>
</li>
<li><p>Just like playing golf in the dark makes it impossible to have a good shot without seeing the target, having no clear goal and direction can lead to ineffective work.</p>
</li>
<li><p>Plus, when everyone knows their goals, they can manage themselves better, find a balance between work and personal life, and score big in their tasks!</p>
</li>
</ul>
<h1 id="heading-2-second-principle-one-minute-praising"><strong><mark>2. Second Principle: One-Minute Praising</mark></strong></h1>
<p>The next awesome thing a good manager does is keep a close eye on how the team is doing. Here’s how:</p>
<ul>
<li><p>When the manager spots something good, they quickly give feedback in under a minute.</p>
</li>
<li><p>They explain why that action is a win for the whole team and the organization.</p>
</li>
<li><p>After that, they stay quiet for a bit, letting the team member soak in the appreciation and praise.</p>
</li>
<li><p>Finally, they cheer the person on to keep up the fantastic work!</p>
</li>
</ul>
<h1 id="heading-why-it-works-so-well"><strong>Why it works so well?</strong></h1>
<p>This principle works because it taps into something deeply wired in us — <strong>The need for praise.</strong> We all love a little acknowledgment for our efforts, and when we get it right away, it’s like a boost of motivation.</p>
<p>Think about it: What if your favorite game had no scoreboard? Players would miss that instant feedback on their performance. Just like when Team Argentina scores a goal — seeing it on the scoreboard boosts their spirits and makes them play even better.</p>
<p>It’s the same reason why studying can feel like a drag. You don’t get feedback often, maybe just every few months. That’s why this principle suggests throwing in some self-tests — a quick check to see your progress. It’s a reminder that you’re doing well and keeps you motivated.</p>
<p>So, the magic here is in regular feedback and appreciation. If you want your team to shine, give them a shout-out for every little achievement. This way they will feel motivated and productive.</p>
<h1 id="heading-3-third-principle-one-minute-redirects"><strong><mark>3. Third Principle: One-Minute Redirects</mark></strong></h1>
<p>The One-Minute Redirect is like a secret weapon for great managers. It’s the go-to strategy when someone in the team messes up and could cause problems for the company.</p>
<p>OMM’s mantra is simple — <mark>“People make mistakes, but that doesn’t label them as bad.”</mark> He firmly believes that everybody, even himself, makes mistakes now and then. It’s just part of being human. And this One-Minute Redirect thing helps turn those mistakes into learning moments.</p>
<p>When OMM spots a mistake, he does the One-Minute Redirect, and it goes like this:</p>
<ul>
<li><p>First, he points out what the team member did wrong.</p>
</li>
<li><p>Then, he spills the beans on how he feels about it.</p>
</li>
<li><p>Next, he talks about the consequences of the mistake and the cost it might have for the organization.</p>
</li>
<li><p>After that, he stays quiet for a bit, giving the team member time to really grasp what went wrong.</p>
</li>
<li><p>Finally, he boosts the team member’s confidence by saying he believes in them, emphasizing that they’re more than their mistakes, and expressing how much he values working together to fix things.</p>
</li>
</ul>
<h1 id="heading-why-one-minute-redirect-is-effective"><strong>Why One-Minute Redirect is Effective?</strong></h1>
<p>Compare it to an ineffective manager who just piles up mistakes and drops them all at once on the team. That’s not helpful because there’s no time for team members to learn and improve. It also lacks the manager’s support.</p>
<p>Now, One-Minute Redirect takes a different approach. It gently makes a team member realize their mistake and the potential consequences. It’s not about blaming; it’s about encouraging them to learn and grow, with the manager expressing belief in their ability to do so.</p>
<p>The best part? It wraps up on a positive note. This leaves the team member feeling confident and pumped up to tackle their work. It’s all about building people up, not tearing them down.</p>
<h1 id="heading-summary"><strong><mark>Summary</mark></strong></h1>
<p>Ethan’s search for effective management principles ended when he discovered the three core principles of becoming a One Minute Manager. He was impressed by the manager’s approach in handling teammates.</p>
<p>Subsequently, the One Minute Manager extended an invitation for Ethan to join the team, an offer that Ethan enthusiastically accepted. This not only marked a professional collaboration but also provided Ethan with the opportunity to step into the role of a new One-Minute Manager.</p>
<h1 id="heading-conclusion"><strong><mark>Conclusion</mark></strong></h1>
<p>As we saw from the book, Ethan’s journey teaches us that managing people doesn’t need to be a big puzzle. Simple principles, like the ones from the One Minute Manager, can make things run smoothly. This not only benefits individuals like Ethan in their roles but also brings profits to the teams and organizations.</p>
<p>When everyone is on the same page and working well together, it creates a happy and successful workplace, making everyone’s job easier and more enjoyable.</p>
<p>As we wrap up, I want to say a big thank you for going through this book and exploring the world of effective management with me. I appreciate your time and engagement. Best wishes to you on your own endeavors, and until next time, take care and goodbye!</p>
]]></content:encoded></item><item><title><![CDATA[Destructuring in Javascript: when should it not be used?]]></title><description><![CDATA[Nowadays destructuring has gained widespread popularity in JavaScript, serving as a common expression for extracting values from arrays or object properties into distinct variables.
While destructuring is a handy feature, there are times when it's be...]]></description><link>https://pranavgoswami.hashnode.dev/destructuring-in-javascript-when-should-it-not-be-used</link><guid isPermaLink="true">https://pranavgoswami.hashnode.dev/destructuring-in-javascript-when-should-it-not-be-used</guid><category><![CDATA[JavaScript]]></category><category><![CDATA[React]]></category><category><![CDATA[Frontend Development]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[advance javascript]]></category><category><![CDATA[js]]></category><category><![CDATA[webdev]]></category><category><![CDATA[development]]></category><dc:creator><![CDATA[Pranav Goswami]]></dc:creator><pubDate>Thu, 11 Jan 2024 12:51:36 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1704976719035/061a6f7b-78c3-46f7-9860-ff2e2859d8cf.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Nowadays destructuring has gained widespread popularity in JavaScript, serving as a common expression for extracting values from arrays or object properties into distinct variables.</p>
<p>While destructuring is a handy feature, there are times when it's best to avoid its usage. Examining real examples will offer a better grasp of when to opt for different strategies.</p>
<p><strong><em>The primary goal of this blog is not to provide a tutorial on JavaScript destructuring techniques.</em></strong></p>
<p>You can read the same on my <a target="_blank" href="https://pranavgoswami.medium.com/destructuring-in-javascript-when-should-it-not-be-used-e4b7c3a501ec">Medium.</a></p>
<h1 id="heading-destructuring-in-action">Destructuring in action</h1>
<p>Let us see a use case of destructuring through a code example.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> groceries = [
  { <span class="hljs-attr">id</span>: <span class="hljs-number">1</span>, <span class="hljs-attr">name</span>: <span class="hljs-string">"Eggs"</span> },
  { <span class="hljs-attr">id</span>: <span class="hljs-number">2</span>, <span class="hljs-attr">name</span>: <span class="hljs-string">"Fruits"</span> },
  { <span class="hljs-attr">id</span>: <span class="hljs-number">3</span>, <span class="hljs-attr">name</span>: <span class="hljs-string">"Vegetables"</span> },
  { <span class="hljs-attr">id</span>: <span class="hljs-number">4</span>, <span class="hljs-attr">name</span>: <span class="hljs-string">"Cereal"</span> },
];

groceries.reduce(
  <span class="hljs-function">(<span class="hljs-params">lookup, item</span>) =&gt;</span> ({
    ...lookup, <span class="hljs-comment">// destructuring</span>
    [item.id]: item,
  }),
  {}
);

<span class="hljs-comment">/* Result =&gt; {
    "1": {
        "id": 1,
        "name": "Eggs"
    },
    "2": {
        "id": 2,
        "name": "Fruits"
    },
    "3": {
        "id": 3,
        "name": "Vegetables"
    },
    "4": {
        "id": 4,
        "name": "Cereal"
    }
}
*/</span>
</code></pre>
<p>The given code generates a new object for each item in the result. However, let's take a closer look at what JavaScript is doing behind the scenes.</p>
<p>Upon visiting <a target="_blank" href="https://www.typescriptlang.org/play?#code/MYewdgzgLgBA5gJxMApggliiMC8MDaAUDDAN4zoAmAXDAIwA0MYAhgLYq0BEAonHBC4wAvg2JkKNGACYmrDtwBiCAK7oogkWJLkqtAMxz2nGFwBqKOCigsARgBssQ0eN1SALEYWmAwmhQs9s5iALoA3ISEiMhomBAAdAgolCqoABTiafYgIADWKgAOTOoobACUuAB8MGmk4iTxjdl5hdokBCVs8VQhtJ1twmVtpMKEZWFAA">this link</a>, you'll discover that the above code is essentially identical to the following.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> groceries = [
  { <span class="hljs-attr">id</span>: <span class="hljs-number">1</span>, <span class="hljs-attr">name</span>: <span class="hljs-string">"Eggs"</span> },
  { <span class="hljs-attr">id</span>: <span class="hljs-number">2</span>, <span class="hljs-attr">name</span>: <span class="hljs-string">"Fruits"</span> },
  { <span class="hljs-attr">id</span>: <span class="hljs-number">3</span>, <span class="hljs-attr">name</span>: <span class="hljs-string">"Vegetables"</span> },
  { <span class="hljs-attr">id</span>: <span class="hljs-number">4</span>, <span class="hljs-attr">name</span>: <span class="hljs-string">"Cereal"</span> }
];

groceries.reduce(
  <span class="hljs-function">(<span class="hljs-params">lookup, item</span>) =&gt;</span>
    <span class="hljs-built_in">Object</span>.assign(<span class="hljs-built_in">Object</span>.assign({}, lookup), { [item.id]: item }),
  {}
);
</code></pre>
<p>Upon closer inspection, it's evident that a new object is being created in each iteration. Now, let's explore an alternative approach to achieve the same outcome.</p>
<pre><code class="lang-javascript"> <span class="hljs-keyword">const</span> groceries = [
  { <span class="hljs-attr">id</span>: <span class="hljs-number">1</span>, <span class="hljs-attr">name</span>: <span class="hljs-string">"Eggs"</span> },
  { <span class="hljs-attr">id</span>: <span class="hljs-number">2</span>, <span class="hljs-attr">name</span>: <span class="hljs-string">"Fruits"</span> },
  { <span class="hljs-attr">id</span>: <span class="hljs-number">3</span>, <span class="hljs-attr">name</span>: <span class="hljs-string">"Vegetables"</span> },
  { <span class="hljs-attr">id</span>: <span class="hljs-number">4</span>, <span class="hljs-attr">name</span>: <span class="hljs-string">"Cereal"</span> },
];

groceries.reduce(<span class="hljs-function">(<span class="hljs-params">lookup, item</span>) =&gt;</span> {
  lookup[item.id] = item;
  <span class="hljs-keyword">return</span> lookup;
}, {});

<span class="hljs-comment">/* Result =&gt; {
    "1": {
        "id": 1,
        "name": "Eggs"
    },
    "2": {
        "id": 2,
        "name": "Fruits"
    },
    "3": {
        "id": 3,
        "name": "Vegetables"
    },
    "4": {
        "id": 4,
        "name": "Cereal"
    }
}
*/</span>
</code></pre>
<p>The output is consistent in the provided code, but the substantial difference lies in the approach taken to accomplish the task.</p>
<p>In the initial method, <mark>we repeatedly create and copy all values</mark> from the previous object to a new one. This happens five times, first during initialization and then in four iterations within the reduce function using the <code>Object.assign</code> method.</p>
<p>In the second method, we <mark>only create a new object once during the initialization,</mark> and thereafter, in each iteration within the reduce function, <mark>we modify that same object</mark> instead of generating a new one.</p>
<p>In a scenario with just four items, the difference might not be noticeable. However, when dealing with a more substantial dataset, let's say 10,000 to 12,000 items, the contrast becomes more apparent. In the first approach, <mark>for each iteration, a new object is created, and all previous items are copied into this new object</mark> before adding new key-value pairs. This process repeats, potentially causing performance issues due to the overhead of duplicating data.</p>
<p>A graph for this approach will look something like this,</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1704965361657/4c1f617a-2a3f-40cf-9a43-6e19394bf9eb.png" alt class="image--center mx-auto" /></p>
<p>Clearly, with the destructuring method, the process becomes slower as the list grows larger. However, this is not the case with the second approach.</p>
<h1 id="heading-conclusion">Conclusion</h1>
<p>By now, you should have a better understanding of how destructuring operates in JavaScript beneath the surface and how its improper usage can potentially impact your application's performance.</p>
<p>And with that, we wrap up this blog! To all the awesome developers and coders out there, take care and happy coding!</p>
]]></content:encoded></item><item><title><![CDATA[Safety Net of React: Understanding and Implementing Error Boundaries]]></title><description><![CDATA[Introduction:
React has emerged as one of the most popular and widely used JavaScript libraries for building dynamic and interactive user interfaces. With its component-based architecture and declarative nature, React simplifies the process of buildi...]]></description><link>https://pranavgoswami.hashnode.dev/react-error-boundaries</link><guid isPermaLink="true">https://pranavgoswami.hashnode.dev/react-error-boundaries</guid><category><![CDATA[React]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[Frontend Development]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[frontend]]></category><category><![CDATA[full stack]]></category><category><![CDATA[Developer]]></category><category><![CDATA[development]]></category><category><![CDATA[learning]]></category><dc:creator><![CDATA[Pranav Goswami]]></dc:creator><pubDate>Fri, 08 Dec 2023 18:30:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1702270289032/80dc881e-7046-440d-85c9-4e555e5af0b2.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h1 id="heading-introduction">Introduction:</h1>
<p>React has emerged as one of the most popular and widely used JavaScript libraries for building dynamic and interactive user interfaces. With its component-based architecture and declarative nature, React simplifies the process of building complex UIs. However, as powerful as React may be, it cannot guarantee a foolproof web experience. Errors can still occur, causing the app to crash and leaving users frustrated. For that, React introduces a powerful feature called Error Boundaries to handle these mishaps gracefully.</p>
<p>This blog is also available on my <a target="_blank" href="https://pranavgoswami.medium.com/safety-net-of-react-understanding-and-implementing-error-boundaries-3e21182f6845">Medium</a> but with a better user interface.</p>
<h1 id="heading-what-exactly-are-error-boundaries"><mark>What Exactly Are Error Boundaries?</mark></h1>
<p>So, what exactly are error boundaries? Error boundaries are React components that wrap around other components to catch errors that occur during rendering. When an error occurs in any component wrapped by an error boundary, it prevents the entire application from crashing. Instead of an error, the error boundary catches the error within its child components, allowing you to gracefully handle the issue without crashing the entire app. By encapsulating the error within the boundary, React prevents the entire application from crashing, maintaining a seamless user experience.</p>
<h1 id="heading-why-do-we-need-it">Why do we need it?</h1>
<p>Error boundaries in React are like safety nets for your app. They catch errors in specific parts of your code, <mark>preventing the whole app from crashing.</mark> With error boundaries, you can control how to handle errors, like showing a friendly message instead of a confusing crash.</p>
<p>These are a couple of points but in easy terms:</p>
<ul>
<li><p>Errors in React components can crash the whole app, but error boundaries stop this from happening.</p>
</li>
<li><p>Even if one part of the app has an error, error boundaries keep the rest working, making the app more stable.</p>
</li>
<li><p>Crashes are bad for user experience, but error boundaries help show friendly messages or backup UIs.</p>
</li>
<li><p>Error boundaries let developers deal with errors in specific parts of the app, making it easier to find and fix issues.</p>
</li>
<li><p>Developers can catch and log errors easily with error boundaries, helping them find and fix problems more easily.</p>
</li>
</ul>
<h1 id="heading-step-by-step-integration"><mark>Step-By-Step Integration</mark></h1>
<p>Let us have a step-by-step implementation of the error boundary.</p>
<ol>
<li><p>Let us start with creating a Class component - <code>ErrorBoundaryWrapper.jsx</code> and let us initialize a <code>hasError</code> state with default value as <code>false</code></p>
<pre><code class="lang-javascript"> <span class="hljs-keyword">import</span> React <span class="hljs-keyword">from</span> <span class="hljs-string">"react"</span>

 <span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">ErrorBoundaryWrapper</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">React</span>.<span class="hljs-title">Component</span> </span>{
   <span class="hljs-keyword">constructor</span>(props) {
     <span class="hljs-built_in">super</span>(props);
     <span class="hljs-built_in">this</span>.state = { <span class="hljs-attr">hasError</span>: <span class="hljs-literal">false</span> };
   }

   render() {
       <span class="hljs-keyword">return</span> <span class="hljs-built_in">this</span>.props.children;
   }
 }
</code></pre>
</li>
<li><p>Now Let us add a method, <code>getDerivedStateFromError</code> which is a static method in class component that gets called when an error is thrown in a descendant component of the error boundary.</p>
<pre><code class="lang-javascript"> <span class="hljs-keyword">static</span> getDerivedStateFromError() {
   <span class="hljs-keyword">return</span> { <span class="hljs-attr">hasError</span>: <span class="hljs-literal">true</span> };
 }
</code></pre>
</li>
<li><p>Let us add one more lifecycle method, <code>componentDidCatch</code> which is called after an error has been thrown by a descendant component. It provides an opportunity to perform side effects, such as logging the error.</p>
<pre><code class="lang-javascript"> componentDidCatch(error, errorInfo) {
     <span class="hljs-comment">// Other logic </span>
     <span class="hljs-built_in">console</span>.log(error, errorInfo);
 }
</code></pre>
</li>
<li><p>After adding the <code>getDerivedStateFromError</code>, let us update our <code>render()</code> in such a way that it throws a fallback UI when there is an error.</p>
<pre><code class="lang-javascript"> render() {
     <span class="hljs-keyword">if</span> (<span class="hljs-built_in">this</span>.state.hasError) {
       <span class="hljs-comment">// Render custom fallback UI</span>
       <span class="hljs-keyword">return</span> <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">span</span> <span class="hljs-attr">style</span>=<span class="hljs-string">{{</span> <span class="hljs-attr">marginRight:</span> "<span class="hljs-attr">1rem</span>" }}&gt;</span>Something went wrong.<span class="hljs-tag">&lt;/<span class="hljs-name">span</span>&gt;</span></span>;
     }

     <span class="hljs-keyword">return</span> <span class="hljs-built_in">this</span>.props.children;
   }
</code></pre>
</li>
<li><p>Our final <code>ErrorBoundaryWrapper.jsx</code> file should look something like this</p>
<pre><code class="lang-javascript"> <span class="hljs-keyword">import</span> React <span class="hljs-keyword">from</span> <span class="hljs-string">"react"</span>

 <span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">ErrorBoundaryWrapper</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">React</span>.<span class="hljs-title">Component</span> </span>{
   <span class="hljs-keyword">constructor</span>(props) {
     <span class="hljs-built_in">super</span>(props);
     <span class="hljs-built_in">this</span>.state = { <span class="hljs-attr">hasError</span>: <span class="hljs-literal">false</span> };
   }

   <span class="hljs-keyword">static</span> getDerivedStateFromError(error) {
     <span class="hljs-comment">// Update state so the next render will show the fallback UI.</span>
     <span class="hljs-built_in">console</span>.log({ error })
     <span class="hljs-keyword">return</span> { <span class="hljs-attr">hasError</span>: <span class="hljs-literal">true</span> };
   }

   componentDidCatch(error, errorInfo) {
     <span class="hljs-comment">// Log the error or other logic (make some API request to your backend regarding error)</span>
     <span class="hljs-built_in">console</span>.log(error, errorInfo);
   }

   render() {
     <span class="hljs-keyword">if</span> (<span class="hljs-built_in">this</span>.state.hasError) {
       <span class="hljs-comment">// Render custom fallback UI</span>
       <span class="hljs-keyword">return</span> <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">span</span> <span class="hljs-attr">style</span>=<span class="hljs-string">{{</span> <span class="hljs-attr">marginRight:</span> "<span class="hljs-attr">1rem</span>" }}&gt;</span>Something went wrong.<span class="hljs-tag">&lt;/<span class="hljs-name">span</span>&gt;</span></span>;
     }

     <span class="hljs-keyword">return</span> <span class="hljs-built_in">this</span>.props.children;
   }
 }
</code></pre>
</li>
<li><p>Now, Let us Modify the <code>App.jsx</code> to manually throw an error when a user presses a button 3 times.</p>
<pre><code class="lang-javascript"> <span class="hljs-keyword">import</span> { Fragment, useEffect, useState } <span class="hljs-keyword">from</span> <span class="hljs-string">'react'</span>

 <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">ErrorButton</span>(<span class="hljs-params"></span>) </span>{
   <span class="hljs-keyword">const</span> [count, setCount] = useState(<span class="hljs-number">3</span>)

   <span class="hljs-keyword">const</span> handleClick = <span class="hljs-function">() =&gt;</span> {
     setCount(<span class="hljs-function"><span class="hljs-params">prev</span> =&gt;</span> prev - <span class="hljs-number">1</span>)
   }

   useEffect(<span class="hljs-function">() =&gt;</span> {
     <span class="hljs-keyword">if</span> (count === <span class="hljs-number">0</span>) {
       <span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> <span class="hljs-built_in">Error</span>(<span class="hljs-string">"Error!"</span>)
     }
   }, [count])

   <span class="hljs-keyword">return</span> (
     <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">onClick</span>=<span class="hljs-string">{handleClick}</span>&gt;</span>
       Click me {count} times to throw Error!
     <span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span></span>
   )
 }

 <span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">App</span>(<span class="hljs-params"></span>) </span>{
   <span class="hljs-keyword">return</span> (
     <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">Fragment</span>&gt;</span>
       <span class="hljs-tag">&lt;<span class="hljs-name">ErrorButton</span> /&gt;</span>
     <span class="hljs-tag">&lt;/<span class="hljs-name">Fragment</span>&gt;</span></span>
   )
 }
</code></pre>
</li>
<li><p>Now let us add some styling for the button in <code>App.css</code></p>
<pre><code class="lang-css"> <span class="hljs-selector-tag">button</span> {
   <span class="hljs-attribute">margin-right</span>: <span class="hljs-number">1rem</span>;
   <span class="hljs-attribute">background</span>: <span class="hljs-number">#0074d9</span>;
   <span class="hljs-attribute">box-shadow</span>: none;
   <span class="hljs-attribute">border</span>: none;
   <span class="hljs-attribute">cursor</span>: pointer;
   <span class="hljs-attribute">padding</span>: <span class="hljs-number">1rem</span> <span class="hljs-number">2rem</span>;
   <span class="hljs-attribute">color</span>: <span class="hljs-number">#fff</span>;
 }
</code></pre>
</li>
<li><p>Now let us add 3 sections to our App component where</p>
<ul>
<li><p>The first section will have <mark>no error boundary</mark>,</p>
</li>
<li><p>The second will have an error boundary but <mark>it will be wrapped inside a parent component</mark></p>
</li>
<li><p>Finally, the third section will have an error boundary <mark>at the component level</mark> for each button.</p>
</li>
</ul>
</li>
</ol>
<p>    Finally, it should look something like this,</p>
<pre><code class="lang-javascript">    <span class="hljs-keyword">import</span> { Fragment, useEffect, useState } <span class="hljs-keyword">from</span> <span class="hljs-string">'react'</span>
    <span class="hljs-keyword">import</span> <span class="hljs-string">'./App.css'</span>
    <span class="hljs-keyword">import</span> ErrorBoundaryWrapper <span class="hljs-keyword">from</span> <span class="hljs-string">'./ErrorBoundaryWrapper'</span>

    <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">ErrorButton</span>(<span class="hljs-params"></span>) </span>{
      <span class="hljs-keyword">const</span> [count, setCount] = useState(<span class="hljs-number">3</span>)

      <span class="hljs-keyword">const</span> handleClick = <span class="hljs-function">() =&gt;</span> {
        setCount(<span class="hljs-function"><span class="hljs-params">prev</span> =&gt;</span> prev - <span class="hljs-number">1</span>)
      }

      useEffect(<span class="hljs-function">() =&gt;</span> {
        <span class="hljs-keyword">if</span> (count === <span class="hljs-number">0</span>) {
          <span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> <span class="hljs-built_in">Error</span>(<span class="hljs-string">"Error!"</span>)
        }
      }, [count])

      <span class="hljs-keyword">return</span> (
        <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">onClick</span>=<span class="hljs-string">{handleClick}</span>&gt;</span>
          Click me {count} times to throw Error!
        <span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span></span>
      )
    }

    <span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">App</span>(<span class="hljs-params"></span>) </span>{
      <span class="hljs-keyword">return</span> (
        <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">Fragment</span>&gt;</span>
          <span class="hljs-tag">&lt;<span class="hljs-name">h3</span>&gt;</span>No error boundary<span class="hljs-tag">&lt;/<span class="hljs-name">h3</span>&gt;</span>
          <span class="hljs-tag">&lt;<span class="hljs-name">ErrorButton</span> /&gt;</span>
          <span class="hljs-tag">&lt;<span class="hljs-name">hr</span> /&gt;</span>
          <span class="hljs-tag">&lt;<span class="hljs-name">h3</span>&gt;</span>Error boundary at parent level<span class="hljs-tag">&lt;/<span class="hljs-name">h3</span>&gt;</span>
          <span class="hljs-tag">&lt;<span class="hljs-name">ErrorBoundaryWrapper</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span>
              <span class="hljs-tag">&lt;<span class="hljs-name">ErrorButton</span> /&gt;</span>
              <span class="hljs-tag">&lt;<span class="hljs-name">ErrorButton</span> /&gt;</span>
            <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
          <span class="hljs-tag">&lt;/<span class="hljs-name">ErrorBoundaryWrapper</span>&gt;</span>
          <span class="hljs-tag">&lt;<span class="hljs-name">hr</span> /&gt;</span>
          <span class="hljs-tag">&lt;<span class="hljs-name">h3</span>&gt;</span>Error boundary at component level<span class="hljs-tag">&lt;/<span class="hljs-name">h3</span>&gt;</span>
          <span class="hljs-tag">&lt;<span class="hljs-name">ErrorBoundaryWrapper</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">ErrorButton</span> /&gt;</span>
          <span class="hljs-tag">&lt;/<span class="hljs-name">ErrorBoundaryWrapper</span>&gt;</span>
          <span class="hljs-tag">&lt;<span class="hljs-name">ErrorBoundaryWrapper</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">ErrorButton</span> /&gt;</span>
          <span class="hljs-tag">&lt;/<span class="hljs-name">ErrorBoundaryWrapper</span>&gt;</span>
        <span class="hljs-tag">&lt;/<span class="hljs-name">Fragment</span>&gt;</span></span>
      )
    }
</code></pre>
<ol>
<li><p>Below is the Replit for the same.</p>
<p> %[https://replit.com/@p03goswami/Error-Boundary-React] </p>
</li>
</ol>
<p>By playing with the above example, you will notice that</p>
<ul>
<li><p>when you trigger an error <mark>at Level 1, it will crash the entire app</mark>.</p>
<ul>
<li>At level 2, an error in any button <mark>will replace the component with a fallback UI that is under the parent</mark>.</li>
</ul>
</li>
<li><p>For the third one, while an error, we will see a <mark>replaced fallback UI with the component</mark> itself.</p>
</li>
</ul>
<p>This is the working of error boundaries in React. You can control which fallback UI you want to display when a certain error occurs in their children component.</p>
<h1 id="heading-pitfallslimitations-of-error-boundaries"><mark>Pitfalls/Limitations of Error Boundaries</mark></h1>
<p>So far, we have just discussed the advantages of Error boundaries. But not to forget, there are some drawbacks to consider as well. Such as,</p>
<ul>
<li><p>Error boundaries can only catch errors that occur during the synchronous rendering phase or lifecycle methods.</p>
</li>
<li><p>They <mark>cannot catch errors in asynchronous operations</mark> like <code>setTimeout</code> or event handlers such as <code>onClick</code>.</p>
</li>
<li><p>The use of error boundaries can introduce <mark>coupling between components</mark>, as you need to wrap components with error boundaries to catch errors in their descendants.</p>
</li>
</ul>
<p>So, error boundaries in React have limitations—they can't catch asynchronous errors like those in <code>setTimeout</code> or <code>onClick</code> handlers. Additionally, their use introduces component coupling, impacting modularity. Developers should be aware of these constraints and explore alternative strategies for handling asynchronous errors and minimizing coupling in certain scenarios.</p>
<h1 id="heading-conclusion"><mark>Conclusion</mark></h1>
<p>In summary, React's Error Boundaries are invaluable for enhancing application stability. They act as trusty safety nets, giving developers the power to manage errors in specific components and keep the user experience smooth. The step-by-step guide we've walked through shows how easy it is to add it to your app.</p>
<p>But, hey, let's not forget they're not invincible. They might <mark>struggle with asynchronous errors and bring in a bit of component coupling drama</mark>. So, while Error Boundaries are the cool sidekicks in your toolkit, it's wise to team them up with other strategies like testing and monitoring for an all-around reliable and user-friendly user experience.</p>
<p>That is it, folks! Keep coding with confidence, and may your apps be crash-free! 🚀</p>
]]></content:encoded></item><item><title><![CDATA[Virtualization in React: Render Large Datasets Efficiently]]></title><description><![CDATA[Front-end development has evolved exponentially, with React emerging as a preferred framework for building dynamic user interfaces. As a front-end developer, you're likely familiar with React's Virtual DOM concept, which enables instant and quick ren...]]></description><link>https://pranavgoswami.hashnode.dev/virtualization-in-react</link><guid isPermaLink="true">https://pranavgoswami.hashnode.dev/virtualization-in-react</guid><category><![CDATA[React]]></category><category><![CDATA[Frontend Development]]></category><category><![CDATA[Developer]]></category><category><![CDATA[full stack]]></category><category><![CDATA[frontend]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[react js]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[learn coding]]></category><dc:creator><![CDATA[Pranav Goswami]]></dc:creator><pubDate>Thu, 30 Nov 2023 16:55:28 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1701408448778/451a59f1-6fd5-448a-8cc0-a2df31e41abd.webp" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Front-end development has evolved exponentially, with React emerging as a preferred framework for building dynamic user interfaces. As a front-end developer, you're likely familiar with React's Virtual DOM concept, which enables instant and quick rendering by updating only the necessary components instead of refreshing the entire webpage. It's cool, isn't it? However, do you know what is cooler? <mark>Out of the 1000 items, rendering only a fraction of those at a time</mark> resulting in more performance improvement! This concept is nothing but Virtualization. In this blog post, we will dive into the depths of Virtualization, exploring its inner workings, benefits, and why you should consider utilizing it in specific scenarios.</p>
<h2 id="heading-what-exactly-is-virtualization-in-react">What exactly is virtualization in React?</h2>
<p>Before we go deeper into the concept of Virtualization, let's briefly understand what exactly it means. Virtualization, in the context of front-end development, <mark>refers to the technique of rendering only the visible elements of a long list, table, or other data structures, while keeping the non-visible elements "virtual" or out of the browser's rendering tree.</mark></p>
<p>React's rendering algorithm uses a Virtual DOM, a lightweight copy of the actual DOM tree that allows React to efficiently compare and update the differences between subsequent renders. This approach significantly improves performance by minimizing the number of costly DOM operations required, resulting in a more responsive user interface.</p>
<p>While React's Virtual DOM is powerful in itself, it is not optimized for scenarios where large datasets need to be rendered or scrolled through. This is where Virtualization comes to the rescue.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1701323740575/9b792ec1-0d9c-4897-8b57-1c4eecc035bc.webp" alt class="image--center mx-auto" /></p>
<p>In simpler terms, imagine you have this super long list or table on your website. Virtualization is like having a smart helper that only shows you the things you can see on your screen. The rest stays kind of hidden but ready to jump in when needed.</p>
<h2 id="heading-step-by-step-implementation">Step-By-Step Implementation:</h2>
<p>Just knowing the concept of virtualization is not enough. So let us see step-by-step how to use it in your real projects.</p>
<ol>
<li><p>Let us start by installing the necessary dependencies. To install it, run the following command</p>
<pre><code class="lang-plaintext"> npm i react-window @mui/material @emotion/react @emotion/styled
</code></pre>
</li>
<li><p>Now, create a <code>listData</code> item which is an array with 1000 items. After that, we will create a <code>RowRenderer</code> component which will represent a single row for our gigantic list.</p>
<p> Along with that, create a new <code>VirtualizedList</code> component which will be responsible for rendering our virtual list.</p>
<p> Add one more component named <code>NonVirtualizedList</code> for us to see the difference in the rendering time.</p>
<pre><code class="lang-javascript"> <span class="hljs-keyword">import</span> { FixedSizeList <span class="hljs-keyword">as</span> List } <span class="hljs-keyword">from</span> <span class="hljs-string">"react-window"</span>;

 <span class="hljs-keyword">const</span> listData = <span class="hljs-built_in">Array</span>.from(
   { <span class="hljs-attr">length</span>: <span class="hljs-number">10000</span> },
   <span class="hljs-function">(<span class="hljs-params">_, index</span>) =&gt;</span> <span class="hljs-string">`Item <span class="hljs-subst">${index + <span class="hljs-number">1</span>}</span>`</span>,
 );

 <span class="hljs-keyword">const</span> RowRenderer = <span class="hljs-function">(<span class="hljs-params">{ index, style }</span>) =&gt;</span> (
   <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">div</span>
     <span class="hljs-attr">className</span>=<span class="hljs-string">{index</span> % <span class="hljs-attr">2</span> ? "<span class="hljs-attr">ListItemOdd</span>" <span class="hljs-attr">:</span> "<span class="hljs-attr">ListItemEven</span>"}
     <span class="hljs-attr">style</span>=<span class="hljs-string">{style}</span>
   &gt;</span>
     Row {index}
   <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span></span>
 );

 <span class="hljs-keyword">const</span> VirtualizedList = <span class="hljs-function">() =&gt;</span> (
   <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">List</span> <span class="hljs-attr">height</span>=<span class="hljs-string">{250}</span> <span class="hljs-attr">itemCount</span>=<span class="hljs-string">{1000}</span> <span class="hljs-attr">itemSize</span>=<span class="hljs-string">{35}</span> <span class="hljs-attr">width</span>=<span class="hljs-string">{300}</span>&gt;</span>
     {RowRenderer}
   <span class="hljs-tag">&lt;/<span class="hljs-name">List</span>&gt;</span></span>
 );

 <span class="hljs-keyword">const</span> NonVirtualizedList = <span class="hljs-function">() =&gt;</span> {
   <span class="hljs-keyword">return</span> listData.map(<span class="hljs-function">(<span class="hljs-params">item, index</span>) =&gt;</span> {
     <span class="hljs-keyword">return</span> <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">RowRenderer</span> <span class="hljs-attr">key</span>=<span class="hljs-string">{item}</span> <span class="hljs-attr">index</span>=<span class="hljs-string">{index}</span> /&gt;</span></span>;
   });
 };
</code></pre>
</li>
<li><p>For the next step, we will add a switch from <a target="_blank" href="https://mui.com/material-ui/getting-started/">Material UI</a>, to toggle the state of the component which will be rendered on the screen.</p>
<p> In the below code, we will replace <code>someLogic</code> in such a way that we can toggle the particular component which needs to be rendered on the switch toggle.</p>
<pre><code class="lang-javascript"> <span class="hljs-keyword">import</span> {
   Box,
   FormControlLabel,
   FormGroup,
   Switch,
   Typography,
 } <span class="hljs-keyword">from</span> <span class="hljs-string">"@mui/material"</span>;
 <span class="hljs-keyword">import</span> { FixedSizeList <span class="hljs-keyword">as</span> List } <span class="hljs-keyword">from</span> <span class="hljs-string">"react-window"</span>;

 <span class="hljs-keyword">const</span> listData = <span class="hljs-built_in">Array</span>.from(
   { <span class="hljs-attr">length</span>: <span class="hljs-number">10000</span> },
   <span class="hljs-function">(<span class="hljs-params">_, index</span>) =&gt;</span> <span class="hljs-string">`Item <span class="hljs-subst">${index + <span class="hljs-number">1</span>}</span>`</span>,
 );

 <span class="hljs-keyword">const</span> RowRenderer = <span class="hljs-function">(<span class="hljs-params">{ index, style }</span>) =&gt;</span> (
   <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">div</span>
     <span class="hljs-attr">className</span>=<span class="hljs-string">{index</span> % <span class="hljs-attr">2</span> ? "<span class="hljs-attr">ListItemOdd</span>" <span class="hljs-attr">:</span> "<span class="hljs-attr">ListItemEven</span>"}
     <span class="hljs-attr">style</span>=<span class="hljs-string">{style}</span>
   &gt;</span>
     Row {index}
   <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span></span>
 );

 <span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> () =&gt; {
   <span class="hljs-keyword">return</span> (
     <span class="xml"><span class="hljs-tag">&lt;&gt;</span>
       <span class="hljs-tag">&lt;<span class="hljs-name">FormGroup</span>&gt;</span>
         <span class="hljs-tag">&lt;<span class="hljs-name">FormControlLabel</span>
           <span class="hljs-attr">sx</span>=<span class="hljs-string">{{</span> <span class="hljs-attr">margin:</span> "<span class="hljs-attr">auto</span>", <span class="hljs-attr">mb:</span> <span class="hljs-attr">3</span> }}
           <span class="hljs-attr">control</span>=<span class="hljs-string">{</span>
             &lt;<span class="hljs-attr">Switch</span>
               <span class="hljs-attr">checked</span>=<span class="hljs-string">{someLogic}</span>
             /&gt;</span>
           }
           label={
             <span class="hljs-tag">&lt;<span class="hljs-name">Typography</span> <span class="hljs-attr">variant</span>=<span class="hljs-string">"h5"</span>&gt;</span>
               Virtualization: {someLogic ? "On" : "Off"}
             <span class="hljs-tag">&lt;/<span class="hljs-name">Typography</span>&gt;</span>
           }
         /&gt;
       <span class="hljs-tag">&lt;/<span class="hljs-name">FormGroup</span>&gt;</span>

       <span class="hljs-tag">&lt;<span class="hljs-name">Typography</span> <span class="hljs-attr">variant</span>=<span class="hljs-string">"h5"</span> <span class="hljs-attr">textAlign</span>=<span class="hljs-string">"center"</span> <span class="hljs-attr">sx</span>=<span class="hljs-string">{{</span> <span class="hljs-attr">mb:</span> <span class="hljs-attr">2</span> }}&gt;</span>
         Render time = 10
       <span class="hljs-tag">&lt;/<span class="hljs-name">Typography</span>&gt;</span>

       <span class="hljs-tag">&lt;<span class="hljs-name">Box</span>
         <span class="hljs-attr">className</span>=<span class="hljs-string">"main"</span>
       &gt;</span>
         {someLogic ? <span class="hljs-tag">&lt;<span class="hljs-name">VirtualizedList</span> /&gt;</span> : <span class="hljs-tag">&lt;<span class="hljs-name">NonVirtualizedList</span> /&gt;</span>}
       <span class="hljs-tag">&lt;/<span class="hljs-name">Box</span>&gt;</span>
     <span class="hljs-tag">&lt;&gt;</span>
   );
 };

 const VirtualizedList = () =&gt; (
   <span class="hljs-tag">&lt;<span class="hljs-name">List</span> <span class="hljs-attr">height</span>=<span class="hljs-string">{250}</span> <span class="hljs-attr">itemCount</span>=<span class="hljs-string">{1000}</span> <span class="hljs-attr">itemSize</span>=<span class="hljs-string">{35}</span> <span class="hljs-attr">width</span>=<span class="hljs-string">{300}</span>&gt;</span>
     {RowRenderer}
   <span class="hljs-tag">&lt;/<span class="hljs-name">List</span>&gt;</span>
 );

 const NonVirtualizedList = () =&gt; {
   return listData.map((item, index) =&gt; {
     return <span class="hljs-tag">&lt;<span class="hljs-name">RowRenderer</span> <span class="hljs-attr">key</span>=<span class="hljs-string">{item}</span> <span class="hljs-attr">index</span>=<span class="hljs-string">{index}</span> /&gt;</span>;
   });
 };</span>
</code></pre>
</li>
<li><p>For the final step, I have added two states to manage toggle between the components.</p>
<p> Also, I have added the <a target="_blank" href="https://react.dev/reference/react/Profiler">React Profiler</a> to measure the render time of our component.</p>
<pre><code class="lang-javascript"> <span class="hljs-keyword">import</span> {
   Box,
   FormControlLabel,
   FormGroup,
   Switch,
   Typography,
 } <span class="hljs-keyword">from</span> <span class="hljs-string">"@mui/material"</span>;
 <span class="hljs-keyword">import</span> React, { Profiler, useState } <span class="hljs-keyword">from</span> <span class="hljs-string">"react"</span>;
 <span class="hljs-keyword">import</span> { FixedSizeList <span class="hljs-keyword">as</span> List } <span class="hljs-keyword">from</span> <span class="hljs-string">"react-window"</span>;

 <span class="hljs-keyword">const</span> listData = <span class="hljs-built_in">Array</span>.from(
   { <span class="hljs-attr">length</span>: <span class="hljs-number">10000</span> },
   <span class="hljs-function">(<span class="hljs-params">_, index</span>) =&gt;</span> <span class="hljs-string">`Item <span class="hljs-subst">${index + <span class="hljs-number">1</span>}</span>`</span>,
 );

 <span class="hljs-keyword">const</span> RowRenderer = <span class="hljs-function">(<span class="hljs-params">{ index, style }</span>) =&gt;</span> (
   <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">div</span>
     <span class="hljs-attr">className</span>=<span class="hljs-string">{index</span> % <span class="hljs-attr">2</span> ? "<span class="hljs-attr">ListItemOdd</span> <span class="hljs-attr">item</span>" <span class="hljs-attr">:</span> "<span class="hljs-attr">ListItemEven</span> <span class="hljs-attr">item</span>"}
     <span class="hljs-attr">style</span>=<span class="hljs-string">{style}</span>
   &gt;</span>
     Row {index}
   <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span></span>
 );

 <span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> () =&gt; {
   <span class="hljs-keyword">const</span> [isVirtualized, setIsVirtualized] = useState(<span class="hljs-literal">false</span>);
   <span class="hljs-keyword">const</span> [renderTime, setRenderTime] = useState(<span class="hljs-literal">null</span>);

   <span class="hljs-keyword">return</span> (
     <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">Profiler</span>
       <span class="hljs-attr">id</span>=<span class="hljs-string">"virtualized-list"</span>
       <span class="hljs-attr">onRender</span>=<span class="hljs-string">{(id,</span> <span class="hljs-attr">phase</span>, <span class="hljs-attr">duration</span>) =&gt;</span>
         !Boolean(renderTime) &amp;&amp; setRenderTime(duration)
       }
     &gt;
       <span class="hljs-tag">&lt;<span class="hljs-name">FormGroup</span>&gt;</span>
         <span class="hljs-tag">&lt;<span class="hljs-name">FormControlLabel</span>
           <span class="hljs-attr">sx</span>=<span class="hljs-string">{{</span> <span class="hljs-attr">margin:</span> "<span class="hljs-attr">auto</span>", <span class="hljs-attr">mb:</span> <span class="hljs-attr">3</span> }}
           <span class="hljs-attr">control</span>=<span class="hljs-string">{</span>
             &lt;<span class="hljs-attr">Switch</span>
               <span class="hljs-attr">checked</span>=<span class="hljs-string">{isVirtualized}</span>
               <span class="hljs-attr">onChange</span>=<span class="hljs-string">{()</span> =&gt;</span> {
                 setIsVirtualized((prev) =&gt; !prev);
                 setRenderTime(null);
               }}
             /&gt;
           }
           label={
             <span class="hljs-tag">&lt;<span class="hljs-name">Typography</span> <span class="hljs-attr">variant</span>=<span class="hljs-string">"h5"</span>&gt;</span>
               Virtualization: {isVirtualized ? "On" : "Off"}
             <span class="hljs-tag">&lt;/<span class="hljs-name">Typography</span>&gt;</span>
           }
         /&gt;
       <span class="hljs-tag">&lt;/<span class="hljs-name">FormGroup</span>&gt;</span>

       <span class="hljs-tag">&lt;<span class="hljs-name">Typography</span> <span class="hljs-attr">variant</span>=<span class="hljs-string">"h5"</span> <span class="hljs-attr">textAlign</span>=<span class="hljs-string">"center"</span> <span class="hljs-attr">sx</span>=<span class="hljs-string">{{</span> <span class="hljs-attr">mb:</span> <span class="hljs-attr">2</span> }}&gt;</span>
         Render time = {renderTime}
       <span class="hljs-tag">&lt;/<span class="hljs-name">Typography</span>&gt;</span>

       <span class="hljs-tag">&lt;<span class="hljs-name">Box</span>
         <span class="hljs-attr">className</span>=<span class="hljs-string">"main"</span>
         <span class="hljs-attr">sx</span>=<span class="hljs-string">{{</span>
           "&amp; &gt;</span> div": {
             height: isVirtualized ? "300px !important" : "35px !important",
           },
         }}
       &gt;
         {isVirtualized ? <span class="hljs-tag">&lt;<span class="hljs-name">VirtualizedList</span> /&gt;</span> : <span class="hljs-tag">&lt;<span class="hljs-name">NonVirtualizedList</span> /&gt;</span>}
       <span class="hljs-tag">&lt;/<span class="hljs-name">Box</span>&gt;</span>
     <span class="hljs-tag">&lt;/<span class="hljs-name">Profiler</span>&gt;</span></span>
   );
 };

 <span class="hljs-keyword">const</span> VirtualizedList = <span class="hljs-function">() =&gt;</span> (
   <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">List</span> <span class="hljs-attr">height</span>=<span class="hljs-string">{250}</span> <span class="hljs-attr">itemCount</span>=<span class="hljs-string">{1000}</span> <span class="hljs-attr">itemSize</span>=<span class="hljs-string">{35}</span> <span class="hljs-attr">width</span>=<span class="hljs-string">{300}</span>&gt;</span>
     {RowRenderer}
   <span class="hljs-tag">&lt;/<span class="hljs-name">List</span>&gt;</span></span>
 );

 <span class="hljs-keyword">const</span> NonVirtualizedList = <span class="hljs-function">() =&gt;</span> {
   <span class="hljs-keyword">return</span> listData.map(<span class="hljs-function">(<span class="hljs-params">item, index</span>) =&gt;</span> {
     <span class="hljs-keyword">return</span> <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">RowRenderer</span> <span class="hljs-attr">key</span>=<span class="hljs-string">{item}</span> <span class="hljs-attr">index</span>=<span class="hljs-string">{index}</span> /&gt;</span></span>;
   });
 };
</code></pre>
</li>
<li><p>For the last step, I have added some styles and added the stylesheet to this file.</p>
<pre><code class="lang-css"> <span class="hljs-selector-tag">html</span> {
   <span class="hljs-attribute">font-family</span>: sans-serif;
   <span class="hljs-attribute">font-size</span>: <span class="hljs-number">12px</span>;
 }

 <span class="hljs-selector-class">.List</span> {
   <span class="hljs-attribute">border</span>: <span class="hljs-number">1px</span> solid <span class="hljs-number">#d9dddd</span>;
 }

 <span class="hljs-selector-class">.ListItemEven</span>,
 <span class="hljs-selector-class">.ListItemOdd</span> {
   <span class="hljs-attribute">display</span>: flex;
   <span class="hljs-attribute">align-items</span>: center;
   <span class="hljs-attribute">justify-content</span>: center;
   <span class="hljs-attribute">height</span>: <span class="hljs-number">35px</span> <span class="hljs-meta">!important</span>;
 }

 <span class="hljs-selector-class">.ListItemEven</span> {
   <span class="hljs-attribute">background-color</span>: <span class="hljs-number">#f8f8f0</span>;
 }

 <span class="hljs-selector-class">.main</span> {
   <span class="hljs-attribute">height</span>: <span class="hljs-number">300px</span> <span class="hljs-meta">!important</span>;
   <span class="hljs-attribute">overflow</span>: scroll <span class="hljs-meta">!important</span>;
 }

 <span class="hljs-selector-class">.main</span> &gt; <span class="hljs-selector-tag">div</span> {
   <span class="hljs-attribute">width</span>: <span class="hljs-number">100%</span> <span class="hljs-meta">!important</span>;
 }
</code></pre>
<pre><code class="lang-javascript"> <span class="hljs-comment">//// Remaining code goes here</span>
 <span class="hljs-keyword">import</span> React, { Profiler, useState } <span class="hljs-keyword">from</span> <span class="hljs-string">"react"</span>;
 <span class="hljs-keyword">import</span> { FixedSizeList <span class="hljs-keyword">as</span> List } <span class="hljs-keyword">from</span> <span class="hljs-string">"react-window"</span>;

 <span class="hljs-keyword">import</span> <span class="hljs-string">"./styles.css"</span>;

 <span class="hljs-keyword">const</span> listData = <span class="hljs-built_in">Array</span>.from(
   { <span class="hljs-attr">length</span>: <span class="hljs-number">10000</span> },
   <span class="hljs-function">(<span class="hljs-params">_, index</span>) =&gt;</span> <span class="hljs-string">`Item <span class="hljs-subst">${index + <span class="hljs-number">1</span>}</span>`</span>,
 );

 <span class="hljs-comment">//// Remaining code goes here</span>
</code></pre>
</li>
<li><p>In the end, you can add this file to the main <code>App.js</code> file.</p>
</li>
<li><p>So, our final output looks something like this.</p>
</li>
<li><div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://codesandbox.io/embed/l7nssj?view=Editor">https://codesandbox.io/embed/l7nssj?view=Editor</a></div>
<p> </p>
</li>
</ol>
<h2 id="heading-observations-from-list-rendering">Observations from List Rendering</h2>
<p>When we observe our Codesandbox example, we will notice a huge difference in rendering time when the list will render using virtualization vs when it does not.</p>
<p><mark>The shocking thing is, that when virtualization is turned on, render time will lower up to ~20x slower!</mark></p>
<p>This happens because, we aren't loading all 10k items at once. It might be the case that the user just cares about the first 20-30 items. This way, we are saving additional rendering costs and thus making our app faster and smoother to use.</p>
<h2 id="heading-virtualization-under-the-hood">Virtualization: Under the hood</h2>
<p>To understand the core of virtualization first, let us understand two types of item/element sizes</p>
<ul>
<li><p>Fixed-Sized items</p>
</li>
<li><p>Variable-sized items</p>
</li>
</ul>
<h3 id="heading-fixed-sized-items">Fixed-Sized Items:</h3>
<p>Fixed-sized items mean that each item in the list has the same height or width. For this type of item, React Window calculates how many items can fit into the viewport based on their size based on their dimensions.</p>
<p>Then, It determines the range of items that are currently visible in the viewport. <mark>Only the items within the visible range are rendered in the DOM.</mark> As the user scrolls, React Window updates the visible range, determining which items should be rendered or removed based on the scroll position.</p>
<p>Finally, <mark>it reuses DOM elements for items that are scrolled out of view</mark> and creates new elements for items that enter the viewport.</p>
<h3 id="heading-variable-sized-items">Variable-Sized Items:</h3>
<p>For variable-sized items, React Window takes a more sophisticated approach by using a measuring strategy.</p>
<p>Instead of assuming a fixed size for each item, <mark>React Window initially renders a subset of items to measure their actual sizes.</mark> This measurement phase determines the height or width of each item. Based on the measured sizes, React Window dynamically calculates the positions and sizes of items in the list.</p>
<p>Finally, React Window determines the range of items that are currently visible in the viewport based on their calculated positions and sizes. Only the items within the visible range are rendered in the DOM. And, similar to fixed-sized items, <mark>React Window reuses DOM elements for the items that are scrolled out of view and it creates new elements for items that enter the viewport.</mark></p>
<p>So..... while the fundamental concept of virtualization and rendering based on visibility remains consistent between fixed-sized and variable-sized items, <mark>the key distinction lies in how the sizes are determined and for fixed-sized items</mark>, the size is known and doesn't change, allowing for a more straightforward calculation of the visible range. In contrast, variable-sized items require an additional step to measure each item's size before dynamically determining their positions.</p>
<h2 id="heading-common-pitfalls">Common Pitfalls:</h2>
<p>While virtualization can greatly improve the performance of rendering large lists or grids, there are some potential pitfalls to be aware of when integrating virtualization into your application:</p>
<ul>
<li><p>Integrating virtualization into an existing codebase might require significant changes to the structure of your components, especially if they rely on direct manipulation of the DOM.</p>
</li>
<li><p>Virtualization may sometimes <mark>introduce visual glitches, especially when the library is trying to calculate and adjust the position of items dynamically.</mark> This can lead to suboptimal user experiences.</p>
</li>
<li><p>Virtualization can struggle when dealing with dynamic content changes, such as frequent updates or additions/removals of items.</p>
</li>
<li><p>While virtualization improves the initial rendering performance, the <mark>scrolling experience might not be perfect,</mark> especially on less powerful devices. Some libraries may have occasional stuttering or latency during scrolling.</p>
</li>
<li><p>It's possible to over-optimize by adding virtualization to components that don't necessarily benefit from it. Assess whether virtualization is genuinely needed for specific parts of your application to avoid unnecessary complexity.</p>
</li>
</ul>
<h2 id="heading-conclusion">Conclusion:</h2>
<p>Virtualization in React presents a game-changing opportunity for front-end developers to optimize performance, improve efficiency, and create seamless user experiences. By implementing Virtualization techniques like virtual lists, virtualized tables, and leveraging third-party libraries, you can achieve remarkable results even with large datasets.</p>
<p>Remember, <mark>Virtualization is not one-size-fits-all;</mark> analyze your requirements, consider the trade-offs, and choose the best technique for your specific scenario.</p>
<p>That is for this blog folks. Keep learning, stay inspired, happy coding, and revel in the boundless possibilities ahead!</p>
]]></content:encoded></item><item><title><![CDATA[Climbing the Developer Ladder: A Deep Dive into React Keys]]></title><description><![CDATA[Welcome to our ultimate guide on becoming a 'key' master in React! 🚀 Whether you're embarking on your React journey or a seasoned developer aiming to supercharge your applications, grasping the 'key' property is the secret sauce for achieving unpara...]]></description><link>https://pranavgoswami.hashnode.dev/climbing-the-developer-ladder-a-deep-dive-into-react-keys</link><guid isPermaLink="true">https://pranavgoswami.hashnode.dev/climbing-the-developer-ladder-a-deep-dive-into-react-keys</guid><category><![CDATA[React]]></category><category><![CDATA[Frontend Development]]></category><category><![CDATA[frontend]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[webdev]]></category><dc:creator><![CDATA[Pranav Goswami]]></dc:creator><pubDate>Sat, 18 Nov 2023 15:49:04 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1700322231108/d16bef59-6a83-4af3-8256-e1cad02b32f9.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Welcome to our ultimate guide on becoming a 'key' master in React! 🚀 Whether you're embarking on your React journey or a seasoned developer aiming to supercharge your applications, grasping the 'key' property is the secret sauce for achieving unparalleled UI control.</p>
<p>You can read the same on my <a target="_blank" href="https://pranavgoswami.medium.com/climbing-the-developer-ladder-a-deep-dive-into-react-keys-ea99ba046e75">Medium</a>.</p>
<h2 id="heading-under-the-hood-how-react-updates-dom"><mark>Under the Hood: How React Updates DOM?</mark></h2>
<p>Imagine React as your personal assistant for managing your to-do list. When you add, complete, or remove a task, React doesn't instantly shuffle the entire list. Instead, it keeps a smart copy of your to-do list in its memory - a virtual list.</p>
<p>Now, when you make a change, like adding a new task or marking one as done, React doesn't immediately rush to your physical list. First, it updates its virtual to-do list, noting down the changes.</p>
<p>React then compares the updated virtual list with the previous one, figuring out precisely what tasks were added, completed, or removed. It doesn't simply rewrite your entire list.</p>
<p>Finally, React optimizes the real to-do list by making only the necessary changes. It's like having a helpful assistant who doesn't make a mess but efficiently updates your list, making sure you stay organized without unnecessary fuss.</p>
<h2 id="heading-understanding-the-basics-of-reacts-key-property"><mark>Understanding the Basics of React's 'Key' Property</mark></h2>
<p>Think of 'key' as a unique ID for React components. Again consider the example of the same to-do list. Each task is like a virtual sticky note, and the 'key' is the tag that helps React keep them organized.</p>
<p>Now, let's say you mark a to-do as 'done' or add a new one. 'Key' steps in and tells React, 'Hey, only focus on what changed.' It's like having a smart helper that keeps your to-do list tidy without redoing the whole thing.</p>
<p>Now, here's the magic behind the scenes: React takes these 'keys' for every to-do and compares the old version with the new one. By identifying the changes based on the 'keys,' React selectively updates only the parts of the DOM (Document Object Model) that need attention. No unnecessary redos, no additional rewrites – just a targeted and efficient update process. It's this thoughtful approach that ensures your React app performs optimally and blazing-fast.</p>
<h2 id="heading-the-role-of-key-in-efficient-rendering"><mark>The Role of 'Key' in Efficient Rendering</mark></h2>
<p>Using the 'key' property efficiently is crucial for optimal rendering in React applications. Without proper implementation of 'key' values, you may encounter performance issues and inconsistent UI rendering.</p>
<p>Consider a scenario where you have a dynamic list component with items that can be added, removed, or reordered. Without using 'key' or with using inappropriate or duplicate 'key' values, React may mistakenly apply changes to the wrong components, leading to unexpected behavior and inefficient rendering. By assigning unique and consistent 'key' values, you allow React to accurately track and update the correct elements, ensuring smooth and efficient rendering.</p>
<h2 id="heading-best-practices-for-implementing-key-in-react-components"><mark>Best Practices for Implementing 'Key' in React Components</mark></h2>
<p>Now that we understand the importance of the 'key' property, let's explore some best practices for implementing it in React components:</p>
<ul>
<li><p><mark>Assign Proper 'Key' Values:</mark> Each 'key' value should have a unique identifier within the component's scope. Using stable and unique identifiers, such as database IDs or unique properties of the item, helps React efficiently track and update components.</p>
</li>
<li><p><mark>Choose Appropriate 'Key' Values:</mark> When selecting 'key' values, consider the context and purpose of the component. Ideally, 'key' values should remain consistent across component updates unless a specific change requires a new 'key'. It's generally recommended to avoid using indexes as 'key' values, as they can cause issues during component reordering or filtering operations.</p>
</li>
<li><p><mark>Follow the Parent-Child Relationship:</mark> When rendering dynamic lists or nested components, make sure the 'key' values are unique within the parent scope. If multiple levels of nesting are involved, the 'key' values should incorporate the entire parent-child relationship to maintain uniqueness.</p>
</li>
</ul>
<h2 id="heading-common-pitfalls-and-troubleshooting-with-key"><mark>Common Pitfalls and Troubleshooting with 'Key'</mark></h2>
<p>Let's explore an example that illustrates how bugs can arise when keys are not assigned correctly.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> UserList = <span class="hljs-function">(<span class="hljs-params">{ users }</span>) =&gt;</span> {
  <span class="hljs-keyword">return</span> (
    <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">ul</span>&gt;</span>
      {users.map(user =&gt; (
        <span class="hljs-tag">&lt;<span class="hljs-name">li</span> <span class="hljs-attr">key</span>=<span class="hljs-string">{user.id}</span>&gt;</span>{user.name}<span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
      ))}
    <span class="hljs-tag">&lt;/<span class="hljs-name">ul</span>&gt;</span></span>
  );
};

<span class="hljs-keyword">const</span> App = <span class="hljs-function">() =&gt;</span> {
  <span class="hljs-keyword">const</span> userList = [
    { <span class="hljs-attr">id</span>: <span class="hljs-number">1</span>, <span class="hljs-attr">name</span>: <span class="hljs-string">'Alice'</span> },
    { <span class="hljs-attr">id</span>: <span class="hljs-number">2</span>, <span class="hljs-attr">name</span>: <span class="hljs-string">'Bob'</span> },
    { <span class="hljs-attr">id</span>: <span class="hljs-number">3</span>, <span class="hljs-attr">name</span>: <span class="hljs-string">'Charlie'</span> },
    { <span class="hljs-attr">id</span>: <span class="hljs-number">1</span>, <span class="hljs-attr">name</span>: <span class="hljs-string">'David'</span> }, <span class="hljs-comment">// Duplicate key with the first user</span>
  ];

  <span class="hljs-keyword">return</span> <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">UserList</span> <span class="hljs-attr">users</span>=<span class="hljs-string">{userList}</span> /&gt;</span></span>;
};
</code></pre>
<p>In this example, the <code>userList</code> array contains a user with the same <code>id</code> (1) as the first user. This leads to duplicate keys when rendering the <code>UserList</code> component.</p>
<p>This can result in unpredictable behavior, such as incorrect updates, re-renders, or even rendering errors. To avoid such issues, <mark>it's crucial to ensure that keys are unique within the scope of their parent component</mark>. In this case, each <a target="_blank" href="http://user.id"><code>user.id</code></a> should be unique across all users in the <code>UserList</code>.</p>
<ul>
<li><p><strong><mark>Forgetting to Assign 'Key' Properly:</mark></strong> One common mistake is neglecting to add the 'key' property altogether or forgetting to assign it within components that require it. Always double-check your code to ensure the 'key' is correctly implemented where necessary.</p>
</li>
<li><p><strong><mark>Using Inappropriate or Duplicate 'Key' Values:</mark></strong> Incorrect 'key' values, such as using non-unique or unstable identifiers, can lead to unexpected rendering behavior. Additionally, using duplicate 'key' values within the same list can cause errors and hinder React's ability to reconcile and update components correctly.</p>
</li>
<li><p><strong><mark>Troubleshooting Duplicate Key Warnings:</mark></strong> If you encounter a "Warning: Encountered two children with the same 'key'" message, it means there is a duplicate 'key' value within your component. Inspect your code and make sure 'key' values are unique for each component, resolving any duplicates or inconsistencies.</p>
</li>
</ul>
<p>Remember, debugging is an integral part of development, and keeping these common pitfalls and troubleshooting tips in mind will help you overcome 'key' related issues more efficiently.</p>
<h2 id="heading-conclusion"><mark>Conclusion:</mark></h2>
<p>So, now that you're in the know about the 'key' property in React, you're all set! We've covered why it's crucial for smooth rendering, the best ways to use it, and even tackled some troubleshooting. Stick to those best practices, troubleshoot like a pro, and dive into those advanced moves.</p>
<p>I truly hope you've gained some valuable insights from this discussion. If there's anything you'd like to contribute or discuss further, don't hesitate to drop a comment below.</p>
<p>Last but certainly not least, a big thank you for staying engaged. Best of luck on your ongoing React journey! 💖</p>
]]></content:encoded></item><item><title><![CDATA[Tiny Habits, Big Results: The Atomic Approach]]></title><description><![CDATA[Hey there, fellow human beings! Let's take a moment to reflect on our general behavior. We all have those moments when we find ourselves binge-watching TV shows, scrolling endlessly through social media, or procrastinating on the tasks that truly mat...]]></description><link>https://pranavgoswami.hashnode.dev/atomic-habits-book-summary</link><guid isPermaLink="true">https://pranavgoswami.hashnode.dev/atomic-habits-book-summary</guid><category><![CDATA[book summary]]></category><category><![CDATA[books]]></category><category><![CDATA[book review]]></category><category><![CDATA[self-improvement ]]></category><category><![CDATA[Self Improvement ]]></category><dc:creator><![CDATA[Pranav Goswami]]></dc:creator><pubDate>Tue, 31 Oct 2023 05:06:13 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1698729602717/9e7c626f-9245-4e51-b28d-ece9968c3507.webp" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hey there, fellow human beings! Let's take a moment to reflect on our general behavior. We all have those moments when we find ourselves binge-watching TV shows, scrolling endlessly through social media, or procrastinating on the tasks that truly matter. We're all guilty of falling into the trap of unproductivity from time to time.</p>
<p>Now it's time to break the cycle! Today, we'll dive into habit structuring with "Atomic Habits". This book by James Clear reveals the power of small actions and lasting change.</p>
<h1 id="heading-1-why-do-we-keep-putting-things-off"><strong><mark>1. Why Do We Keep Putting Things Off?</mark></strong></h1>
<p>Ah, procrastination, that tricky habit we all struggle with. Let us see some reasons why we fall into its trap again and again, as by understanding why we procrastinate, we can start breaking free from its grip. With this knowledge, we can develop effective strategies to overcome procrastination and regain control over our actions.</p>
<h3 id="heading-the-comfort-zone-conundrum"><strong><mark>The Comfort Zone Conundrum:</mark></strong></h3>
<p>One big reason we procrastinate is because we love staying in our comfort zone. It feels safe and cozy while stepping out of it requires effort and might make us uncomfortable.</p>
<h3 id="heading-instant-gratification-temptations"><strong><mark>Instant Gratification Temptations:</mark></strong></h3>
<p>Procrastination loves instant gratification. Why does something today when we can easily put it off until tomorrow? Our brains naturally seek immediate rewards, making it hard to resist distractions like social media, binge-watching shows, or mindlessly scrolling through funny videos.</p>
<h3 id="heading-analysis-paralysis"><strong><mark>Analysis Paralysis:</mark></strong></h3>
<p>Another reason for procrastination is overthinking and analyzing things too much. We get stuck in trying to plan every step perfectly and become afraid of making mistakes. This can lead to "analysis paralysis," where we're so overwhelmed by options and potential outcomes that we struggle to take any action.</p>
<h3 id="heading-lack-of-clarity-and-motivation"><strong><mark>Lack of Clarity and Motivation:</mark></strong></h3>
<p>When we're not clear about our goals or why we're doing certain tasks, it's hard to find the motivation to get started. We'll talk about the importance of setting clear goals and understanding the reasons behind our actions. By connecting with our inner motivations and aligning them with our tasks, we can find the drive to overcome procrastination and take meaningful steps forward.</p>
<h3 id="heading-perfectionism-and-fear-of-failure"><strong><mark>Perfectionism and Fear of Failure:</mark></strong></h3>
<p>Perfectionism, with its high standards and fear of failure, often leads to procrastination. We hesitate to start a task if we can't guarantee doing it perfectly, so we postpone or avoid it altogether. We'll explore the negative effects of perfectionism and the fear of failure, and provide strategies to embrace imperfection, see failure as a chance to learn, and move forward with courage.</p>
<h1 id="heading-2-counting-the-cost-the-price-you-pay-for-procrastination"><mark>2. Counting the Cost: The Price You Pay for Procrastination</mark></h1>
<p>This fine art of putting things off until the last possible moment may seem harmless or with not-so-much harm, but it comes at a cost. Let us see the consequences of our procrastination tendencies.</p>
<h3 id="heading-1-lost-productivity"><strong>1. Lost Productivity:</strong></h3>
<p>When we procrastinate, we waste valuable time that could have been used productively. Instead of making progress on important tasks, we find ourselves caught up in unproductive activities or simply doing nothing at all. This leads to a significant loss of productivity, leaving us feeling frustrated and overwhelmed by mounting to-do lists.</p>
<h3 id="heading-2-missed-deadlines"><strong>2. Missed Deadlines:</strong></h3>
<p>Procrastination often results in missed deadlines. We delay tasks until the last minute, leaving little time for quality work or unexpected challenges. As a result, we may submit subpar work or even fail to meet our obligations entirely. This can damage our reputation, cause stress, and create a cycle of playing catch-up.</p>
<h3 id="heading-3-increased-stress"><strong>3. Increased Stress:</strong></h3>
<p>Procrastination is a notorious stress amplifier. As we put off tasks, deadlines loom larger, and the pressure intensifies. The constant worry of impending deadlines and unfinished work can take a toll on our mental and emotional well-being. It creates unnecessary stress and anxiety, robbing us of peace of mind and hindering our ability to perform at our best.</p>
<h3 id="heading-4-diminished-self-esteem"><strong>4. Diminished Self-Esteem:</strong></h3>
<p>Repeatedly procrastinating erodes our self-esteem. We start to doubt our abilities and feel guilty for not taking action when we know we should. The cycle of delay can chip away at our confidence, leaving us feeling stuck and incapable of achieving our goals. This further fuels the procrastination cycle, trapping us in a negative spiral.</p>
<h3 id="heading-5-missed-opportunities-for-growth"><strong>5. Missed Opportunities for Growth:</strong></h3>
<p>Procrastination prevents us from seizing opportunities for growth and personal development. When we delay important tasks or avoid challenging projects, we miss out on valuable learning experiences. We deny ourselves the chance to acquire new skills, expand our knowledge, and reach our full potential.</p>
<h1 id="heading-3-mastering-the-art-of-productivity"><strong><mark>3. Mastering the Art of Productivity</mark></strong></h1>
<p>Now that we've explored the reasons behind procrastination and the costs it incurs, it's time to equip ourselves with effective strategies to conquer it. In this section, we'll dive into practical techniques that will help us break free from the grip of procrastination and regain control over our actions.</p>
<h3 id="heading-time-management"><strong><mark>Time Management:</mark></strong></h3>
<p>Effective time management is crucial in combating procrastination. By planning and organizing our tasks, we can allocate dedicated time slots for specific activities. Breaking larger tasks into smaller, manageable chunks helps prevent overwhelm and makes them more approachable. Creating a schedule or using productivity tools can provide structure and keep us on track.</p>
<h3 id="heading-lets-examine-a-practical-scenario-to-better-understand"><strong>Let's examine a practical scenario to better understand.</strong></h3>
<ul>
<li><p>Sarah, a diligent student, found herself buried under a daunting pile of assignments, causing overwhelming stress and anxiety. Determined to tame the procrastination beast, she devised a strategic plan to regain control of her workload.</p>
</li>
<li><p>First, she broke down her assignments into smaller, manageable tasks. By dissecting the mountainous workload, she no longer felt overwhelmed and gained a clearer understanding of what needed to be done.</p>
</li>
<li><p>Next, she created a well-structured schedule, carefully allocating specific time slots for each task. This allowed her to prioritize effectively and eliminate the ambiguity surrounding her assignments. With a detailed roadmap in place, Sarah could tackle her work in an organized and efficient manner.</p>
</li>
<li><p>To stay motivated, Sarah introduced a system of rewards. <mark>For every completed task or significant milestone reached, she rewarded herself with short breaks to engage in enjoyable activities</mark>, such as reading a chapter of her favorite book or taking a walk outside. These small rewards provided her with a sense of accomplishment and a well-deserved break, revitalizing her energy for the next task.</p>
</li>
<li><p>As Sarah diligently worked through her schedule, she celebrated each completed task by checking them off her list. This visual representation of progress served as a powerful reminder of her productivity and fueled her determination to continue overcoming procrastination.</p>
</li>
<li><p>With this new approach, she experienced reduced stress levels and improved time management skills. The act of breaking down tasks and setting specific deadlines allowed her to complete assignments more efficiently, resulting in higher-quality work.</p>
</li>
</ul>
<h3 id="heading-goal-setting"><strong><mark>Goal Setting:</mark></strong></h3>
<p>Clear and specific goals serve as a powerful antidote to procrastination. When we have a defined target in mind, we're more motivated to take action. Set realistic and achievable goals, both short-term and long-term. Break them down into actionable steps and track your progress. Celebrate small victories along the way to maintain momentum.</p>
<p>John was an ambitious entrepreneur who had grand aspirations but struggled with procrastination. Determined to overcome this hurdle, John embarked on a journey to transform his dreams into reality. He knew that setting clear, specific goals for his business venture would be key to his success.</p>
<h3 id="heading-lets-analyze-johns-case-to-illustrate-the-point"><strong>Let's analyze John's case to illustrate the point.</strong></h3>
<ul>
<li><p>To start, John meticulously defined his goals, leaving no room for ambiguity. He outlined the specific outcomes he wanted to achieve, such as launching a website, securing funding, and acquiring a certain number of customers. This clarity provided him with a renewed sense of purpose and direction.</p>
</li>
<li><p>Next, <mark>John took his goals and broke them down into smaller, actionable steps.</mark> By doing so, he transformed his objectives into a series of manageable tasks. This approach allowed him to prioritize effectively and focus on one task at a time, preventing him from feeling overwhelmed.</p>
</li>
<li><p>As John progressed through each step, he measured his progress and celebrated the milestones achieved. Whether it was completing market research, designing a prototype, or drafting a business plan, he recognized and acknowledged his accomplishments. Each milestone reached served as a source of motivation and a reminder of his commitment to overcoming procrastination.</p>
</li>
<li><p>With each small victory, John's determination and resolve grew stronger. The satisfaction of seeing his dreams take shape fueled his motivation to push through moments of doubt and resistance. By staying focused on his goals and consistently taking action, John gained momentum, inching closer to his entrepreneurial aspirations.</p>
</li>
</ul>
<h3 id="heading-creating-accountability"><strong><mark>Creating Accountability:</mark></strong></h3>
<p>Accountability can be a powerful tool in overcoming procrastination. Share your goals and deadlines with someone you trust, whether it's a friend, colleague, or mentor. This external accountability can provide the extra push needed to stay committed and follow through on your commitments. Alternatively, you can join an accountability group or use online tools that facilitate goal tracking and progress sharing.</p>
<p>Jane is a talented freelance writer who struggled with the persistent issue of procrastination. Frustrated by her inability to stay focused and meet deadlines, she sought a solution and discovered the power of accountability.</p>
<h3 id="heading-lets-investigate-the-steps-taken-by-jane"><strong>Let's investigate the steps taken by Jane</strong></h3>
<ul>
<li><p>To tackle her procrastination head-on, Jane decided to partner with a fellow writer who was also looking to overcome similar challenges. Together, they established a structured system of regular check-in meetings.</p>
</li>
<li><p>During these check-in meetings, Jane and her writing partner openly discussed their goals and tasks. They shared their progress, setbacks, and any obstacles they encountered along the way. By holding each other accountable, they created a supportive and encouraging environment that fostered growth and productivity.</p>
</li>
<li><p>This external support system proved to be a game-changer for Jane. Knowing that she had a check-in meeting scheduled with her writing partner motivated her to stay focused and make progress on her assignments. It provided an extra push to overcome the allure of procrastination and stay committed to meeting her deadlines.</p>
</li>
<li><p>Beyond accountability, the partnership with her fellow writer offered additional benefits. They could exchange ideas, provide feedback on each other's work, and offer support during challenging times. This collaboration not only enhanced their productivity but also fostered a sense of camaraderie and shared growth.</p>
</li>
<li><p>Through regular check-ins and the support of her writing partner, Jane gradually broke free from her procrastination habits. She began to develop better time management skills, prioritize her tasks effectively, and maintain a consistent workflow.</p>
</li>
<li><p>As a result, Jane experienced a significant improvement in her productivity and overall work satisfaction. She no longer felt overwhelmed by her workload or paralyzed by procrastination. Instead, she felt empowered, motivated, and in control of her writing projects.</p>
</li>
</ul>
<h3 id="heading-overcoming-perfectionism"><strong><mark>Overcoming Perfectionism:</mark></strong></h3>
<p>Perfectionism often fuels procrastination. Recognize that perfection is unattainable and that mistakes are part of the learning process. Embrace a mindset of progress over perfection. Start by taking small steps and focus on completing tasks rather than obsessing over flawless outcomes. Give yourself permission to make mistakes and learn from them.</p>
<p>Allow me to introduce Mark, an individual with a perfectionist mindset that often left him paralyzed by the fear of not meeting impossibly high standards. Mark found himself constantly waiting for the perfect moment to take action, resulting in endless delays and missed opportunities.</p>
<h3 id="heading-how-did-mark-get-over-it"><strong>How did Mark get over it?</strong></h3>
<ul>
<li><p>Mark had a revelation. He realized that waiting for perfection was an unrealistic expectation that hindered his progress. He understood that taking imperfect action was far better than waiting indefinitely for the ideal circumstances that may never come. So, he decided to adopt a "progress over perfection" mindset. He shifted his focus from achieving flawlessness to making continuous progress.</p>
</li>
<li><p>Embracing the concept of iterative improvement, Mark started taking imperfect action. <mark>He understood that every step he took, no matter how small or imperfect, would bring him closer to his goals.</mark> He allowed himself to make mistakes, knowing that they were valuable learning opportunities.</p>
</li>
<li><p>By embracing imperfection, Mark began to make tangible progress. He realized that taking imperfect action and learning from his mistakes propelled him forward more effectively than endlessly waiting for flawless conditions. With each attempt, he honed his skills, gained experience, and grew more confident in his abilities.</p>
</li>
<li><p>Mark's shift in mindset not only accelerated his progress but also liberated him from the shackles of perfectionism. He experienced a newfound freedom to explore, experiment, and innovate without the constant pressure to achieve unattainable perfection.</p>
</li>
</ul>
<h3 id="heading-utilizing-positive-reinforcement"><strong><mark>Utilizing Positive Reinforcement:</mark></strong></h3>
<p>Rewarding yourself for completing tasks can help reinforce positive behaviors and combat procrastination. Create a system of rewards that aligns with your personal preferences. It could be enjoying a favorite snack, taking a short break, or treating yourself to a leisure activity. Celebrating small wins encourages a sense of accomplishment and motivates you to keep going.</p>
<p>Meet Emily, a dedicated professional who found herself struggling with distractions and procrastination while working from home. Determined to overcome these challenges, she decided to implement a reward system to boost her productivity.</p>
<h3 id="heading-lets-analyze-emilys-case-to-illustrate-the-point"><strong>Let's analyze Emily's case to illustrate the point.</strong></h3>
<ul>
<li><p>Emily after struggling with distractions and procrastination, recognized the importance of positive reinforcement in shaping behavior. She realized that by associating productivity with enjoyment, she could create a stronger motivation to stay focused and complete her tasks.</p>
</li>
<li><p>She recognized the importance of positive reinforcement in shaping behavior. She realized that by associating productivity with enjoyment, she could create a stronger motivation to stay focused and complete her tasks.</p>
</li>
<li><p>To implement her reward system, <mark>Emily set specific goals and milestones for each task she needed to accomplish. These goals were realistic and achievable, allowing her to make progress without feeling overwhelmed.</mark> For every completed task, she rewarded herself with a short break or indulged in a favorite activity.</p>
</li>
<li><p>These rewards served as a source of motivation and enjoyment. She understood that these breaks or enjoyable activities were well-deserved treats for her hard work and efforts. They provided a refreshing break from work and gave her something to look forward to after completing her tasks.</p>
</li>
<li><p>Over time, Emily noticed a positive shift in her work habits. The reward system not only helped Emily combat procrastination but also boosted her overall productivity. She experienced a sense of fulfillment and accomplishment as she consistently met her goals and earned her well-deserved rewards.</p>
</li>
</ul>
<h3 id="heading-removing-distractions"><strong><mark>Removing Distractions:</mark></strong></h3>
<p>Identify and minimize distractions that pull you away from important tasks. Put your phone on silent or in another room, block distracting websites, or use productivity apps that limit access to time-wasting platforms. Create a conducive work environment, free from clutter and unnecessary disruptions. By reducing distractions, you can enhance focus and productivity.</p>
<p>Let's delve into the story of Alex, a diligent student preparing for upcoming exams but struggling with constant distractions from social media. Recognizing the detrimental impact of these distractions on his productivity, he made a firm decision to take control of his environment.</p>
<h3 id="heading-lets-examine-a-practical-case-study-of-alex-to-gain-practical-insights"><strong>Let's examine a practical case study of Alex to gain practical insights</strong></h3>
<ul>
<li><p>To combat the allure of social media, Alex employed the use of website blockers. These software tools allowed him to block access to specific websites or limit his time spent on them during designated study periods. By implementing this proactive measure, he created a digital barrier that helped him resist the temptation to mindlessly scroll through social media platforms.</p>
</li>
<li><p>In addition to website blockers, Alex took the extra step of turning off notifications on his devices. By disabling these notifications, Alex eliminated potential triggers that could pull him away from his study materials.</p>
</li>
<li><p>Creating a distraction-free environment was crucial for his productivity. <mark>He organized his study space in a way that minimized potential distractions.</mark> He put away his phone or placed it in a different room, out of sight and out of reach. He ensured that his workspace was clutter-free and free from any non-essential items that might divert his attention.</p>
</li>
<li><p>These deliberate actions to eliminate distractions allowed him to immerse himself fully in his study sessions. By removing the accessibility and constant allure of social media, he created an environment that was conducive to focused work.</p>
</li>
<li><p>As a result, by taking control of his digital environment and removing temptations, he gained a sense of empowerment and regained control over his study habits.</p>
</li>
</ul>
<h3 id="heading-cultivating-a-growth-mindset"><strong><mark>Cultivating a Growth Mindset:</mark></strong></h3>
<p>Adopting a growth mindset can transform your relationship with procrastination. Embrace challenges as opportunities for growth rather than sources of fear. View setbacks as learning experiences and maintain a positive attitude toward self-improvement. Emphasize the progress you've made rather than dwelling on past procrastination habits. By nurturing a growth mindset, you'll develop resilience and a willingness to take action.</p>
<p>Let's delve into the story of Anna, a talented artist who grapples with self-doubt and a fear of failure. These negative emotions often held her back from fully expressing herself and exploring her artistic potential. However, Anna embarked on a transformative journey by adopting a growth mindset.</p>
<h3 id="heading-lets-take-a-look-at-annas-approach-and-see-how-it-was-done"><strong>Let's take a look at Anna's approach and see how it was done.</strong></h3>
<ul>
<li><p>Anna recognized that her fear of making mistakes and not being good enough hindered her progress as an artist. To overcome this, she shifted her perspective. Instead of viewing mistakes as failures, she began to see them as valuable opportunities for growth and learning.</p>
</li>
<li><p>With her newfound mindset, she approached her artistic endeavors with curiosity and a willingness to learn from every experience. She embraced the idea that progress comes through trial and error.</p>
</li>
<li><p>When Anna encountered setbacks or made mistakes, she reframed them as stepping stones on her artistic journey. She sought to understand what went wrong and used those insights to improve and refine her work. <mark>She realized that failure was not a reflection of her worth as an artist but rather a natural part of the learning process.</mark></p>
</li>
<li><p>By embracing a growth mindset, her confidence grew. She no longer allowed self-doubt to paralyze her creativity. Instead, she approached her art with a sense of resilience and perseverance, viewing challenges as opportunities for personal and artistic development.</p>
</li>
<li><p>The shift in mindset propelled Anna forward. She became more willing to take risks, experiment with different techniques, and explore new artistic styles. With each creative endeavor, she gained valuable experience and honed her skills, ultimately elevating her artistic abilities to new heights.</p>
</li>
</ul>
<h1 id="heading-summary"><strong><mark>Summary</mark></strong></h1>
<p>After exploring these strategies to overcome procrastination it's time to wrap it all up and delve into the summary. Let's recap the key insights and takeaways that will guide you on your journey to a procrastination-free life.</p>
<ul>
<li><p><mark>Goal Setting:</mark> Set clear, specific goals, break them into actionable steps, and track progress to stay motivated.</p>
</li>
<li><p><mark>Creating Accountability:</mark> Share goals and deadlines with others, join accountability groups or use online tools for support.</p>
</li>
<li><p><mark>Overcoming Perfectionism:</mark> Embrace progress over perfection, take imperfect action, and learn from mistakes.</p>
</li>
<li><p><mark>Utilizing Positive Reinforcement:</mark> Reward yourself for completing tasks to reinforce positive behaviors and boost motivation.</p>
</li>
<li><p><mark>Removing Distractions:</mark> Identify and minimize distractions to enhance focus and productivity.</p>
</li>
<li><p><mark>Cultivating a Growth Mindset:</mark> Embrace challenges, view setbacks as learning opportunities, and focus on progress and self-improvement.</p>
</li>
</ul>
<p>And with that, it's time to bid farewell to all you wonderful readers. I hope this blog has equipped you with valuable knowledge. Remember, overcoming procrastination requires consistent effort and a commitment to personal growth. Embrace the power of atomic habits, stay focused, and watch as your life transforms, one small habit at a time. For now, goodbye and happy habit-building!</p>
]]></content:encoded></item><item><title><![CDATA[Finding Beauty Everywhere: The Busker's Story]]></title><description><![CDATA[In a world filled with constant hustle and bustle, it's easy to overlook the extraordinary moments and hidden gems that surround us. We often rush through life, consumed by our daily routines and obligations, unknowingly missing out on the remarkable...]]></description><link>https://pranavgoswami.hashnode.dev/finding-beauty-everywhere-the-buskers-story</link><guid isPermaLink="true">https://pranavgoswami.hashnode.dev/finding-beauty-everywhere-the-buskers-story</guid><category><![CDATA[self-improvement ]]></category><category><![CDATA[storytelling]]></category><dc:creator><![CDATA[Pranav Goswami]]></dc:creator><pubDate>Mon, 23 Oct 2023 15:18:31 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1698073938600/f576d5fb-a951-4fbe-8c1c-7af9af7d9e4e.webp" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In a world filled with constant hustle and bustle, it's easy to overlook the extraordinary moments and hidden gems that surround us. We often rush through life, consumed by our daily routines and obligations, unknowingly missing out on the remarkable beauty that lies just beneath the surface. But what if we could shift our perspective, slow down our pace, and open our eyes to the wonders that unfold before us?</p>
<p>This blog is an invitation to reframe our perspective, to cultivate a sense of mindfulness. Let us start this with a story.</p>
<h1 id="heading-symphony-of-the-streets-the-busker-and-his-unnoticed-melodies"><strong>Symphony of the Streets: <mark>The Busker and His Unnoticed Melodies</mark></strong></h1>
<p>Once upon a time, a street performer, dressed in regular clothes and a simple cap, was playing a violin with extraordinary skill.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1698072871831/5fead3da-5dad-4740-9acb-0d986c0ece0f.webp" alt class="image--center mx-auto" /></p>
<p>As the busker played his violin, the most incredible music filled the air. Every note was like magic, <mark>crafted by someone with extraordinary talent.</mark> However, most people passing by didn't even notice. It was as if they couldn't hear the amazing music at all. It's quite funny, isn't it? The suspense grew as person after person walked by, completely unaware of the breathtaking performance happening right in front of them.</p>
<p>Now, here's the surprising part. The violin the busker was playing wasn't just any ordinary violin. It was incredibly valuable, worth a lot of money. Musicians and collectors would do anything to have it. But the people in the street had no idea about its worth. <mark>Surprisingly, out of the 1097 people who walked past, very few noticed his talent or connected with the music.</mark> They seemed unaware of the beauty unfolding before them. By the end, the busker had collected just over $30 in his cap, a modest amount for a street performer.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1698072975436/e938b34f-0b13-43f2-a656-54db7e4df9c6.webp" alt class="image--center mx-auto" /></p>
<h1 id="heading-the-irony"><strong><mark>The IRONY:</mark></strong></h1>
<h4 id="heading-believe-it-or-not-but-the-fascinating-thing-was-that-just-a-week-before-the-same-busker-sold-out-an-arena-for-dollar100-per-seat"><strong>Believe it or not, but the fascinating thing was that just a week before, <mark>the same busker sold out an arena for $100 per seat!</mark></strong></h4>
<p>This was actually a social experiment conducted by the <mark>Washington Post</mark> which shows how easily we overlook the extraordinary when it is not presented in a certain way. Now the real questions are,</p>
<ul>
<li><p>Do we miss beauty when we see it unexpectedly?</p>
</li>
<li><p>Are we not able to observe beauty, observe talent?</p>
</li>
<li><p>Is it that we miss the most amazing things in the world just because we don't see them on television or they're not presented to us in a certain format or in a certain package or in a certain box?</p>
</li>
</ul>
<h1 id="heading-embracing-the-beauty-in-the-ordinary"><strong><mark>Embracing the Beauty in the Ordinary:</mark></strong></h1>
<p>This fascinating experiment prompted us to reflect on whether we miss out on beauty when <mark>it comes to us unexpectedly.</mark> We often overlook the <mark>sparks of brilliance</mark> that surround us, We miss the <mark>joys of nature</mark>, we miss the <mark>blooming of flowers</mark>. We miss all of these sensations.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1698073168268/62b57db8-b5fc-467c-bc80-80979d9a6ff8.webp" alt class="image--center mx-auto" /></p>
<p>Reducing our pace of life doesn't mean becoming slower or less ambitious. It actually means that we take out more time to <mark>regenerate, rejuvenate and re-energize</mark> ourselves.</p>
<p>The <mark>truth is everything has beauty, everything has life, everything has energy,</mark> but we just don't have the eyes to see it. We don't have the eyes to perceive it. We don't have the eyes to appreciate it, but we can have those. We can actually develop insight.</p>
<p>We can actually develop new ways of looking at things simply by becoming more attentive, simply by becoming more mindful, simply by becoming better observers of reality rather than and participants.</p>
<p>To truly perceive the world's beauty, we must cultivate insight and learn to observe reality in new ways. By practicing <mark>attentiveness and mindfulness,</mark> we can uncover the hidden treasures that often go unnoticed. Every moment, no matter how ordinary, holds its own unique energy and significance. By opening our hearts and minds, we can develop a new appreciation for the world around us and discover beauty in unexpected places.</p>
<h1 id="heading-conclusion"><strong><mark>Conclusion:</mark></strong></h1>
<p>The story of the busker outside the Washington, DC metro station reminds us to pause and take notice of the hidden beauty that surrounds us daily. Let us slow down, embrace the present moment, and cultivate an appreciation for the simple joys and wonders of life, as sometimes <mark>the most amazing things are right in front of us, waiting for us to notice and appreciate them!</mark></p>
]]></content:encoded></item></channel></rss>