<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Niz on Medium]]></title>
        <description><![CDATA[Stories by Niz on Medium]]></description>
        <link>https://medium.com/@niz3?source=rss-770d9bacd7cb------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*2TInILFhz2Bs9wobEhs9xw.jpeg</url>
            <title>Stories by Niz on Medium</title>
            <link>https://medium.com/@niz3?source=rss-770d9bacd7cb------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 08:37:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@niz3/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Pre interview : Array, String, Algorithm JavaSrcipt programs]]></title>
            <link>https://medium.com/@niz3/pre-interview-array-string-algorithm-javasrcipt-programs-34e7ed8d2c73?source=rss-770d9bacd7cb------2</link>
            <guid isPermaLink="false">https://medium.com/p/34e7ed8d2c73</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[string]]></category>
            <category><![CDATA[interview]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[arrays]]></category>
            <dc:creator><![CDATA[Niz]]></dc:creator>
            <pubDate>Mon, 06 Jan 2025 04:09:11 GMT</pubDate>
            <atom:updated>2025-01-06T04:09:11.498Z</atom:updated>
            <content:encoded><![CDATA[<h3>Pre interview : Array, String, Algorithm JavaSrcipt programs</h3><p>I always look for programs before my interviews to brainstorm Array, String and Algorithm-related programs so I can be prepared for any question in the interview.</p><p>Are you facing issues in understanding arrays, strings, and basic algorithms?</p><p>I’ve created a customized list of questions to help you understand arrays, strings, and basic algorithms. Make sure you always read this before every technical interview.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QvS_fhX7t1ZRu3zy" /><figcaption>Photo by <a href="https://unsplash.com/@resumegenius?utm_source=medium&amp;utm_medium=referral">Resume Genius</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>1. Remove Duplicates from an Array</h3><p>This program removes duplicate values from an array by using a JavaScript Set. Sets only store unique values, making it an efficient solution.</p><pre>function removeDuplicates(arr) {<br>  // Create a Set from the array to remove duplicates and convert it back to an array<br>  return […new Set(arr)];<br>}</pre><blockquote>Example: Input: [1, 2, 2, 3, 4, 4] Output: [1, 2, 3, 4]</blockquote><h3><strong>2. Reverse a String</strong></h3><p>This program reverses a given string by converting it into an array of characters, reversing the array, and joining it back together.</p><pre>function reverseString(str) {<br>  // Split the string into an array, reverse it, and join it back<br>  return str.split(&#39;&#39;).reverse().join(&#39;&#39;);<br>}</pre><blockquote>Example: Input: “hello” Output: “olleh”</blockquote><h3><strong>3. Check if a String is a Palindrome</strong></h3><p>A palindrome is a string that reads the same forwards and backwards. This program checks if a given string is a palindrome.</p><pre>function isPalindrome(str) {<br>  // Reverse the string and compare it with the original string<br>  const reversed = str.split(&#39;&#39;).reverse().join(&#39;&#39;);<br>  return str === reversed;<br>}</pre><blockquote>Example: Input: “madam” Output: true</blockquote><h3>4. Find the Largest Number in an Array</h3><p>This program finds the largest number in an array using the JavaScript Math.max function and the spread operator.</p><pre>function findLargest(arr) {<br>  // Use Math.max with the spread operator to find the largest number<br>  return Math.max(…arr);<br>}</pre><blockquote>Example: Input: [10, 20, 30, 5] Output: 30</blockquote><h3>5. Check if Two Strings are Anagrams</h3><p>An anagram is a word or phrase formed by rearranging the letters of another. This program checks if two strings are anagrams by sorting their characters.</p><pre>function isAnagram(str1, str2) {<br>  // Normalize both strings by splitting, sorting, and joining them<br>  const normalize = str =&gt; str.split(&#39;&#39;).sort().join(&#39;&#39;);<br>  return normalize(str1) === normalize(str2);<br>}</pre><blockquote>Example: Input: “listen”, “silent” Output: true</blockquote><h3>6. Sum of All Elements in an Array</h3><p>This program calculates the sum of all numbers in an array using the reduce method.</p><pre>function sumArray(arr) {<br>  // Use reduce to accumulate the sum of all array elements<br>  return arr.reduce((sum, current) =&gt; sum + current, 0);<br>}</pre><blockquote>Example: Input: [1, 2, 3, 4] Output: 10</blockquote><h3><strong>7. Find the Second Largest Number in an Array</strong></h3><p>This program finds the second largest number in an array by iterating through the elements and keeping track of the two largest numbers.</p><pre>function secondLargest(arr) {<br>  let max = -Infinity, secondMax = -Infinity;<br>  // Iterate through the array to find the two largest numbers<br>  for (let num of arr) {<br>    if (num &gt; max) {<br>      secondMax = max;<br>      max = num;<br>    } else if (num &gt; secondMax &amp;&amp; num !== max) {<br>      secondMax = num;<br>    }<br>  }<br>  return secondMax;<br>}</pre><blockquote>Example: Input: [10, 20, 30, 5] Output: 20</blockquote><h3>8. Check if an Array is Sorted</h3><p>This program checks if the array elements are sorted in ascending order.</p><pre>function isSorted(arr) {<br>  // Compare each element with the previous one<br>  for (let i = 1; i &lt; arr.length; i++) {<br>    if (arr[i] &lt; arr[i - 1]) return false;<br>  }<br>  return true;<br>}</pre><blockquote>Example: Input: [1, 2, 3, 4] Output: true</blockquote><h3>9. Count the Occurrences of Each Element in an Array</h3><p>This program counts how many times each element appears in an array using the reduce method.</p><pre>function countOccurrences(arr) {<br>  // Use reduce to count occurrences of each element<br>  return arr.reduce((acc, curr) =&gt; {<br>    acc[curr] = (acc[curr] || 0) + 1;<br>    return acc;<br>  }, {});<br>}</pre><blockquote>Example: Input: [1, 2, 2, 3, 3, 3] Output: {1: 1, 2: 2, 3: 3}</blockquote><h3>10. Flatten a Nested Array</h3><p>This program flattens a deeply nested array into a single-level array using the flat method with a depth of Infinity.</p><pre>function flattenArray(arr) {<br>  // Use flat with Infinity depth to flatten the array<br>  return arr.flat(Infinity);<br>}</pre><blockquote>Example: Input: [1, [2, [3, [4]]]] Output: [1, 2, 3, 4]</blockquote><p>Do follow so you don’t miss next important content and if you need any program in detail explanation, comment down below.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=34e7ed8d2c73" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering JavaScript: Programs for Brushing up before every Technical Interview]]></title>
            <link>https://medium.com/@niz3/mastering-javascript-programs-for-brushing-up-before-every-technical-interview-5b1599e4c9aa?source=rss-770d9bacd7cb------2</link>
            <guid isPermaLink="false">https://medium.com/p/5b1599e4c9aa</guid>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[interview]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Niz]]></dc:creator>
            <pubDate>Fri, 27 Dec 2024 05:29:48 GMT</pubDate>
            <atom:updated>2024-12-27T05:29:48.086Z</atom:updated>
            <content:encoded><![CDATA[<p>Having gone through and aced countless technical interviews myself, I’ve put together a list of 10 must-know JavaScript programs you should brush up on before your next big interview. These programs frequently pop up in interviews and not only test your foundational knowledge but also highlight your problem-solving skills.</p><p><strong><em>Make it a routine to review these before every technical interview — you’ll be glad you did!</em></strong></p><p>Each of these problems comes with a solution and a clear explanation. Ready to dive in?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gm6Ncxh3Jd_-IL8k" /><figcaption>Photo by <a href="https://unsplash.com/@walls_io?utm_source=medium&amp;utm_medium=referral">Walls.io</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>1. Check if a Number is Prime</h3><p>Knowing how to determine if a number is prime is a classic problem, and it’s surprisingly efficient with the right approach.</p><pre>const isPrime = (num) =&gt; {<br>  if (num &lt;= 1) return false;<br>  for (let i = 2; i &lt;= Math.sqrt(num); i++) {<br>    if (num % i === 0) return false;<br>  }<br>  return true;<br>};</pre><pre>console.log(isPrime(17)); // true<br>console.log(isPrime(18)); // false</pre><p><strong>Why it’s important</strong>: It tests your understanding of loops and mathematical concepts like prime numbers and square roots.</p><h3>2. Generate a Fibonacci Sequence</h3><p>The Fibonacci sequence is a fundamental concept in math and programming. Here’s how you can generate it in JavaScript:</p><pre>const fibonacci = (n) =&gt; {<br>  const sequence = [0, 1];<br>  for (let i = 2; i &lt; n; i++) {<br>    sequence.push(sequence[i - 1] + sequence[i - 2]);<br>  }<br>  return sequence;<br>};</pre><pre>console.log(fibonacci(10)); // [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]</pre><p><strong>Why it’s important</strong>: It challenges your ability to use arrays and iterative logic.</p><h3>3. Find the Factorial of a Number</h3><p>Factorials often appear in recursion questions, and JavaScript makes solving them straightforward.</p><pre>const factorial = (num) =&gt; {<br>  if (num &lt;= 1) return 1;<br>  return num * factorial(num - 1);<br>};</pre><pre>console.log(factorial(5)); // 120<br>console.log(factorial(6)); // 720</pre><p><strong>Why it’s important</strong>: Demonstrates your understanding of recursion.</p><h3>4. Reverse a String</h3><p>String manipulation is a common skill for a JavaScript developer. Reversing a string is a simple yet powerful example.</p><pre>const reverseString = (str) =&gt; {<br>  return str.split(&#39;&#39;).reverse().join(&#39;&#39;);<br>};</pre><pre>console.log(reverseString(&quot;hello&quot;)); // &quot;olleh&quot;<br>console.log(reverseString(&quot;NodeJS&quot;)); // &quot;SJedoN&quot;</pre><p><strong>Why it’s important</strong>: Tests your understanding of JavaScript string methods.</p><h3>5. Find the Largest Element in an Array</h3><p>Finding the largest element is a basic but essential array operation.</p><pre>const findLargest = (arr) =&gt; {<br>  return Math.max(...arr);<br>};</pre><pre>console.log(findLargest([1, 2, 3, 4, 5])); // 5<br>console.log(findLargest([5, 4, 3, 2, 1])); // 5</pre><p><strong>Why it’s important</strong>: It evaluates your knowledge of the Math object and the spread operator.</p><h3>6. Check if a String is a Palindrome</h3><p>Palindromes are strings that read the same forwards and backwards. This problem is perfect for testing string manipulation.</p><pre>const isPalindrome = (str) =&gt; {<br>  const cleanedStr = str.replace(/[^A-Za-z0-9]/g, &#39;&#39;).toLowerCase();<br>  return cleanedStr === cleanedStr.split(&#39;&#39;).reverse().join(&#39;&#39;);<br>};</pre><pre>console.log(isPalindrome(&quot;A man, a plan, a canal, Panama&quot;)); // true<br>console.log(isPalindrome(&quot;hello&quot;)); // false</pre><p><strong>Why it’s important</strong>: This demonstrates your ability to handle regular expressions and logic.</p><h3>7. Sum of Array Elements</h3><p>Summing elements in an array is a common operation in many programming scenarios.</p><pre>const sumArray = (arr) =&gt; {<br>  return arr.reduce((sum, num) =&gt; sum + num, 0);<br>};</pre><pre>console.log(sumArray([1, 2, 3, 4, 5])); // 15<br>console.log(sumArray([10, 20, 30])); // 60</pre><p><strong>Why it’s important</strong>: Tests your knowledge of array methods like reduce.</p><h3>8. Find the GCD of Two Numbers</h3><p>Finding the greatest common divisor (GCD) is another classic algorithm often asked in interviews.</p><pre>const gcd = (a, b) =&gt; {<br>  if (!b) return a;<br>  return gcd(b, a % b);<br>};</pre><pre>console.log(gcd(48, 18)); // 6<br>console.log(gcd(54, 24)); // 6</pre><p><strong>Why it’s important</strong>: Highlights your understanding of recursion and mathematical logic.</p><h3>9. Generate a Random Number Between Two Values</h3><p>This is a practical problem often used in real-world applications.</p><pre>const getRandomNumber = (min, max) =&gt; {<br>  return Math.floor(Math.random() * (max - min + 1)) + min;<br>};</pre><pre>console.log(getRandomNumber(1, 10)); // Random number between 1 and 10<br>console.log(getRandomNumber(100, 200)); // Random number between 100 and 200</pre><p><strong>Why it’s important</strong>: Demonstrates your ability to work with the Math object and randomness.</p><h3>10. Count the Number of Vowels in a String</h3><p>Vowel counting combines string manipulation and array filtering.</p><pre>const countVowels = (str) =&gt; {<br>  const vowels = &#39;aeiouAEIOU&#39;;<br>  return str.split(&#39;&#39;).filter(char =&gt; vowels.includes(char)).length;<br>};</pre><pre>console.log(countVowels(&quot;hello world&quot;)); // 3<br>console.log(countVowels(&quot;AEIOU&quot;)); // 5</pre><p><strong>Why it’s important</strong>: It evaluates your knowledge of JavaScript array methods and conditionals.</p><h3>Always remember</h3><ol><li><strong>Understand Before Memorizing</strong>: These problems test your logic, not just your ability to regurgitate code.</li><li><strong>Practice Writing</strong>: Write the solutions without copy-pasting. Muscle memory matters.</li><li><strong>Optimize</strong>: Always consider time and space complexity during interviews.</li><li><strong>Explain</strong>: Be ready to explain your thought process and code to the interviewer.</li></ol><p>Mastering these problems will not only prepare you for interviews but also make you a better programmer overall. So grab your editor and start practicing — you’ve got this!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5b1599e4c9aa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[You’ll Never Feel Comfortable with Anyone Unless You Know These 7 Tips]]></title>
            <link>https://medium.com/@niz3/youll-never-feel-comfortable-with-anyone-unless-you-know-these-7-tips-d15f2093fe36?source=rss-770d9bacd7cb------2</link>
            <guid isPermaLink="false">https://medium.com/p/d15f2093fe36</guid>
            <category><![CDATA[community]]></category>
            <category><![CDATA[social]]></category>
            <category><![CDATA[connection]]></category>
            <category><![CDATA[communication-skills]]></category>
            <category><![CDATA[conversations]]></category>
            <dc:creator><![CDATA[Niz]]></dc:creator>
            <pubDate>Fri, 20 Dec 2024 04:44:55 GMT</pubDate>
            <atom:updated>2024-12-20T04:44:55.326Z</atom:updated>
            <content:encoded><![CDATA[<p>Building strong connections with people can open up new opportunities, deepen relationships, and enhance your social experiences. However, getting comfortable with someone new isn’t always easy. Social anxiety, fear of judgment, or simply not knowing what to say can make interactions awkward. The good news is that you can overcome these barriers with the right approach.</p><p>If you’ve ever wondered how some people can strike up a conversation with anyone and seem completely at ease, you’re in the right place. Here are seven practical tips to help you get comfortable with anyone, from strangers to acquaintances.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5FOevXCSOue0Vj5j" /><figcaption>Photo by <a href="https://unsplash.com/@kellisa?utm_source=medium&amp;utm_medium=referral">kelisa Bernard</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><strong>1. Start with Active Listening</strong></p><p>One of the most effective ways to build comfort with others is to become an active listener. People love to feel heard, and when you give someone your full attention, they’re more likely to feel at ease around you.</p><p><strong>How to do it:</strong></p><ul><li>Maintain eye contact while the other person is speaking.</li><li>Nod or provide verbal affirmations like “I see” or “That’s interesting.”</li><li>Avoid interrupting or thinking about your response while they’re talking.</li></ul><p><em>When you actively listen, you’re showing empathy and respect, which naturally creates a sense of comfort for both you and the other person.</em></p><p><strong>2. Find Common Ground</strong></p><p>Shared experiences and interests create an instant bond. It’s easier to feel comfortable with someone when you’re talking about something you both enjoy.</p><p><strong>How to do it:</strong></p><ul><li>Ask open-ended questions like, “What’s something you’re passionate about?”</li><li>Look for shared experiences, like attending the same school, liking the same sports team, or enjoying similar hobbies.</li><li>Use context clues from your environment, like discussing a shared event or location.</li></ul><p><em>Finding common ground gives you a solid starting point for meaningful conversation. It’s easier to be comfortable around people when you feel connected by similar experiences or interests.</em></p><p><strong>3. Practice Empathy and Understanding</strong></p><p>Being empathetic means understanding and sharing the feelings of others. People are drawn to those who show kindness and understanding.</p><p><strong>How to do it:</strong></p><ul><li>Put yourself in the other person’s shoes.</li><li>Validate their feelings by saying things like, “That sounds tough” or “I can understand why you’d feel that way.”</li><li>Avoid being judgmental, even if you don’t agree with their perspective.</li></ul><p><em>Empathy breaks down emotional barriers and creates a sense of safety and trust. When people feel understood, they’re more likely to open up and feel comfortable around you.</em></p><p><strong>4. Use Open Body Language</strong></p><p>Non-verbal communication is just as important as the words you say. Open, welcoming body language signals that you’re approachable and friendly.</p><p><strong>How to do it:</strong></p><ul><li>Keep your arms uncrossed and maintain a relaxed posture.</li><li>Smile genuinely when appropriate.</li><li>Angle your body toward the person you’re speaking with, rather than away from them.</li></ul><p><em>Body language speaks louder than words. By maintaining an open, inviting posture, you’re signaling that you’re present and receptive, which makes the other person feel more at ease.</em></p><p><strong>5. Ask Thoughtful Questions</strong></p><p>The best way to engage with someone new is by asking thoughtful questions. This not only keeps the conversation flowing but also shows genuine interest.</p><p><strong>How to do it:</strong></p><ul><li>Avoid surface-level questions like “How’s it going?” and ask deeper ones like “What’s been the highlight of your week?”</li><li>If you’re unsure, use follow-up questions like “Can you tell me more about that?”</li></ul><p><em>Thoughtful questions demonstrate that you’re genuinely interested in the other person, which builds rapport. Plus, people naturally feel more comfortable talking about themselves.</em></p><p><strong>6. Be Authentic and Vulnerable</strong></p><p>People are drawn to authenticity. When you’re genuine, you’re signaling that it’s okay to let their guard down too.</p><p><strong>How to do it:</strong></p><ul><li>Share personal stories or experiences, even if they’re a little embarrassing (within reason, of course!).</li><li>Don’t try to “impress” others with false stories or exaggerations.</li><li>Admit when you don’t know something instead of pretending.</li></ul><p><em>Vulnerability fosters human connection. When you’re authentic, others are more likely to feel safe and comfortable around you.</em></p><p><strong>7. Stay Present and Avoid Overthinking</strong></p><p>Many people feel uncomfortable in social situations because they’re worried about how they’re being perceived. To overcome this, stay present and focus on the other person instead of yourself.</p><p><strong>How to do it:</strong></p><ul><li>Focus on what the person is saying rather than how you’re “performing.”</li><li>Practice mindfulness techniques, like taking deep breaths before or during conversations.</li><li>Remind yourself that most people aren’t judging you as harshly as you think.</li></ul><p><em>When you’re fully present, you’re able to engage more naturally, making interactions smoother and more genuine. Plus, you’ll feel more relaxed when you’re not overanalyzing everything you say.</em></p><p>Getting comfortable with anyone isn’t about having the “<em>perfect</em>” conversation skills — it’s about being human. By practicing empathy, active listening, open body language, and authenticity, you’ll create a space where both you and the other person feel at ease.</p><p>Start small. Try these techniques in your next interaction, whether it’s with a colleague, a neighbor, or someone you meet at an event. Over time, you’ll find that building rapport with anyone becomes second nature.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d15f2093fe36" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Important React Concepts You Should Know : Cheatsheet Day 9]]></title>
            <link>https://medium.com/@niz3/important-react-concepts-you-should-know-cheatsheet-day-9-74314b3cfb60?source=rss-770d9bacd7cb------2</link>
            <guid isPermaLink="false">https://medium.com/p/74314b3cfb60</guid>
            <category><![CDATA[tools]]></category>
            <category><![CDATA[important]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[cheatsheet]]></category>
            <category><![CDATA[debugging]]></category>
            <dc:creator><![CDATA[Niz]]></dc:creator>
            <pubDate>Tue, 27 Aug 2024 10:13:32 GMT</pubDate>
            <atom:updated>2024-08-27T10:13:32.428Z</atom:updated>
            <content:encoded><![CDATA[<h3>Important React Concepts You Should Know : Cheatsheet Day 9</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*wf9LzQBLA6--3qdJVjvlZw.png" /></figure><h3>Mastering React Debugging with React Developer Tools</h3><p>If you’ve been building React apps for a while, you know how tricky it can be to debug a complex component tree. This is where React Developer Tools comes in handy. It’s a browser extension that gives you superpowers by letting you inspect and debug your React components with ease.</p><h4>Why Use React Developer Tools?</h4><p>React Developer Tools allows you to peek inside your React app’s component hierarchy in real-time. You can inspect the state and props of each component, see how they relate to each other, and even track component re-renders. This insight can be invaluable when you’re trying to figure out why a component isn’t behaving as expected.</p><h4>Getting Started</h4><p>First, you’ll need to install the React Developer Tools extension. It’s available for both Chrome and Firefox. Once installed, you’ll see a new “⚛️ React” tab in your browser’s developer tools whenever you open a React app.</p><h4>Exploring the Component Tree</h4><p>When you open the “React” tab, you’ll see a tree structure that represents your app’s component hierarchy. Clicking on any component in the tree will display its props, state, and hooks in the right-hand pane. This makes it super easy to track down where a bug might be hiding.</p><h4>Example: Inspecting State and Props</h4><p>Let’s say you have a simple counter component:</p><pre>import React, { useState } from &#39;react&#39;;<br><br>function Counter() {<br>  const [count, setCount] = useState(0);<br>  return (<br>    &lt;div&gt;<br>      &lt;p&gt;Count: {count}&lt;/p&gt;<br>      &lt;button onClick={() =&gt; setCount(count + 1)}&gt;Increment&lt;/button&gt;<br>    &lt;/div&gt;<br>  );<br>}</pre><p>With React Developer Tools, you can select the Counter component and instantly see the current count state. As you click the “Increment” button, you’ll watch the state update in real-time, making it easier to debug issues related to state management.</p><h4>Final Thoughts</h4><p>React Developer Tools is an essential tool for any React developer. It not only helps you understand your component structure but also allows you to efficiently troubleshoot and optimize your application. If you haven’t installed it yet, give it a try — you’ll wonder how you ever lived without it!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=74314b3cfb60" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Important React Concepts You Should Know : Cheatsheet Day 8]]></title>
            <link>https://medium.com/@niz3/important-react-concepts-you-should-know-cheatsheet-day-8-988219360485?source=rss-770d9bacd7cb------2</link>
            <guid isPermaLink="false">https://medium.com/p/988219360485</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[programing]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Niz]]></dc:creator>
            <pubDate>Mon, 26 Aug 2024 18:31:38 GMT</pubDate>
            <atom:updated>2024-08-26T18:31:38.033Z</atom:updated>
            <content:encoded><![CDATA[<h3>Important React Concepts You Should Know : Cheatsheet Day 8</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*ZE-DdpIu6lFZzzMrpiQusA.png" /></figure><h3>Forms and Controlled Components</h3><p>Forms are a fundamental part of web applications. Whether it’s a simple login form or a complex multi-step survey, understanding how to handle forms in React is essential. In React, forms are typically managed using controlled components, which provide a predictable and consistent way to handle user input.</p><h4>What Are Controlled Components?</h4><p>In traditional HTML, form elements like &lt;input&gt;, &lt;textarea&gt;, and &lt;select&gt; maintain their own state internally. However, in React, a controlled component is a form element that is fully controlled by the component&#39;s state. This means that the value of the form element is determined by the state, and any changes to the form input update the state accordingly.</p><p>By using controlled components, you have complete control over the form data, making it easier to handle complex interactions and validation logic.</p><h4>Creating a Controlled Component</h4><p>Let’s walk through an example of creating a simple controlled component in React. Suppose we want to create a form that captures a user’s name:</p><pre>import React, { useState } from &#39;react&#39;;<br><br>function NameForm() {<br><br>  const [name, setName] = useState(&#39;&#39;);<br><br>  const handleChange = (event) =&gt; {<br>    setName(event.target.value);<br>  };<br><br>  const handleSubmit = (event) =&gt; {<br>    event.preventDefault();<br>    alert(&#39;A name was submitted: &#39; + name);<br>  };<br><br>  return (<br>    &lt;form onSubmit={handleSubmit}&gt;<br>      &lt;label&gt;<br>        Name:<br>        &lt;input type=&quot;text&quot; value={name} onChange={handleChange} /&gt;<br>      &lt;/label&gt;<br>      &lt;button type=&quot;submit&quot;&gt;Submit&lt;/button&gt;<br>    &lt;/form&gt;<br>  );<br>}<br><br>export default NameForm;</pre><p>In this example, the NameForm component uses the useState hook to keep track of the name state. The input element is tied to the name state via its value attribute. This makes the input a controlled component because its value is controlled by the React state.</p><p>The handleChange function is called whenever the user types in the input field. It updates the state with the new value, ensuring that the UI always reflects the current state. When the form is submitted, the handleSubmit function prevents the default form submission behavior (which would normally refresh the page) and instead triggers an alert showing the submitted name.</p><h4>Benefits of Controlled Components</h4><p>Controlled components offer several advantages:</p><ol><li><strong>Single Source of Truth</strong>: The component state is the single source of truth for the form data. This makes it easier to manage and debug.</li><li><strong>Validation and Formatting</strong>: You can easily add validation logic or format the input before updating the state, providing a more controlled user experience.</li><li><strong>Conditional Rendering</strong>: Since the form data is in the state, you can easily conditionally render other parts of your UI based on the input.</li><li><strong>Easier Integration</strong>: Controlled components make it easier to integrate form data with other parts of your React app, such as submitting the data to a server or sharing it with other components.</li></ol><h4>Handling Multiple Inputs</h4><p>If you need to handle multiple form inputs, you can use the same handleChange function for all inputs by using the name attribute of the input elements:</p><pre>function MultiInputForm() {<br>  const [formData, setFormData] = useState({<br>    firstName: &#39;&#39;,<br>    lastName: &#39;&#39;,<br>  });<br><br>  const handleChange = (event) =&gt; {<br>      const { name, value } = event.target;<br>      setFormData({<br>        ...formData,<br>        [name]: value,<br>      });<br>    };<br>  <br>    const handleSubmit = (event) =&gt; {<br>      event.preventDefault();<br>      alert(&#39;Form submitted: &#39; + JSON.stringify(formData));<br>    };<br>  <br>    return (<br>      &lt;form onSubmit={handleSubmit}&gt;<br>        &lt;label&gt;<br>          First Name:<br>          &lt;input<br>            type=&quot;text&quot;<br>            name=&quot;firstName&quot;<br>            value={formData.firstName}<br>            onChange={handleChange}<br>          /&gt;<br>        &lt;/label&gt;<br>        &lt;br /&gt;<br>        &lt;label&gt;<br>          Last Name:<br>          &lt;input<br>            type=&quot;text&quot;<br>            name=&quot;lastName&quot;<br>            value={formData.lastName}<br>            onChange={handleChange}<br>          /&gt;<br>        &lt;/label&gt;<br>        &lt;br /&gt;<br>        &lt;button type=&quot;submit&quot;&gt;Submit&lt;/button&gt;<br>      &lt;/form&gt;<br>    );<br>}<br><br>export default MultiInputForm;</pre><p>In this example, the handleChange function dynamically updates the form data based on the name attribute of each input. This allows you to manage multiple form inputs with a single state object.</p><h4>Conclusion</h4><p>Controlled components are a powerful tool in React, giving you full control over form inputs and allowing for more complex interactions and validations. By managing the form data in your component’s state, you can create dynamic, user-friendly forms that integrate seamlessly with the rest of your application. Whether you’re building a simple form or a complex user interface, understanding controlled components is key to mastering React.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=988219360485" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Important React Concepts You Should Know : Cheatsheet Day 7]]></title>
            <link>https://medium.com/@niz3/important-react-concepts-you-should-know-cheatsheet-day-7-e7d7139dac61?source=rss-770d9bacd7cb------2</link>
            <guid isPermaLink="false">https://medium.com/p/e7d7139dac61</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[cheatsheet]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[learning]]></category>
            <dc:creator><![CDATA[Niz]]></dc:creator>
            <pubDate>Sat, 24 Aug 2024 13:27:46 GMT</pubDate>
            <atom:updated>2024-08-24T13:27:46.911Z</atom:updated>
            <content:encoded><![CDATA[<h3>Important React Concepts You Should Know : Cheatsheet Day 7</h3><h3>Understanding Lists and Keys in React</h3><p>When you’re building dynamic UIs in React, working with lists of data is something you’ll do frequently. Whether it’s rendering a list of user profiles or displaying a series of products, React makes it easy to handle lists. However, there are a few important things to know, particularly about keys, to ensure your list rendering is efficient and bug-free.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*0eRVdycc6x13TCzZ5CKJKg.png" /></figure><h4>Rendering Lists in React</h4><p>Rendering a list in React involves using JavaScript’s .map() function. This function lets you iterate over an array and transform each element into a React component or JSX.</p><p>Here’s a simple example where we display a list of numbers:</p><pre>import React from &#39;react&#39;;<br><br>function NumberList(props) {<br>  const numbers = props.numbers;<br>  const listItems = numbers.map((number) =&gt;<br>    &lt;li key={number.toString()}&gt;<br>      {number}<br>    &lt;/li&gt;<br>  );<br>  return (<br>    &lt;ul&gt;{listItems}&lt;/ul&gt;<br>  );<br>}<br>const numbers = [1, 2, 3, 4, 5];<br>export default function App() {<br>  return &lt;NumberList numbers={numbers} /&gt;;<br>}</pre><p>In this code, the NumberList component receives an array of numbers via props. The .map() function creates an array of &lt;li&gt; elements, each representing a number in the list.</p><h4>The Importance of Keys</h4><p>Now, let’s talk about keys. In React, keys are a special string attribute you need to include when creating lists of elements. They help React identify which items have changed, been added, or removed, allowing for efficient updates.</p><p>Without keys, React would re-render the entire list every time there’s a change, which can be inefficient, especially for long lists. By using keys, React can only update the elements that have changed.</p><p>In the example above, the key={number.toString()} prop ensures that each &lt;li&gt; element has a unique identifier. This is crucial for React to optimize rendering.</p><h4>A Quick Tip</h4><p>Always use stable and unique values as keys. If you’re rendering a list of objects with unique IDs, use the ID as the key. Avoid using indexes as keys, especially if the list’s order may change.</p><h4>Final Thoughts</h4><p>Handling lists in React is straightforward once you grasp the importance of keys. By using .map() and correctly assigning keys, you’ll ensure that your lists are rendered efficiently and without errors. Remember, a well-managed list with proper keys is key to a smooth and performant React application!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e7d7139dac61" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Important React Concepts You Should Know : Cheatsheet Day 6]]></title>
            <link>https://medium.com/@niz3/important-react-concepts-you-should-know-cheatsheet-day-6-0baa3a9aa513?source=rss-770d9bacd7cb------2</link>
            <guid isPermaLink="false">https://medium.com/p/0baa3a9aa513</guid>
            <category><![CDATA[day]]></category>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[cheatsheet]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Niz]]></dc:creator>
            <pubDate>Tue, 20 Aug 2024 15:03:55 GMT</pubDate>
            <atom:updated>2024-08-20T15:03:55.308Z</atom:updated>
            <content:encoded><![CDATA[<h3>Important React Concepts You Should Know : Cheatsheet Day 6</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*GUbQWqP9vZQNlrBkUAxPGQ.png" /></figure><h3>Conditional Rendering</h3><p>Conditional rendering is the ability to render different components or elements based on some conditions. This comes in very handy whenever there arises a need to change whatever it is you are displaying based on application or user state. Now let’s dive into some of the most common techniques used for conditional rendering in React.</p><h4><strong>If-Else Statements:</strong></h4><p>The simplest way is with if-else statements. This is a very simple way of approaching things and easy to understand. Consider the following example:</p><pre>function Greeting(props) {<br>   if (props.isLoggedIn)<br>      return &lt;h1&gt;Welcome back&lt;/h1&gt;;<br>   } else {<br>      return &lt;h1&gt;Please sign up.&lt;/h1&gt;;<br>   }<br>}</pre><p>In the example, the isLoggedIn prop is checked. If it&#39;s true, the user sees a welcome message; if false, it suggests they register.</p><h4><strong>Ternary Operator:</strong></h4><p>For a terser syntax, you might use the ternary operator, which might look something like this for writing inline conditional logic:</p><pre>function Greeting(props) {<br>   return (<br>      &lt;div&gt;<br>         {props.isLoggedIn ? &lt;h1&gt;Welcome back!&lt;/h1&gt; : &lt;h1&gt;Please sign up.&lt;/h1&gt;}<br>      &lt;/div&gt;<br>   );<br>}</pre><p>This works fine for simple conditions when you would like to return one of the two possible outcomes.</p><h4><strong>&amp;&amp; Logical Operator:</strong></h4><p>The logical AND (&amp;&amp;) operator is another useful approach when you need to render something only if a condition is true:</p><pre>function Mailbox(props) {<br>   const { unreadMessages } = props;<br>   return (<br>      &lt;div&gt;<br>         &lt;h1&gt;Hello!&lt;/h1&gt;<br>         {unreadMessages.length &gt; 0 &amp;&amp; &lt;h2&gt;You have {unreadMessages.length} unread messages.&lt;/h2&gt;}<br>      &lt;/div&gt;<br>   );<br>}</pre><p>Here, the &amp;&amp;-operator makes sure that it only outputs the message about unread emails if there is any message.</p><h4><strong>Conclusion:</strong></h4><p>Conditional rendering is a game changer with React, as it can create very dynamic and interactive user interfaces. By mastering techniques — be it through the help of if-else statements, the ternary operator, or the logical &amp;&amp; operator — it gives you total control over what the users will see depending on the state of your application or user input, thereby making the whole experience a lot more personalized and interactive.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0baa3a9aa513" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Important React Concepts You Should Know : Cheatsheet Day 5]]></title>
            <link>https://medium.com/@niz3/important-react-concepts-you-should-know-cheatsheet-day-5-a447559102a7?source=rss-770d9bacd7cb------2</link>
            <guid isPermaLink="false">https://medium.com/p/a447559102a7</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[reactjs]]></category>
            <dc:creator><![CDATA[Niz]]></dc:creator>
            <pubDate>Mon, 19 Aug 2024 07:30:35 GMT</pubDate>
            <atom:updated>2024-08-19T07:30:35.592Z</atom:updated>
            <content:encoded><![CDATA[<h3>Important React Concepts You Should Know : Cheatsheet Day 5</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*7rOfvjSH6hwmCFoTjqHMJQ.png" /></figure><h4>Handling Events</h4><p><strong>1. How to Handle Events in React</strong></p><p>Handling events in React is similar to handling events in regular HTML, but with some syntactic differences.</p><p><strong>2. Differences Between Handling Events in React and HTML</strong></p><ul><li>Events are named using camelCase in React (e.g., onClick).</li><li>Event handlers in React are passed as functions, not strings.</li></ul><p><strong>3. Example Code Snippets</strong></p><p>Here’s an example of handling a button click event in React:</p><pre>function MyButton() {<br>  function handleClick() {<br>    alert(&#39;Button was clicked!&#39;);<br>  }<br>  return (<br>    &lt;button onClick={handleClick}&gt;<br>      Click me<br>    &lt;/button&gt;<br>  );<br>}</pre><h3>Conclusion</h3><p>Handling events in React is as easy and powerful as it gets; all thanks to JSX and synthetic events. Knowing the differences between how event handling works in React and vanilla HTML/JavaScript helps maximize all that React provides for creating interactive and reactive user interfaces. React has a neat way of how to handle events within your application, regardless of if you deal with button clicks, form submissions, or input changes.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a447559102a7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Important React Concepts You Should Know : Cheatsheet Day 4]]></title>
            <link>https://medium.com/@niz3/important-react-concepts-you-should-know-cheatsheet-day-4-764b905d6ff5?source=rss-770d9bacd7cb------2</link>
            <guid isPermaLink="false">https://medium.com/p/764b905d6ff5</guid>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Niz]]></dc:creator>
            <pubDate>Sun, 18 Aug 2024 12:58:02 GMT</pubDate>
            <atom:updated>2024-08-18T12:58:02.102Z</atom:updated>
            <content:encoded><![CDATA[<h3>Important React Concepts You Should Know : Cheatsheet Day 4</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*RqqwDlJGC9oNUZyrnlShqQ.png" /></figure><h4>State and Lifecycle</h4><p><strong>1. Explanation of State in React</strong></p><p>State is a built-in object that allows components to manage and respond to user input, data changes, and other dynamic factors. Unlike props, state is managed within the component and can change over time.</p><p><strong>2. Using the useState Hook</strong></p><p>The useState hook is used to add state to functional components. Here’s how to use it:</p><pre>import React, { useState } from &#39;react&#39;;<br><br>function Counter() {<br><br>  const [count, setCount] = useState(0);<br><br>  return (<br>    &lt;div&gt;<br>      &lt;p&gt;You clicked {count} times&lt;/p&gt;<br>      &lt;button onClick={() =&gt; setCount(count + 1)}&gt;<br>        Click me<br>      &lt;/button&gt;<br>    &lt;/div&gt;<br>  );<br><br>}</pre><p><strong>3. Lifecycle Methods in Class Components</strong></p><p>Lifecycle methods are special methods in class components that run at specific points in a component’s life (e.g., when it mounts, updates, or unmounts).</p><ul><li><strong>componentDidMount()</strong>: Called after the component is rendered for the first time.</li><li><strong>componentDidUpdate()</strong>: Called after the component updates.</li><li><strong>componentWillUnmount()</strong>: Called right before the component is removed from the DOM.</li></ul><p>Example:</p><pre>class Timer extends React.Component {<br>  constructor(props) {<br>    super(props);<br>    this.state = { seconds: 0 };<br>  }<br><br>  componentDidMount() {<br>    this.interval = setInterval(() =&gt; this.tick(), 1000);<br>  }<br><br>  componentWillUnmount() {<br>    clearInterval(this.interval);<br>  }<br><br>  tick() {<br>    this.setState((state) =&gt; ({<br>      seconds: state.seconds + 1<br>    }));<br>  }<br><br>  render() {<br>    return &lt;div&gt;Seconds: {this.state.seconds}&lt;/div&gt;;<br>  }<br><br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=764b905d6ff5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Important React Concepts You Should Know : Cheatsheet Day 3]]></title>
            <link>https://medium.com/@niz3/important-react-concepts-you-should-know-cheatsheet-day-3-8256bc51a63a?source=rss-770d9bacd7cb------2</link>
            <guid isPermaLink="false">https://medium.com/p/8256bc51a63a</guid>
            <dc:creator><![CDATA[Niz]]></dc:creator>
            <pubDate>Sat, 17 Aug 2024 08:31:51 GMT</pubDate>
            <atom:updated>2024-08-17T08:31:51.545Z</atom:updated>
            <content:encoded><![CDATA[<h3>Important React Concepts You Should Know : Cheatsheet Day 3</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*S-pnyA9DFbD5tEJIS0QvMQ.png" /></figure><h4>Components and Props</h4><p><strong>1. Introduction to Components</strong></p><p>Components are the building blocks of a React application. A component can be a function or a class, and it encapsulates the UI logic for a part of the application. There are two main types of components: functional components and class components.</p><p><strong>2. Functional vs. Class Components</strong></p><p><strong>Functional Components</strong>:</p><p>These are JavaScript functions that return JSX. They are simpler and easier to write.</p><pre>function Welcome(props) {   <br>  return &lt;h1&gt;Hello, {props.name}&lt;/h1&gt;; <br>}</pre><p><strong>Class Components</strong>:</p><p>These are ES6 classes that extend from React.Component and include a render method that returns JSX.</p><pre>class Welcome extends React.Component {<br>   render() {<br>     return &lt;h1&gt;Hello, {this.props.name}&lt;/h1&gt;;<br>   } <br>}</pre><p><strong>3. Props and How to Use Them</strong></p><p>Props (short for properties) are used to pass data from one component to another. Props are read-only and cannot be modified by the component receiving them.</p><p>Here’s an example of using props in a functional component:</p><pre>function Greeting(props) {<br>  return &lt;h1&gt;Hello, {props.name}!&lt;/h1&gt;;<br>}<br><br>function App() {<br>  return &lt;Greeting name=&quot;World&quot; /&gt;;<br>}</pre><p>And in a class component:</p><pre>class Greeting extends React.Component {<br>  render() {<br>    return &lt;h1&gt;Hello, {this.props.name}!&lt;/h1&gt;;<br>  }<br>}<br><br>class App extends React.Component {<br>  render() {<br>    return &lt;Greeting name=&quot;World&quot; /&gt;;<br>  }<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8256bc51a63a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>