<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: harjas816</title>
    <description>The latest articles on Forem by harjas816 (@harjas816).</description>
    <link>https://forem.com/harjas816</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1115282%2F4c2cc988-9410-4c44-91e0-89feedd18106.png</url>
      <title>Forem: harjas816</title>
      <link>https://forem.com/harjas816</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/harjas816"/>
    <language>en</language>
    <item>
      <title>Navigating React Applications with useNavigate() Hook</title>
      <dc:creator>harjas816</dc:creator>
      <pubDate>Thu, 31 Aug 2023 23:14:22 +0000</pubDate>
      <link>https://forem.com/harjas816/navigating-react-applications-with-usenavigate-hook-1k94</link>
      <guid>https://forem.com/harjas816/navigating-react-applications-with-usenavigate-hook-1k94</guid>
      <description>&lt;p&gt;Routing is a fundamental aspect of web applications that enables users to move between different views or pages without the need for a full page refresh. In a React application, managing routing used to involve using external libraries or higher-order components. However, with the introduction of React Router v6, the useNavigate() hook was born, offering a more elegant and intuitive approach to navigation.&lt;/p&gt;

&lt;p&gt;The useNavigate() hook is essentially a function that allows you to programmatically navigate between different routes within your application. Unlike the more familiar useHistory() hook, useNavigate() provides a declarative way to trigger navigation without accessing the history object directly.&lt;/p&gt;

&lt;p&gt;By using useNavigate(), you can streamline your code and make it more readable. Instead of dealing with complex history manipulations, you can focus on expressing the intent of navigation directly in your code. This hook abstracts away some of the underlying complexity while providing a clean and efficient method of handling navigation.&lt;/p&gt;

&lt;h1&gt;
  
  
  The Uses:
&lt;/h1&gt;

&lt;p&gt;There are many ways to incorporate useNavigate into your React applications. The following are a few key examples of where it would be used in a typical application.&lt;/p&gt;

&lt;p&gt;Button Click Navigation: Imagine you have a button that, when clicked, should take the user to a different page. By using useNavigate(), you can trigger the navigation action directly from the button's click handler. &lt;/p&gt;

&lt;p&gt;Form Submission Redirection: After a successful form submission, you might want to redirect the user to a confirmation page. With useNavigate(), you can easily achieve this by invoking the hook once the form submission is complete, guiding the user to the desired route.&lt;/p&gt;

&lt;p&gt;Conditional Navigation: In some scenarios, you might need to navigate based on certain conditions. The useNavigate() hook can be used within conditional statements to guide users to different routes based on their interactions or the data they've provided.&lt;/p&gt;

&lt;p&gt;Programmatic Redirects: Sometimes, you might want to redirect users programmatically based on the application's logic, such as authentication status or user roles. useNavigate() makes this process straightforward, enabling you to manage redirections seamlessly.&lt;/p&gt;

&lt;p&gt;Navigation in Custom Hooks: If you're building custom hooks that require navigation, integrating useNavigate() can simplify your hook's interface and enhance its usability.&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;We can see just how powerful useNavigate is in React Router v6. Our websites can be made infinitely more dynamic with it. In an ever evolving tech world, we must be able to make sights that feel intuitive and responsive, and useNavigate is a key function for that purpose. &lt;/p&gt;

</description>
    </item>
    <item>
      <title>The Vital Role of Taking Breaks While Coding</title>
      <dc:creator>harjas816</dc:creator>
      <pubDate>Thu, 31 Aug 2023 22:55:53 +0000</pubDate>
      <link>https://forem.com/harjas816/the-vital-role-of-taking-breaks-while-coding-4ooh</link>
      <guid>https://forem.com/harjas816/the-vital-role-of-taking-breaks-while-coding-4ooh</guid>
      <description>&lt;p&gt;Intro:&lt;br&gt;
In the world of programming, where lines of code transform into dynamic applications and innovative solutions, the importance of maintaining a steady workflow often takes center stage. However, amidst the pursuit of mastering algorithms and crafting efficient code, an often underestimated practice stands as a pillar of productivity and well-being – taking breaks. In this blog post, we'll delve into why taking breaks is crucial during coding sessions and how it can profoundly impact your productivity, creativity, and overall health.&lt;/p&gt;

