<?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 Md Readwan on Medium]]></title>
        <description><![CDATA[Stories by Md Readwan on Medium]]></description>
        <link>https://medium.com/@readwanmd?source=rss-7fe48c278faa------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*wPbJPTVeY_9MHS__aWuwug.png</url>
            <title>Stories by Md Readwan on Medium</title>
            <link>https://medium.com/@readwanmd?source=rss-7fe48c278faa------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 01 Jun 2026 22:36:32 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@readwanmd/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[Enhancing React List Rendering: A Clean and Reusable Pattern]]></title>
            <link>https://readwanmd.medium.com/enhancing-react-list-rendering-a-clean-and-reusable-pattern-765a402c358b?source=rss-7fe48c278faa------2</link>
            <guid isPermaLink="false">https://medium.com/p/765a402c358b</guid>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[higher-order-components]]></category>
            <category><![CDATA[react-hook]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Md Readwan]]></dc:creator>
            <pubDate>Tue, 17 Sep 2024 19:17:48 GMT</pubDate>
            <atom:updated>2024-09-17T19:17:48.320Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H7axwHJB9QtDs4c5MwINng.png" /></figure><p>As React developers, we’ve all encountered scenarios where we need to render lists of data. While .map() method works well, repeating the same logic every time render a list can become exhausting, and leads to code duplication. Fortunately, there’s a cleaner, scalable way to handle this, using reusable component, higher order component, or custom hook.</p><p>In this article, I’ll share an approach for improving list rendering in React, ensuring your code stays DRY, reusable, and easier to maintain.</p><h4><strong>Main Problem: Repetitive .map() Logic</strong></h4><p>Imagine you’re building a dashboard for an e-commerce application. The dashboard includes several lists: recent orders, top-selling products, user comments, etc. You need to render each list using a `.map()` function. Here’s a typical example:</p><pre>const orders = [...]; // Array of order data<br><br>return (<br>  &lt;&gt;<br>    {orders.map((order, index) =&gt; (<br>      &lt;OrderComponent key={index} data={order} /&gt;<br>    ))}<br>  &lt;/&gt;<br>);</pre><p>Now, you can see repeating the .map() logic for every list, cluttering your component with similar code. Here’s where reusable pattern can be handy.</p><h4>Solution: A Reusable ListComponent</h4><p>To avoid duplicating the .map() logic, we can create a reusable ListComponent that abstracts the mapping logic and allows us to render different components based on the data.</p><pre>function ListComponent({ data, renderItem }) {<br> return (<br> &lt;&gt;<br>  {data.map((item, index) =&gt; renderItem(item, index))}<br> &lt;/&gt;<br> );<br>}</pre><p><strong>Usage:</strong></p><pre>&lt;ListComponent <br> data={orders} <br> renderItem={(order, index) =&gt; (<br> &lt;OrderComponent key={index} data={order} /&gt;<br> )} <br>/&gt;</pre><p><strong>In this pattern:</strong><br>renderItem: A function that defines how each item should be rendered</p><p>By passing a different renderItem function, we can reuse ListComponent for any list. This results in a clean, reusable component, reducing repetitive .map() logic.</p><h4>More Flexibility: Higher-Order Component(HOC)</h4><p>If multiple components need list rendering, let’s take this pattern further by creating a HigherOrder Component. A HOC allows to enhance any component with additional functionality — in this case, list rendering.</p><pre>function withListRendering(WrappedComponent) {<br> return function ListWrapper({ data, …props }) {<br> return (<br> &lt;&gt;<br> {data.map((item, index) =&gt; (<br> &lt;WrappedComponent key={index} data={item} {…props} /&gt;<br> ))}<br> &lt;/&gt;<br> );<br> };<br>}</pre><p><strong>Usage:</strong></p><pre>const EnhancedOrderComponent = withListRendering(OrderComponent);<br>// Now render the component with any data array<br>&lt;EnhancedOrderComponent data={orders} /&gt;</pre><p>By wrapping OrderComponent with the withListRendering HOC, we’ve automatically added list rendering behavior without modifying the original component. This pattern keeps code modular.</p><h4>For Hook Lovers: Custom Hook for List Rendering</h4><p>React hooks offer a functional way to encapsulate logic. If you prefer using hooks, here is an example of list rendering with a custom hook.</p><pre>function useListRenderer(data, renderItem) {<br> return data.map((item, index) =&gt; renderItem(item, index));<br>}</pre><p><strong>Usage:</strong></p><pre>function OrdersDashboard({ orders }) {<br> const orderList = useListRenderer(orders, (order, index) =&gt; (<br> &lt;OrderComponent key={index} data={order} /&gt;<br> ));<br>return &lt;&gt;{orderList}&lt;/&gt;;<br>}</pre><p>This approach moves .map() logic into the hook, keep the rendering logic separate from the component’s structure. It’s another way to keep component lean and focused on presentation.</p><h4>Real-World Scenario: An E-Commerce Dashboard</h4><p>Let’s apply this pattern to a real-world scenario. Imagine you’re building an e-commerce admin dashboard where multiple lists of orders, products, reviews, etc need to be rendered.</p><p>Using the ListComponent approach, you could render a list of orders like this:</p><pre>&lt;ListComponent <br> data={orders} <br> renderItem={(order, index) =&gt; (<br> &lt;OrderComponent key={index} data={order} /&gt;<br> )} <br>/&gt;</pre><p>When we need to render a different list, such as a products, same ListComponent can be reused with different renderItem function:</p><pre>&lt;ListComponent <br> data={products} <br> renderItem={(product, index) =&gt; (<br> &lt;ProductComponent key={index} data={product} /&gt;<br> )} <br>/&gt;</pre><p>No need to rewrite the .map() logic — just reuse the ListComponent with different data and components. This makes codebase more maintainable as it grows.</p><h4>Conclusion: Clean, Reusable, and Scalable Code</h4><p>The reusable ListComponent pattern simplifies React list rendering by abstracting the repetitive `.map()` logic. Whether you prefer using the basic component approach, HOC, or custom hook, this pattern ensures code is clean and reusable.</p><p>Building a React component with multiple lists, consider using one of these patterns to keep components focused on presentation while separating the list logic outside.</p><p><em>What other reusable patterns have you found useful in React? Let me know in the comments! and finally thanks for reading.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=765a402c358b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding `setTimeout` and `setInterval` in JavaScript]]></title>
            <link>https://readwanmd.medium.com/understanding-settimeout-and-setinterval-in-javascript-4d0164e47ecd?source=rss-7fe48c278faa------2</link>
            <guid isPermaLink="false">https://medium.com/p/4d0164e47ecd</guid>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Md Readwan]]></dc:creator>
            <pubDate>Tue, 16 Jul 2024 09:41:47 GMT</pubDate>
            <atom:updated>2024-07-16T09:41:47.558Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-2LSsEwwMPlYX7pTk9EkSQ.png" /></figure><p>JavaScript provides several ways to handle timing events, and two of the most commonly used methods are `setTimeout` and `setInterval`. These functions allow you to schedule code execution after a specified amount of time or repeatedly at regular intervals. In this article, we’ll explore how these functions work and provide practical examples to illustrate their usage.</p><h3>setTimeout</h3><p>The setTimeout function is used to execute a function or a piece of code once after a specified delay. The syntax for `setTimeout` is as follows:</p><pre>javascript<br>setTimeout(function, delay, [arg1, arg2, …]);</pre><p>- <strong>function</strong>: The function or code to execute.<br>- <strong>delay</strong>: The time in milliseconds to wait before executing the function.<br>- <strong>[arg1, arg2, …]</strong>: Optional arguments to pass to the function when it is executed.</p><p><strong>Example 1: Basic Usage</strong></p><pre>javascript<br>function sayHello() {<br> console.log(‘Hello, World!’);<br>}<br><br>setTimeout(sayHello, 2000); <br>// Outputs “Hello, World!” after 2 seconds</pre><p>In this example, the sayHello function is executed once after a 2-second delay.</p><p><strong>Example 2: Passing Arguments</strong></p><pre>javascript<br>function greet(name) {<br> console.log(‘Hello, ‘ + name + ‘!’);<br>}<br><br>setTimeout(greet, 2000, ‘Alice’); <br>// Outputs “Hello, Alice!” after 2 seconds<br></pre><p>Here, we pass the argument ‘Alice’ to the greet function, which is executed after a 2-second delay.</p><p><strong>Example 3: Using Anonymous Functions</strong></p><pre>javascript<br>setTimeout(function() {<br> console.log(‘This is an anonymous function!’);<br>}, 3000); <br>// Outputs “This is an anonymous function!” after 3 seconds</pre><p>You can also use anonymous functions directly within setTimeout.</p><h3><strong>setInterval</strong></h3><p>The setInterval function is used to execute a function or a piece of code repeatedly at specified intervals. The syntax for setInterval is similar to setTimeout:</p><pre>javascript<br>setInterval(function, interval, [arg1, arg2, …]);</pre><p>- <strong>function:</strong> The function or code to execute.<br>- <strong>interval:</strong> The time in milliseconds between each execution.<br>- <strong>[arg1, arg2, …]:</strong> Optional arguments to pass to the function each time it is executed.</p><p><strong>Example 1: Basic Usage</strong></p><pre>javascript<br>function sayHello() {<br> console.log(‘Hello, World!’);<br>}<br><br>setInterval(sayHello, 1000); <br>// Outputs “Hello, World!” every 1 second</pre><p>In this example, the sayHello function is executed every second.</p><p><strong>Example 2: Passing Arguments</strong></p><pre>javascript<br>function greet(name) {<br> console.log(‘Hello, ‘ + name + ‘!’);<br>}<br><br>setInterval(greet, 1000, ‘Alice’); <br>// Outputs “Hello, Alice!” every 1 second</pre><p>Here, we pass the argument ‘Alice’ to the greet function, which is executed every second.</p><p><strong>Example 3: Using Anonymous Functions</strong></p><pre>javascript<br>setInterval(function() {<br> console.log(‘This is an anonymous function!’);<br>}, 2000); <br>// Outputs “This is an anonymous function!” every 2 seconds</pre><p>You can use anonymous functions directly within setInterval as well.</p><h3><strong>Clearing Timers</strong></h3><p>Both setTimeout and setInterval return a timer ID, which can be used to clear the timers if needed. This is done using the clearTimeout and clearInterval functions, respectively.</p><p><strong>Example: Clearing setTimeout</strong></p><pre>javascript<br>const timeoutId = setTimeout(function() {<br> console.log(‘This will not run.’);<br>}, 5000);<br><br>clearTimeout(timeoutId); // Cancels the timeout</pre><p><strong>Example: Clearing setInterval</strong></p><pre>javascript<br>const intervalId = setInterval(function() {<br> console.log(‘This will run only once.’);<br>}, 1000);<br><br>setTimeout(function() {<br> clearInterval(intervalId); // Stops the interval after 3 seconds<br>}, 3000);</pre><p>In this example, the clearInterval function is called after 3 seconds, stopping the repeated execution of the function.</p><h3><strong>Practical Use Cases</strong></h3><p><strong>1. Debouncing with setTimeout</strong></p><p>Debouncing is a technique to limit the rate at which a function is executed. For example, you can use setTimeout to debounce a search input field:</p><pre>javascript<br>let timeoutId;<br><br>function debounceSearch(query) {<br> clearTimeout(timeoutId);<br> timeoutId = setTimeout(function() {<br> // Perform search operation<br> console.log(‘Searching for:’, query);<br> }, 300);<br>}<br><br>document.getElementById(‘searchInput’).addEventListener(‘input’, function(event) {<br> debounceSearch(event.target.value);<br>});</pre><p><strong>2. Creating a Simple Timer with setInterval</strong></p><pre>let seconds = 0;<br><br>function updateTimer() {<br> seconds++;<br> console.log(‘Timer:’, seconds);<br>}<br><br>const timerId = setInterval(updateTimer, 1000);<br><br>// Stop the timer after 10 seconds<br>setTimeout(function() {<br> clearInterval(timerId);<br> console.log(‘Timer stopped’);<br>}, 10000);</pre><h4>Conclusion</h4><p>Understanding setTimeout and setInterval is essential for managing timed and repeated actions in JavaScript. These functions enable you to handle tasks like debouncing user input, creating timers, and running periodic updates. By mastering these tools, you can build more efficient web applications.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4d0164e47ecd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Let’s Understand JavaScript Closures: A Fundamental Concept]]></title>
            <link>https://readwanmd.medium.com/lets-understand-javascript-closures-a-fundamental-concept-ff82def08dae?source=rss-7fe48c278faa------2</link>
            <guid isPermaLink="false">https://medium.com/p/ff82def08dae</guid>
            <category><![CDATA[fundamentals]]></category>
            <category><![CDATA[js]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[closure]]></category>
            <dc:creator><![CDATA[Md Readwan]]></dc:creator>
            <pubDate>Tue, 09 Jul 2024 20:44:30 GMT</pubDate>
            <atom:updated>2024-07-09T20:44:30.888Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8y6GGWQNyC_hM9FTJjobnw.png" /></figure><p>Closures are a powerful feature in JavaScript that allow functions to retain access to their lexical scope, even when the function is executed outside that scope. This can sound abstract, but with some simple examples, you’ll see how closures can be both intuitive and incredibly useful in real-world applications.</p><h4>What is a Closure?</h4><p>A closure is created when a function is defined within another function, and the inner function retains access to the outer function’s variables. Essentially, a closure gives you access to an outer function’s scope from an inner function.</p><p>Here’s a simple definition:<br><strong>Closure</strong>: A combination of a function and its lexical environment within which that function was declared.</p><h3>Basic Example</h3><p>Let’s start with a basic example to illustrate the concept of closures:</p><pre>function outerFunction() {<br>  let outerVariable = &#39;I am from the outer function&#39;;<br>function innerFunction() {<br>    console.log(outerVariable);<br>  }<br>  return innerFunction;<br>}<br>const myClosure = outerFunction();<br>myClosure();  // Outputs: I am from the outer function</pre><p>In this example:</p><ul><li>outerFunction contains a variable outerVariable and an inner function innerFunction.</li><li>innerFunction accesses outerVariable and logs it to the console.</li><li>outerFunction returns innerFunction, and we store it in myClosure.</li><li>When myClosure is called, it still has access to outerVariable even though outerFunction has finished executing. This is a closure in action.</li></ul><h4>Real-World Example: Creating Private Variables</h4><p>Closures are often used to create private variables in JavaScript. Here’s an example of how you can use closures to encapsulate data and provide a controlled interface to interact with it:</p><pre>function createCounter() {<br>  let count = 0;<br>return {<br>    increment: function() {<br>      count++;<br>      console.log(count);<br>    },<br>    decrement: function() {<br>      count--;<br>      console.log(count);<br>    },<br>    getCount: function() {<br>      return count;<br>    }<br>  };<br>}<br>const counter = createCounter();<br>counter.increment(); // Outputs: 1<br>counter.increment(); // Outputs: 2<br>counter.decrement(); // Outputs: 1<br>console.log(counter.getCount()); // Outputs: 1</pre><p>In this example:</p><ul><li>createCounter function defines a variable count and returns an object with three methods: increment, decrement, and getCount.</li><li>The methods increment and decrement modify count, while getCount returns its current value.</li><li>The count variable is private to createCounter and cannot be accessed directly from outside. This encapsulation is made possible by closures.</li></ul><h4>Real-World Example: Delayed Execution</h4><p>Closures are also useful for functions that need to remember the context in which they were created, such as setting up delayed execution with setTimeout:</p><pre>function greet(name) {<br>  return function() {<br>    console.log(&#39;Hello, &#39; + name);<br>  };<br>}<br><br>const delayedGreeting = greet(&#39;Alice&#39;);<br>setTimeout(delayedGreeting, 2000); // Outputs: Hello, Alice after 2 seconds</pre><p>In this example:</p><ul><li>greet function returns another function that logs a greeting message.</li><li>delayedGreeting stores the returned function with the captured name variable.</li><li>setTimeout executes delayedGreeting after 2 seconds, and it still has access to name (Alice) due to the closure.</li></ul><h4>Conclusion</h4><p>Closures are a fundamental concept in JavaScript that allow functions to access their lexical scope even after the outer function has finished executing. They enable powerful patterns such as data encapsulation, private variables, and delayed execution.</p><h4>And Finally,</h4><p><em>Please don’t hesitate to point out any mistakes in my writing and any errors in my logic.</em></p><p><em>I’m appreciative that you read my piece.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ff82def08dae" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Chunking an Array in JavaScript: Four Ways Compared]]></title>
            <link>https://readwanmd.medium.com/chunking-an-array-in-javascript-four-ways-compared-fe13efa84c8a?source=rss-7fe48c278faa------2</link>
            <guid isPermaLink="false">https://medium.com/p/fe13efa84c8a</guid>
            <category><![CDATA[arrays]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[chunk]]></category>
            <category><![CDATA[array-methods]]></category>
            <dc:creator><![CDATA[Md Readwan]]></dc:creator>
            <pubDate>Sat, 06 Jul 2024 08:54:06 GMT</pubDate>
            <atom:updated>2024-07-06T08:54:06.320Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5Ms3PdR0cwb_rc_oeH6R3w.png" /></figure><p>Chunking an array means splitting it into smaller arrays of a specified size. This is useful for data processing, pagination, and more. We’ll explore four methods to chunk an array and compare their performance.</p><p>First, let’s create an array of numbers from 1 to 10:</p><pre>const arr = Array.from({ length: 10 }, (_, i) =&gt; i + 1);</pre><p>Array.from() is used to generate an array with elements from 1 to 10. <br>Now, we’ll look at four ways to chunk this array.</p><h4>Method 1: Using a For Loop</h4><pre>function chunkArr(arr, size) {<br> let res = [];<br> for (let i = 0; i &lt; arr.length; i += size) {<br> res.push(arr.slice(i, size + i));<br> }<br> return res;<br>}<br><br>console.time(&quot;for&quot;);<br>console.log(chunkArr(arr, 2));<br>console.timeEnd(&quot;for&quot;);</pre><p><strong>Output</strong>:</p><pre><br>[ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ], [ 7, 8 ], [ 9, 10 ] ]<br>for: 4.363ms<br></pre><p><strong>Explanation:</strong> This function iterates through the array in steps of the specified chunk size. It slices the array at each step and adds the resulting sub-array to the result array (res). The performance measurement shows it took about 4.363 milliseconds.</p><h4>Method 2: Using `Array.reduce()`</h4><pre>function chunkArr2(arr, size) {<br> if (size &lt;= 0) throw new Error(&#39;Chunk size must be a positive integer&#39;);<br> return arr.reduce((acc, _, i) =&gt; {<br> if (i % size === 0) acc.push(arr.slice(i, i + size));<br> return acc;<br> }, []);<br>}<br>console.time(&quot;reduce&quot;);<br>console.log(chunkArr2(arr, 2));<br>console.timeEnd(&quot;reduce&quot;);</pre><p><strong>Output:</strong></p><pre>[ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ], [ 7, 8 ], [ 9, 10 ] ]<br>reduce: 0.069ms</pre><p><strong>Explanation: </strong>Here Array.reduce() is used to build the chunked array. It checks if the current index is a multiple of the chunk size and slices the array accordingly. This method is significantly faster, taking only about 0.069 milliseconds.</p><h4>Method 3: Using `Array.splice()`</h4><pre>let [list, chunkSize] = [arr, 2];<br>console.time(&#39;splice&#39;);<br>list = […Array(Math.ceil(list.length / chunkSize))].map(_ =&gt; list.splice(0, chunkSize));<br>console.timeEnd(&#39;splice&#39;);<br>console.log(list);</pre><p><strong>Output:</strong></p><pre>[ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ], [ 7, 8 ], [ 9, 10 ] ]<br>splice: 0.048ms</pre><p><strong>Explanation:</strong> This approach uses Array.splice() in combination with Array.map() to chunk the array. It creates a new array with the required number of chunks and uses splice() to remove and collect chunks from the original array. This method is also very fast, taking about 0.048 milliseconds.</p><h4>Method 4: Recursive Approach</h4><pre>const chunk = function(array, size) {<br> if (!array.length) {<br> return [];<br> }<br> const head = array.slice(0, size);<br> const tail = array.slice(size);<br>return [head, …chunk(tail, size)];<br>};<br><br>console.time(‘recursive’);<br>console.log(chunk(arr, 2));<br>console.timeEnd(‘recursive’);</pre><p><strong>Output:</strong></p><pre>[ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ], [ 7, 8 ], [ 9, 10 ] ]<br>recursive: 4.372ms</pre><p><strong>Explanation</strong>: This recursive method splits the array into the first chunk (head) and the remaining elements (tail). It then recursively processes the tail, concatenating the results. While more elegant, this method is slower than the reduce and splice methods, taking about 4.372 milliseconds.</p><h3>Conclusion</h3><p>All four methods successfully chunk the array into sub-arrays of the specified size. However, their performance varies significantly:</p><p>1. For Loop: 4.363ms<br>2. Reduce: 0.069ms<br>3. Splice: 0.048ms<br>4. Recursive: 4.372ms</p><p>The splice and reduce methods are the fastest, making them preferable for performance-critical applications. While functional, the for loop and recursive methods are slower and might be less suitable for large datasets.</p><p>Depending on your needs and readability preferences, you can choose a suitable method for chunking arrays in your JavaScript projects.</p><blockquote>You can find more approach <a href="https://stackoverflow.com/questions/8495687/split-array-into-chunks?page=1&amp;tab=scoredesc#tab-top">here</a></blockquote><h3>And Finally,</h3><blockquote><em>Please don’t hesitate to point out any mistakes in my writing and any errors in my logic.</em></blockquote><blockquote><em>I’m appreciative that you read my piece. Please remember to clap and share this post with your fellow developers.</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fe13efa84c8a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Let's understand the differences: href="", href="#", and href="javascript:void(0)"]]></title>
            <link>https://readwanmd.medium.com/lets-understand-the-differences-href-href-and-href-javascript-void-0-57c7fbfa77b1?source=rss-7fe48c278faa------2</link>
            <guid isPermaLink="false">https://medium.com/p/57c7fbfa77b1</guid>
            <category><![CDATA[html]]></category>
            <category><![CDATA[anchor-tag]]></category>
            <category><![CDATA[html-css]]></category>
            <category><![CDATA[html-attribute]]></category>
            <dc:creator><![CDATA[Md Readwan]]></dc:creator>
            <pubDate>Wed, 03 Jul 2024 14:44:59 GMT</pubDate>
            <atom:updated>2024-07-03T14:44:59.874Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YSgoZs2r9zfCOp2kpklHyw.png" /></figure><h4>Empty HREF: href=&quot;&quot;</h4><p>Using an empty href attribute (href=&quot;&quot;) reloads the current page. This is like clicking the refresh button of the browser.</p><h4>href=&quot;#&quot;</h4><p>The href=”#” attribute makes the page scroll to the top. If you don’t want this, you can stop the behavior with JavaScript:</p><pre>&lt;a href=”#” onclick=”return false;”&gt;Hey&lt;/a&gt;<br>&lt;!--! and there ane many ways with js to achive this --&gt;</pre><h4>href=&quot;javascript:void(0)&quot;</h4><p>Sometimes you will see href=&quot;javascript:void(0);&quot; inside an &lt;a&gt; tag. This makes a link that does nothing when clicked. Other ways to do this are:</p><ul><li>href=&quot;javascript:{}&quot;</li><li>href=&quot;javascript:null&quot;</li></ul><p>These links do nothing it’s best to avoid them.</p><h4>href=&quot;#any_id&quot;</h4><p>The href=&quot;#any_id&quot; attribute does nothing unless have an element with an ID of any_idon the page. By clicking the link will scroll to that element. <br>To avoid any scroll use a different id value that doesn&#39;t exist on the page.</p><h4>Best Practices:</h4><p><strong>Use a Button or Span: </strong>If your link doesn’t navigate anywhere, you can use &lt;button&gt; or &lt;span&gt; instead of an &lt;a&gt; element as well as you can style these elements as needed using raw CSS or CSS framework.</p><h4>Lastly, let’s summarize these</h4><blockquote>href=&quot;#&quot; scrolls the current page to the top.</blockquote><blockquote>href=&quot;javascript:void(0)&quot; does nothing.</blockquote><blockquote>href=&quot;#any_id&quot; does nothing unless there is an element with the specific ID.</blockquote><h3>And finally</h3><p>I’m appreciative that you read my piece. Please remember to clap and share this post with your fellow developers.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=57c7fbfa77b1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Let's do 3 Sum with JavaScript]]></title>
            <link>https://readwanmd.medium.com/lets-do-3-sum-with-javascript-dd51bd012e24?source=rss-7fe48c278faa------2</link>
            <guid isPermaLink="false">https://medium.com/p/dd51bd012e24</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[leetcode]]></category>
            <category><![CDATA[problems]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[problem-solving]]></category>
            <dc:creator><![CDATA[Md Readwan]]></dc:creator>
            <pubDate>Sat, 23 Dec 2023 18:35:32 GMT</pubDate>
            <atom:updated>2024-07-06T12:55:10.253Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sJKE15sHkOQaXadcUn_qrA.png" /></figure><p>This problem is similar to the “Two Sum” problem, and how can we come up with an efficient solution just by making a small modification. After that, we will also give you a try of the code so that you can understand it well. So let’s get started.</p><p>First of all, let’s make sure that we understand the problem statement correctly. In this problem, we have given an array of integers, and we have to find out all the unique triplets such that their sum is equal to 0, and there is one more condition: we cannot choose the same index twice. It simply means that if we have chosen an index, we cannot use it again to find the total sum of 0.</p><p>So given all of these conditions, we have to find out all of the possible triplets. Let us look at our sample test cases. In our first test case [-1, 0, 1, 2, -1, -4], right now, what are some of the triplets that, when summed, will give us the total sum of 0. First of all, I can find a triplet of -1, -1, and 2. If we add all of them, we will get the sum 0, and similarly, we can get one more triplet that will be 0, 1, and -1. In this particular array, we have two unique triplets by which we can form the total sum as 0. right? So for this particular test case, these two triplets will be our answer.</p><p>In our next test case, we have [0, 1, 1], so this is the only triplet, and if we sum all of these elements, the sum will not be 0, right? So for this particular test case, an empty array will be the answer.</p><p>Now let us look at our third test case. we can see that once again we have an array [0, 0, 0], and all of its elements are zero. Now we know that it says that these elements cannot be duplicated, but if we notice, we are not duplicating the indices. correct? Only the element is duplicated, so even if two elements have the same value and they are at different indices, we can pick them, so one such triplet that can be formed will be 0 0, and 0, and if we add them all up, we get the total sum of 0.</p><p>So for this particular test, only this triplet will be answered.</p><p>I want to let you know that this problem is based on a similar problem, “Two Sum,” where we have given an array and have to find out two integers whose sum equals a target value. I want you to take a recap and realize what we did wrong with our original and what we did right. We spotted this array correctly, and as soon as we sort it, we get our array something like [-4, -1, -1, 0, 1, 2] and let us have to find out two values that sum up and give our target value of -3.</p><p>So what was the approach over here? We sorted the array, and then what did we do?</p><p>We took two pointers first in the beginning, and then at the very end, we summed both of these values, so my current sum will be -4 plus 2 and that is -2. Now since this target value is smaller than my sum, that means we have to pick a smaller number, and how did we pick a smaller number? We moved our right pointer one space backward, and that is how we will try to get the sum as -4 plus 1, and that will be -3 for our pair.</p><p><em>So just try to keep this in mind, and based upon this, we will build an efficient solution to our actual problem.</em></p><p>So once again, we have a sample array, and what did we do? First of all, we sorted it as soon as we found the array, and the array will look something like this: [-4, -1, -1, 0, 1, 2], and now we have to convert this problem to the two-sum problem.</p><p>So here is something that we can do. What we can do is pick our first element to be -4, so out of the triplet we get one value or we fix one value so that one of our values will be minus four, and we make a condition so that one of my values is -4, and what if the array that I’m remaining with is this entire array [-1, -1, 0, 1, 2]. right?</p><p>Now notice what our problem has reduced to: using this array, we can once again take a left pointer and a right pointer. correct? and we have one value that is fixed for now. Instead of finding the triplets, we have to find that pair plus this fixed value, and our total sum should be 0.</p><p>So we will apply the same approach as ours to some questions, and what we’re going to do is take the minor 4 value and then try to find a triplet such that when I add these three values, my total sum should be 0.</p><p><em>Just wait for a little while, and all of this will start making sense.</em></p><p>For this particular condition, when we choose our first value as -4, we will not find a triplet, so this part is done. Now try to understand that we took care of all the triplets that could start with -4 right now. we have to move ahead, so what do we do this time? we are going to choose -1 as our fixed value. That is the value at the first index, so we fix our value to -1, and then what is the array that I’m remaining with? We are remaining with only [-1, 0, 1, 2]. So we have an array over here.</p><p>So once again, our problem changes. Now the fixed value is -1, and once again, we will take two pointers left and right, and then we will try to come up with a pair plus this -1, and the sum should be 0.</p><p>This should give us some triplets, so we have a value of -1, and then what can we do? we can try to find a triplet of -1 and 2 that will be 0, and then if we move ahead, we will find one more triplet of -1 plus 0 and then 1. that is once again equal to 0. So I found two triplets, and one added gives us the sum as 0, which is correct.</p><p><em>I hope it has started to make a little bit of sense, so let us keep moving ahead.</em></p><p>This time I’m done with this -1 again, and if we see we have one more -1 for this time, I’m going to fix this value as my constant value. What is the array [0, 1, 2] that I’m remaining with? I am remaining with 0 1 and 2. So once again, my problem reduces to 0, 1, and 2, and I will take a left pointer and a right pointer, this is my fixed value, so once again, I will try to find a pair along with the sixth value and try to get the total reward of 0. This time I will get one more triplet, which is -1 plus 0 plus 1, and that is equal to 0. Just keep moving ahead now, so now I will fix my next value, which is 0, so I fix it, and what are the remaining values 1 and 2? So this is the new use case that I have to work with, and if we realize this, it will once again not give me any triplets. So while going through all of this, how many triplets did we find? we found this, this, and this, so there are three triplets. Since the problem asks for unique triplets, we can add all of these triplets to a function. All the duplicate values will just go away, and we cannot have duplicate elements left with our answer, and these will be our unique triplets.</p><pre>const threeSum = function (nums) {<br> const target = 0;<br> nums = nums.sort((a, b) =&gt; a - b);<br> let output = [];<br><br> for (let i = 0; i &lt; nums.length; i++) {<br>  let start = i + 1;<br>  let end = nums.length - 1;<br><br>  while (start &lt; end) {<br>   let sum = nums[i] + nums[start] + nums[end];<br>   if (sum == target) {<br>    output.push([nums[i], nums[start], nums[end]]);<br>    start++;<br>    end--;<br>   } else if (sum &lt; target) {<br>    start++;<br>   } else {<br>    end--;<br>   }<br>  }<br> }<br><br> // remove duplicate arrays<br> const uniqueArrays = new Set(output.map(JSON.stringify));<br> const result = Array.from(uniqueArrays, JSON.parse);<br> return result;<br>};<br><br>let nums = [-1, 0, 1, 2, -1, -4];<br>console.log(threeSum(nums));</pre><h3>In Conclusion,</h3><p>In conclusion, the problem at hand is to find unique triplets in an array such that their sum equals zero, with the constraint of not using the same index twice. To approach this efficiently, we draw parallels with the “Two Sum” problem, sorting the array and fixing one element at a time to transform the problem into finding pairs that sum up to a target value. By iteratively fixing elements and applying the two-pointer technique on the remaining array, we can identify unique triplets that satisfy the given conditions.</p><p>The key insight is to break down the problem into smaller subproblems, where each fixed element reduces the problem to finding pairs in the remaining array. This approach helps us avoid duplicate triplets and efficiently navigate through the array to identify all valid solutions.</p><p>By following this method and carefully handling edge cases, such as arrays with identical elements at different indices, we can find and accumulate unique triplets that meet the criteria. The final step involves ensuring uniqueness by eliminating duplicate triplets before presenting the solution.</p><p>Overall, this strategy optimizes the solution to the problem, providing a clear and systematic approach to finding unique triplets with a sum of zero in a given array.</p><h3>And Finally,</h3><blockquote>Please don’t hesitate to point out any mistakes in my writing and any errors in my logic.</blockquote><blockquote><em>I’m appreciative that you read my piece. Please remember to clap and share this post with your fellow developers.</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dd51bd012e24" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[High-level overview of Reconciliation and React Fiber]]></title>
            <link>https://readwanmd.medium.com/high-level-overview-of-reconciliation-and-react-fiber-9b6da00ee416?source=rss-7fe48c278faa------2</link>
            <guid isPermaLink="false">https://medium.com/p/9b6da00ee416</guid>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[reconciliation]]></category>
            <category><![CDATA[react-fiber]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Md Readwan]]></dc:creator>
            <pubDate>Tue, 19 Dec 2023 05:58:05 GMT</pubDate>
            <atom:updated>2023-12-19T05:58:05.294Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xbadW76BUnaIxlYwow1KjA.png" /></figure><h3>Reconciliation</h3><p>React’s diff algorithm compares two trees to identify the parts that require modification or update.</p><p><strong>Update<br></strong>a change to the data that a React application renders. typically the outcome of setState. leads to a re-render in the end. The big idea in React is to think of updates as if the whole app is being re-rendered each time there’s a change. Instead of worrying about how to move the app from one state to another, React lets developers think more simply and clearly.</p><p>re-rendering the entire app every time something changes works well for really simple apps. But in more complex apps, it’s not efficient because it uses up a lot of computer power. React has tricks that make it look like the whole app is being refreshed without actually doing it. This process is called “reconciliation.”</p><p><strong>Reconciliation vs Rendering</strong></p><p>React is flexible because it separates reconciliation and rendering into two steps. Reconciliation figures out what parts of the app need to change, and rendering actually makes those changes visible. React and React Native can use their own ways of showing things on the screen but still share the same reconciliation process from React.</p><p><strong>Scheduling<br></strong>The key points are:</p><ul><li>In a UI, every update doesn’t need to be applied immediately; in fact, doing so can be wasteful, causing frames to drop and degrading the user experience.</li><li>• Different kinds of changes have different levels of importance. For example, making an animation smooth is more important than updating some information from a data store.</li><li>There are two approaches to deciding when to make changes: one where you (the programmer) decide, and another where React (the framework) decides for you.</li></ul><h3>What is a fiber?</h3><p>Fiber is to enable React to take advantage of scheduling. Specifically, It lets React:</p><ul><li>pause work and come back to it later.</li><li>assign priority to different types of work.</li><li>reuse previously completed work.</li><li>abort work if it’s no longer needed.</li></ul><p>In order to do any of this, we first need a way to break work down into units. In one sense, that’s what a fiber is. A fiber represents a <strong>unit of work</strong>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9b6da00ee416" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Let's understand Redux in simple 4 steps by making a counter application]]></title>
            <link>https://readwanmd.medium.com/lets-understand-redux-in-simple-4-steps-by-making-a-counter-application-17bfc052c6f1?source=rss-7fe48c278faa------2</link>
            <guid isPermaLink="false">https://medium.com/p/17bfc052c6f1</guid>
            <category><![CDATA[react-redux]]></category>
            <category><![CDATA[redux]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[counter]]></category>
            <dc:creator><![CDATA[Md Readwan]]></dc:creator>
            <pubDate>Sun, 17 Dec 2023 09:57:34 GMT</pubDate>
            <atom:updated>2023-12-17T09:59:53.703Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KQXz-pqcRVxMr76rWRszow.png" /></figure><p>The first thing we need to know is that Redux basically follows three main principles,</p><ol><li>A complete application will have a single state tree or object tree. The advantage is that the application can be easily debugged and it ensures a single source of truth for the data.</li><li>The state will be read-only which can only be changed by doing the action dispatch. That means sometimes if someone needs to change the state they will just dispatch the specific action. Here action is a simple JavaScript object that holds all the information about that action like what type of action will be, what data needs to be changed etc.</li><li>After dispatching a particular action, the state needs to be changed through the necessary pure functions called reducers in Redux.</li></ol><p>Now let’s see how we will use redux. Suppose we want to make a small counter application, Where we can show the count, we can control the increment degree separately and keep the history at the same time, if we want we can clear the count or history separately or with one click.</p><p>So to make this application in React, our component will be like the picture below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/731/1*cYuYWJvG6mPIKLw4TuvGKg.png" /><figcaption>component-tree of our counter app</figcaption></figure><h4><strong>Step 1 — Installing required libraries</strong></h4><pre>yarn add redux react-redux</pre><h4><strong>Step 2 — Create Actions, Action Types, Action Creators, Reducer and Store</strong></h4><p>let&#39;s create a store.js file inside of the src folder. The Redux Store holds the state of the app. The app is always subscribed to the store.</p><p>store.js contain the following code,</p><pre>import { combineReducers, createStore } from &#39;redux&#39;;<br><br>// Action Type<br>export const DECREMENT = &#39;decrement&#39;;<br>export const INCREMENT = &#39;incriment&#39;;<br>export const CLEAR_COUNT = &#39;clear-count&#39;;<br><br>// actions<br>// Action types are constants that are used to define the values used for the type property of Actions.<br>// An action is any object with a type property. Actions help us describe what needs to happen.<br>// also actions contain payload<br>// Action Creator<br>// An action creator is simply a JS function that returns an action.<br>export const incriment = (payload) =&gt; ({<br> type: INCREMENT,<br> payload,<br>});<br><br>export const decriment = (payload) =&gt; ({<br> type: DECREMENT,<br> payload,<br>});<br><br>export const clearCount = () =&gt; ({<br> type: CLEAR_COUNT,<br>});<br><br>// reducer<br>// A reducer is a JS function that takes in initialState and action as input and returns an updated state object.<br>// When an action is dispatched, the relevant reducer will update the state according to the action.<br>const countReducer = (/* previous State */ state = 0, action) =&gt; {<br> // processing area<br> switch (action.type) {<br>  case INCREMENT:<br>   return state + action.payload;<br>  case DECREMENT:<br>   return state - action.payload;<br>  case CLEAR_COUNT:<br>   return 0;<br><br>  default:<br>   return state;<br> }<br> // returned stste is next state<br>};<br><br>// actions<br>const ADD_TO_HISTORY = &#39;addToHistory&#39;;<br>const CLEAR_HISTORY = &#39;clearHistory&#39;;<br><br>let id = 1;<br>function generateId() {<br> return id++;<br>}<br><br>function getTime() {<br> const t = new Date();<br> return t.toLocaleTimeString();<br>}<br><br>// Action Creator<br>export const addHistory = (history) =&gt; ({<br> type: ADD_TO_HISTORY,<br> payload: {<br>  id: generateId(),<br>  action: history.action,<br>  count: history.count,<br>  time: getTime(),<br> },<br>});<br><br>export const clearHistory = () =&gt; ({<br> type: CLEAR_HISTORY,<br>});<br><br>const historyReducer = (state = [], action) =&gt; {<br> switch (action.type) {<br>  case ADD_TO_HISTORY:<br>   return [...state, action.payload];<br><br>  case CLEAR_HISTORY:<br>   return [];<br><br>  default:<br>   return state;<br> }<br>};<br><br>const store = createStore(<br> combineReducers({<br>  count: countReducer,<br>  history: historyReducer,<br> })<br>);<br><br>export default store;</pre><p><strong>Feeling Overwhelmed? <br>Don&#39;t worry, we just finished the most complex part of our app.</strong></p><p>if you want you may divide the given store.js into chunks of code into different file like actions.js, actionCreator.js, reducer.js, and store.js in my case I’m doing all a single store.js</p><h4><strong>Step 3 — Wrap the Root Component with the Provider</strong></h4><p>in main.jsx (vite create react)</p><pre>&lt;Provider store={store}&gt;<br>  &lt;App /&gt;<br>&lt;/Provider&gt;</pre><h4>Step 4 — useDispatch() and useSelector()</h4><p>You can use useSelector() to access the states in the Redux store.</p><p>You can use useDispatch() to access the dispatch method which helps you to dispatch actions</p><p>let&#39;s do that,</p><p>now create a components folder inside of src, then create count.jsx, IncrementButton.jsx, DecrementButton.jsx, History.jsx and ClearHistory.jsx file inside of your components folder</p><p>write the following code into count.jsx</p><pre>import { useSelector } from &#39;react-redux&#39;;<br><br>const Count = () =&gt; {<br> const count = useSelector((state) =&gt; state.count);<br> console.log(count);<br> return (<br>  &lt;div&gt;<br>   &lt;h1&gt;Count: {count}&lt;/h1&gt;<br>  &lt;/div&gt;<br> );<br>};<br>export default Count;</pre><p>write the following code into IncrementButton.jsx</p><pre>import { useDispatch } from &#39;react-redux&#39;;<br>import { INCREMENT, addHistory, incriment } from &#39;../store&#39;;<br><br>const IncrimenntButton = () =&gt; {<br> const dispatch = useDispatch();<br><br> const handleClick = () =&gt; {<br>  dispatch(incriment(1));<br>  dispatch(addHistory({ action: INCREMENT, count: 1 }));<br> };<br><br> return &lt;button onClick={handleClick}&gt;+&lt;/button&gt;;<br>};<br>export default IncrimenntButton;</pre><p>write the following code into DecrementButton.jsx</p><pre>import { useDispatch } from &#39;react-redux&#39;;<br>import { INCREMENT, addHistory, incriment } from &#39;../store&#39;;<br><br>const IncrimenntButton = () =&gt; {<br> const dispatch = useDispatch();<br><br> const handleClick = () =&gt; {<br>  dispatch(incriment(1));<br>  dispatch(addHistory({ action: INCREMENT, count: 1 }));<br> };<br><br> return &lt;button onClick={handleClick}&gt;+&lt;/button&gt;;<br>};<br>export default IncrimenntButton;</pre><p>write the following code into History.jsx</p><pre>import { useSelector } from &#39;react-redux&#39;;<br>const History = () =&gt; {<br> const history = useSelector((state) =&gt; state.history);<br><br> return (<br>  &lt;div&gt;<br>   {history.length &gt; 0 ? (<br>    &lt;h4&gt;<br>     Histories:<br>     &lt;ol&gt;<br>      {history.map((item) =&gt; (<br>       &lt;li key={item.id}&gt;<br>        {item.action} - {item.time}<br>       &lt;/li&gt;<br>      ))}<br>     &lt;/ol&gt;<br>    &lt;/h4&gt;<br>   ) : (<br>    &lt;h4&gt;There is no histories yet!&lt;/h4&gt;<br>   )}<br>  &lt;/div&gt;<br> );<br>};<br>export default History;</pre><p>write the following code into ClearHistory.jsx</p><pre>import { useDispatch } from &#39;react-redux&#39;;<br>import { CLEAR_COUNT, addHistory, clearCount, clearHistory } from &#39;../store&#39;;<br><br>const ClearHistory = () =&gt; {<br> const dispatch = useDispatch();<br><br> const handleClearHistory = () =&gt; {<br>  dispatch(clearHistory());<br> };<br><br> const handleClearCount = () =&gt; {<br>  dispatch(clearCount());<br>  dispatch(addHistory({ action: CLEAR_COUNT }));<br> };<br><br> return (<br>  &lt;div&gt;<br>   &lt;button onClick={handleClearCount}&gt;Clear Count&lt;/button&gt;<br>   &lt;button onClick={handleClearHistory}&gt;Clear History&lt;/button&gt;<br>  &lt;/div&gt;<br> );<br>};<br>export default ClearHistory;</pre><p>now combines this into App.jsx</p><pre>import &#39;./App.css&#39;;<br>import ClearHistory from &#39;./components/ClearHistory&#39;;<br>import Count from &#39;./components/Count&#39;;<br>import DecrimentButton from &#39;./components/DecrimentButton&#39;;<br>import History from &#39;./components/History&#39;;<br>import IncrimenntButton from &#39;./components/IncrimenntButton&#39;;<br><br>function App() {<br> return (<br>  &lt;&gt;<br>   &lt;Count /&gt;<br>   &lt;div&gt;<br>    &lt;IncrimenntButton /&gt;<br>    &lt;DecrimentButton /&gt;<br><br>    &lt;ClearHistory /&gt;<br>   &lt;/div&gt;<br><br>   &lt;History /&gt;<br>  &lt;/&gt;<br> );<br>}<br><br>export default App;</pre><p>That’s about it. We successfully added Redux to a React app.</p><p>If you would want to check over the code and give it a try, here is the <a href="https://codesandbox.io/p/sandbox/react-new?layout=%257B%2522sidebarPanel%2522%253A%2522EXPLORER%2522%252C%2522rootPanelGroup%2522%253A%257B%2522direction%2522%253A%2522horizontal%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522id%2522%253A%2522ROOT_LAYOUT%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522clq9a29go0006356embvw1mx3%2522%252C%2522sizes%2522%253A%255B70%252C30%255D%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522EDITOR%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522id%2522%253A%2522clq9a29go0002356ectuaqhxn%2522%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522SHELLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522id%2522%253A%2522clq9a29go0003356e8k01zj0n%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522DEVTOOLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522id%2522%253A%2522clq9a29go0005356euwaknrjm%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%252C%2522sizes%2522%253A%255B50%252C50%255D%257D%252C%2522tabbedPanels%2522%253A%257B%2522clq9a29go0002356ectuaqhxn%2522%253A%257B%2522id%2522%253A%2522clq9a29go0002356ectuaqhxn%2522%252C%2522tabs%2522%253A%255B%255D%257D%252C%2522clq9a29go0005356euwaknrjm%2522%253A%257B%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522clq9a29go0004356ew0tmit41%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522UNASSIGNED_PORT%2522%252C%2522port%2522%253A0%252C%2522path%2522%253A%2522%252F%2522%257D%255D%252C%2522id%2522%253A%2522clq9a29go0005356euwaknrjm%2522%252C%2522activeTabId%2522%253A%2522clq9a29go0004356ew0tmit41%2522%257D%252C%2522clq9a29go0003356e8k01zj0n%2522%253A%257B%2522tabs%2522%253A%255B%255D%252C%2522id%2522%253A%2522clq9a29go0003356e8k01zj0n%2522%257D%257D%252C%2522showDevtools%2522%253Atrue%252C%2522showShells%2522%253Atrue%252C%2522showSidebar%2522%253Atrue%252C%2522sidebarPanelSize%2522%253A15%257D">Code Sandbox version</a>. <br><a href="https://7jgp4x.csb.app/">Check Live</a></p><h3><strong>In Conclusion,</strong></h3><p>It may seem challenging at first to integrate Redux into your React application. But when we take each idea individually and work out the reasoning on our own, it becomes much easier.</p><p>I’m still trying to study these ideas on my own. Please don’t hesitate to point out any errors in my logic and the issues you run across.</p><p>I’m appreciative that you read my piece. Please remember to like and share the post with your fellow developers.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=17bfc052c6f1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploy Vite REACT app using GitHub pages, with the help of gh-pages package.]]></title>
            <link>https://readwanmd.medium.com/deploy-vite-react-app-using-github-pages-with-the-help-of-gh-pages-package-3c697dbea251?source=rss-7fe48c278faa------2</link>
            <guid isPermaLink="false">https://medium.com/p/3c697dbea251</guid>
            <category><![CDATA[github-pages]]></category>
            <category><![CDATA[deploy]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Md Readwan]]></dc:creator>
            <pubDate>Mon, 11 Dec 2023 12:06:27 GMT</pubDate>
            <atom:updated>2023-12-11T12:06:27.540Z</atom:updated>
            <content:encoded><![CDATA[<h3>Setting up a Vite REACT app on GitHub Pages can be a bit confusing for beginners. That’s why we have gh-pages! In just 5 simple steps, you can deploy your React app using gh-pages. Let’s begin.</h3><p>Step 1: Creating a GitHub repository</p><p>Step 2: Install <a href="https://www.npmjs.com/package/gh-pages">gh-pages</a> package as a dev-dependency</p><pre>npm install gh-pages --save-dev<br>or<br>yarn add -D gh-pages</pre><p>Step 3: Set the config</p><pre>// add this line at your package.json file in first line<br>// change username and repository to yours<br>&quot;homepage&quot;: &quot;https://username.github.io/repository-name&quot;,<br><br>// add following two line to scripts on package.json file<br>&quot;predeploy&quot;: &quot;yarn build&quot;, // or, npm run build<br>&quot;deploy&quot;: &quot;gh-pages -d dist&quot;,</pre><p>Now, go to your vite.config.js file and add</p><pre>// change repository-name to yours<br>base: &#39;/repository-name/&#39;,</pre><p>Step 4: Push your project to GitHub repository</p><p>Step 5: Deploy</p><pre>npm run deploy<br>or <br>yarn deploy</pre><p>Well done your react app is live now! 👏</p><blockquote><em>To visit your app go to,</em><br>your repository &gt; settings &gt; pages &gt; Here you will find live site link.<br><em>or directly, goto previously added homepage link to package.json file</em></blockquote><p>if your site is not live immediately don’t be scared, to go live there may take a few minutes.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3c697dbea251" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[15 javaScript array method example using emoji]]></title>
            <link>https://readwanmd.medium.com/15-javascript-array-method-example-using-emoji-88b3f5b6f1f8?source=rss-7fe48c278faa------2</link>
            <guid isPermaLink="false">https://medium.com/p/88b3f5b6f1f8</guid>
            <category><![CDATA[js]]></category>
            <category><![CDATA[arrays]]></category>
            <category><![CDATA[js-array]]></category>
            <category><![CDATA[array-methods]]></category>
            <dc:creator><![CDATA[Md Readwan]]></dc:creator>
            <pubDate>Tue, 17 Aug 2021 17:42:03 GMT</pubDate>
            <atom:updated>2021-08-17T17:42:03.215Z</atom:updated>
            <content:encoded><![CDATA[<h4>Learn js array method fun way</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LTqPz_Bwh2Ku8ppYbk72JQ.png" /></figure><p>[‘👨’, ‘👩’].join([‘💘’]) // [‘👨💘👩’]<br><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/join"><em>MDN reference</em></a></p><p>[‘😊’, ‘😎’].concat([‘😋’]) // [‘😊’, ‘😎’, ‘😋’]<br><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat"><em>MDN reference</em></a></p><p>[‘😊’, ‘😎’, ‘😋’].slice(2) // [‘😋’]<br><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice"><em>MDN reference</em></a></p><p>[‘😊’, ‘😎’, ‘😋’].splice(2, 0, ‘😍’) // [‘😊’, ‘😎’, ‘😍’, ‘😋’]<br><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice"><em>MDN reference</em></a></p><p>[‘😊’, ‘😎’, ‘😋’].indexOf(‘😎’) // 1<br><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexof"><em>MDN reference</em></a></p><p>[‘😊’, ‘😎’, ‘😎’, ‘😋’].lastIndexOf(‘😎’) //2<br><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf"><em>MDN reference</em></a></p><p>[‘😊’, ‘😎’, ‘😋’].reverse() // [‘😋’, ‘😎’, ‘😊’]<br><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse"><em>MDN reference</em></a></p><p>[‘😊’, ‘😎’, ‘😋’].shift() // [‘😎’, ‘😋’]<br><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/shift"><em>MDN reference</em></a></p><p>[‘😊’, ‘😎’, ‘😋’].unshift(‘😏’) // [‘😏’, ‘😊’, ‘😎’, ‘😋’]<br><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/unshift"><em>MDN reference</em></a></p><p>[‘😊’, ‘😎’, ‘😋’].push(‘😏’) // [‘😊’, ‘😎’, ‘😋’, ‘😏’]<br><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/push"><em>MDN reference</em></a></p><p>[‘😊’, ‘😎’, ‘😋’].pop() // [‘😊’, ‘😎’]<br><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/pop"><em>MDN reference</em></a></p><p>[‘😊’, ‘😎’, ‘😋’].sort() //[‘😊’, ‘😋’, ‘😎’]<br><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort"><em>MDN reference</em></a></p><p>[‘😊’, ‘😎’, ‘😋’].fill(‘😎’, 1, 3) // [‘😊’, ‘😎’, ‘😎’]<br><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/fill"><em>MDN reference</em></a></p><p>[‘😀’, [‘😉’, ‘🥱’], [‘😛’, ‘😲’], [[[‘💰’]]]].flat(3) // [‘😀’, ‘😉’, ‘🥱’, ‘😛’, ‘😲’, ‘💰’]<br><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat"><em>MDN reference</em></a></p><p>[‘😊’, ‘😎’, ‘😋’].includes(‘😎’) // true<br><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes"><em>MDN reference</em></a></p><p>Thanks for reading ❤</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=88b3f5b6f1f8" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>