&lt;h1&gt;
  
  
  Part 1: What does the Science Say?
&lt;/h1&gt;

&lt;p&gt;Mental Fatigue and Cognitive Load&lt;br&gt;
Coding is a mentally intensive activity that demands intense focus, analytical thinking, and creative problem-solving. Extended periods of concentration can lead to mental fatigue, which in turn diminishes your cognitive capabilities. This phenomenon, known as "cognitive load," can lead to errors, reduced code quality, and increased frustration. Regular breaks counteract this effect by allowing your brain to recharge and reset, ultimately improving your cognitive performance.&lt;/p&gt;

&lt;p&gt;The Role of the Default Mode Network&lt;br&gt;
The brain operates through various networks, including the "task-positive network" used during focused tasks and the "default mode network" (DMN) activated during daydreaming or mind-wandering. Research shows that the DMN is vital for creativity, idea generation, and connecting seemingly unrelated concepts. Taking breaks encourages the activation of the DMN, enabling you to approach problems from fresh perspectives and foster innovative solutions.&lt;/p&gt;

&lt;h1&gt;
  
  
  Part 2: Benefits of Taking Breaks While Coding
&lt;/h1&gt;

&lt;p&gt;Enhanced Productivity&lt;br&gt;
Contrary to the belief that constant coding leads to higher productivity, working without breaks can result in diminishing returns. Regular breaks prevent burnout and boost productivity by maintaining a consistent level of focus and engagement. A refreshed mind processes information more efficiently, leading to faster problem-solving and higher-quality code.&lt;/p&gt;

&lt;p&gt;Creativity and Problem Solving&lt;br&gt;
Taking breaks encourages "incubation periods," during which your subconscious mind continues to process complex issues even when you're not actively thinking about them. Have you ever had a breakthrough insight while taking a walk or a shower? These moments of clarity are often the result of your brain's behind-the-scenes work during breaks. Embracing breaks nurtures creative thinking and enables you to tackle coding challenges with newfound clarity.&lt;/p&gt;

&lt;p&gt;Physical and Mental Well-being&lt;br&gt;
Sitting for prolonged periods can have adverse effects on your physical health, from poor posture to increased risk of cardiovascular issues. Taking breaks allows you to stretch, move around, and maintain better physical health. Moreover, it contributes to your mental well-being by reducing stress, anxiety, and the feeling of being overwhelmed, thus fostering a positive attitude towards your work.&lt;/p&gt;

&lt;h1&gt;
  
  
  Part 3: How to Make the Best of Your Breaks
&lt;/h1&gt;

&lt;p&gt;Pomodoro Technique&lt;br&gt;
The Pomodoro Technique involves working for a focused period (e.g., 25 minutes) followed by a short break (e.g., 5 minutes). After completing a few cycles, take a longer break (e.g., 15-30 minutes). This approach capitalizes on the brain's ability to focus intensely for short bursts while ensuring regular breaks to recharge.&lt;/p&gt;

&lt;p&gt;Physical Activity&lt;br&gt;
Engaging in physical activities like stretching, walking, or even brief exercises during breaks not only benefits your physical health but also invigorates your mind. Physical movement boosts blood circulation, delivering oxygen and nutrients to the brain, which can improve your cognitive function.&lt;/p&gt;

&lt;p&gt;Mindfulness and Relaxation&lt;br&gt;
During breaks, practicing mindfulness techniques such as deep breathing, meditation, or simply closing your eyes and letting your mind wander can have remarkable rejuvenating effects. These practices help reduce stress, improve focus, and foster a sense of calm.&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion:
&lt;/h1&gt;

&lt;p&gt;Taking breaks as it turns out can be one of the most beneficial practices for not only your coding, but for almost any task that can be demanding on the mind. Hopefully next time you feel as though you're under too much mental load, you can use some of the tips and tricks discussed here to refocus.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>React.js useParams() tutorial</title>
      <dc:creator>harjas816</dc:creator>
      <pubDate>Thu, 31 Aug 2023 22:51:16 +0000</pubDate>
      <link>https://forem.com/harjas816/reactjs-useparams-tutorial-23f4</link>
      <guid>https://forem.com/harjas816/reactjs-useparams-tutorial-23f4</guid>
      <description>&lt;h1&gt;
  
  
  Make Your Routes Dynamic with useParams()
&lt;/h1&gt;

&lt;p&gt;In the ever-evolving landscape of web development, React.js has emerged as a frontrunner due to its flexibility and powerful features. One such feature, useParams(), has become a fundamental tool for creating dynamic routes within React applications. In this blog post, we'll dive into what useParams() is and how it can be harnessed to create dynamic routes that enhance user experiences and streamline development.&lt;/p&gt;

&lt;p&gt;Part 1: Understanding useParams()&lt;/p&gt;

&lt;p&gt;When building modern web applications, routing plays a pivotal role in navigating between different views or components. While static routes are straightforward, dynamic routes open up a world of possibilities by allowing us to display content based on parameters in the URL. This is where useParams() steps in.&lt;/p&gt;

&lt;p&gt;What is useParams()?&lt;br&gt;
In React applications, useParams() is a hook provided by the react-router-dom library, which is commonly used for handling routing in a declarative manner. This hook grants developers the ability to extract dynamic parameters from the URL, thereby enabling the creation of adaptable and dynamic components that respond to different URL structures.&lt;/p&gt;

&lt;p&gt;To illustrate this, imagine building a blog application. Instead of creating separate components for every individual blog post, we can use useParams() to extract the unique identifier from the URL and dynamically render the appropriate content.&lt;/p&gt;

&lt;p&gt;Part 2: Leveraging useParams() for Dynamic Routes&lt;/p&gt;

&lt;p&gt;Dynamic routes are a powerful way to create more engaging and user-friendly web applications. By incorporating useParams(), developers can effortlessly achieve this dynamic behavior. Let's explore how to use useParams() to create dynamic routes step by step.&lt;/p&gt;

&lt;p&gt;Step 1: Setting Up Route Configuration&lt;br&gt;
First, install the react-router-dom package if you haven't already:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bash
Copy code
npm install react-router-dom
Next, set up your route configuration in a component where you want to utilize dynamic routes. Define a dynamic parameter using the colon syntax, like so:


jsx
Copy code
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom';

function App() {
  return (
    &amp;lt;Router&amp;gt;
      &amp;lt;Switch&amp;gt;
        &amp;lt;Route path="/blog/:postId" component={BlogPost} /&amp;gt;
        &amp;lt;Route path="/about" component={About} /&amp;gt;
        &amp;lt;Route path="/" component={Home} /&amp;gt;
      &amp;lt;/Switch&amp;gt;
    &amp;lt;/Router&amp;gt;
  );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Step 2: Utilizing useParams()&lt;br&gt;
In the component (BlogPost in this case) that corresponds to the dynamic route, import the useParams() hook from react-router-dom:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;jsx
Copy code
import { useParams } from 'react-router-dom';

function BlogPost() {
  const { postId } = useParams();

  // Now, you can use the postId parameter to fetch and display the appropriate content
  // Example: Fetch the blog post with the given postId and render it

  return (
    // JSX for displaying the blog post
  );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By calling useParams(), you gain access to the dynamic parameter from the URL and can utilize it to customize the content displayed in your component.&lt;/p&gt;

&lt;h1&gt;
  
  
  In Conclusion
&lt;/h1&gt;

&lt;p&gt;In the realm of React.js development, creating dynamic routes is a fundamental skill that can significantly enhance user experiences. The useParams() hook from the react-router-dom library empowers developers to effortlessly extract dynamic parameters from URLs, opening doors to a wide array of possibilities. Whether you're building a blog application, an e-commerce site, or any other web-based project, mastering useParams() will undoubtedly add a dynamic edge to your creations.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>github</category>
      <category>python</category>
    </item>
    <item>
      <title>Why Coding is Good For You?</title>
      <dc:creator>harjas816</dc:creator>
      <pubDate>Thu, 31 Aug 2023 20:22:36 +0000</pubDate>
      <link>https://forem.com/harjas816/why-coding-is-good-for-you-35hj</link>
      <guid>https://forem.com/harjas816/why-coding-is-good-for-you-35hj</guid>
      <description>&lt;h1&gt;
  
  
  Is Coding an Art Form?
&lt;/h1&gt;

&lt;p&gt;An essential aspect of the human experience is finding ways in which we can escape into a world of our own. From the earliest plays of Shakespeare to now, art has been the primary medium in humanity’s need to achieve said escape. Movies, shows, poetry, music, and all kinds of different art forms have been created and innovated upon for essentially all of modern human history. This doesn’t mean however, that everyone had the necessary access to engage with this aspect of their life. &lt;/p&gt;

&lt;p&gt;The need for literacy education, as well as an expansive perspective on the world couldn’t reach the average commoner of the past like it can today. That was… until we stumbled upon the solution. Thanks to the advent of industrialization and technology, the internet has closed that gap in literacy and education in a way that has never been experienced before. In the past two decades, the amount of information instantaneously available to one’s fingertips has expanded to nearly any kind of topic or discussion you could think of. This is an undeniably massive achievement for humanity, and will help record and save our knowledge for expansion our ancestors couldn’t even dream of. &lt;/p&gt;

&lt;p&gt;One of the more interesting developments to come from the Internet Age is the gargantuan expansion of the art world. Digital art has become the new norm, and has given artists around the world the ability to avoid the obscurity of past tortured souls. But among all of the new digital art forms, web design is perhaps the one that has had the most reach in terms of everyday living. &lt;/p&gt;

&lt;p&gt;The bedrock of the internet is websites. Everyone goes to one when they want information, and we all have our favorites. Though do we ever stop to think about what goes into making them? As a kid, I thought it was all pure magic. Computer wizardry being performed by some of the most keen minds in the world, happening in a lab similar to that of Marie Curie. More recently, I have come to find that many everyday creatives we could easily find outside of a lab are the ones hugely responsible for this beautiful art form. And yes, coding is an art form, through and through. There is hard science and theory going on under the hood, but it truly could be best described as an art form. &lt;/p&gt;

&lt;p&gt;Its been proven that art is good for the mind, so why not give programming a shot?!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>What is .map() ?</title>
      <dc:creator>harjas816</dc:creator>
      <pubDate>Fri, 07 Jul 2023 15:24:20 +0000</pubDate>
      <link>https://forem.com/harjas816/what-is-map--35j6</link>
      <guid>https://forem.com/harjas816/what-is-map--35j6</guid>
      <description>&lt;h1&gt;
  
  
  What are methods
&lt;/h1&gt;

&lt;p&gt;Methods are certain functions meant to be used for specific, repeatable purposes in your code. For instance, instead of having to write your own function that makes a string's letters all uppercase repeatedly, you can just call this Javascript method called .toUpperCase() to do it for you every time you need to.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;String.toUpperCase()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;One of these methods, and arguably one of the most useful of them ,is called .map(). In order to understand .map() though, we need to understand what a Javascript array is first.&lt;/p&gt;

&lt;h1&gt;
  
  
  What is an array ?
&lt;/h1&gt;

&lt;p&gt;An array is an iterable group of items kept inside of a pair of square brackets&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const my_array = [1,2,3,4,5]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Arrays are probably the most common type of data structure that programmers come across. If we're going to be dealing with large amounts f data, we would like the ability to organize them into groups that we can reference and manipulate. Thankfully, .map() allows us to do just that!&lt;/p&gt;

&lt;p&gt;When we call the .map() function, we give it a callback function as an argument. This is a function that is going to take all of the items in the array as an argument, one at a time, until the function has gone through the entire array.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const mapped_array = my_array.map(arrayItem =&amp;gt; {console.log(arrayItem})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With this code, it would print the numbers 1-5 in the console, and would also console.log anything we decide to put in the array afterwards.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(result)
1
2
3
4
5
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now that you know what .map() is, you are prepared to expand your ability to manipulate arrays in order to solve more complex problems than you could before. Good Luck!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
