<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Al - Naucode</title>
    <description>The latest articles on DEV Community by Al - Naucode (@naucode).</description>
    <link>https://dev.to/naucode</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F671687%2F9ea42f75-fcba-40ee-be96-863fc0e6fc8e.png</url>
      <title>DEV Community: Al - Naucode</title>
      <link>https://dev.to/naucode</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/naucode"/>
    <language>en</language>
    <item>
      <title>How I was able to improve my clients satisfaction by 10x 🪄</title>
      <dc:creator>Al - Naucode</dc:creator>
      <pubDate>Mon, 27 Feb 2023 14:05:48 +0000</pubDate>
      <link>https://dev.to/naucode/how-i-was-able-to-improve-my-clients-satisfaction-by-10x-15k2</link>
      <guid>https://dev.to/naucode/how-i-was-able-to-improve-my-clients-satisfaction-by-10x-15k2</guid>
      <description>&lt;p&gt;Today is the time to talk about something that probably is happening to some of you. I work as a freelancer and do full-stack development gigs; although I like doing front-end stuff more, but there is something that always gives me issues: &lt;strong&gt;Receiving feedback from not tech-savvy clients&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;For them, it is complicated to explain what is wrong, but for me (&lt;em&gt;like for any developer&lt;/em&gt;), it is complicated to fix something when I don't know &lt;strong&gt;what they want to change&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Trying to solve my biggest issue as a front-end freelancer
&lt;/h2&gt;

&lt;p&gt;To help them on that task, I have tried many things: Trello cards, a Notion board, leaving comments in a Figma file, and even &lt;strong&gt;getting them to record a video&lt;/strong&gt; with Loom pointing in the UI with their mouse what they want to change.&lt;/p&gt;

&lt;p&gt;But no solution was perfect; they all had their struggles, and &lt;strong&gt;I did not like to make their lives more complicated&lt;/strong&gt;, so they hired me to help them!&lt;/p&gt;

&lt;p&gt;But this week, everything changed. I decided to try &lt;a href="https://livecycle.io/" rel="noopener noreferrer"&gt;Livecycle.io&lt;/a&gt;, a platform that allows me to collaborate with my clients on &lt;strong&gt;live PR previews in real time&lt;/strong&gt;. If you are in a rush and don't want to read the entire article, Livecycle.io has helped me improve my client communication, streamline my workflow and &lt;strong&gt;increase client satisfaction by 300%&lt;/strong&gt; (&lt;em&gt;well, not sure if that is the real number since I can not measure it, but they were really happy!&lt;/em&gt;).&lt;/p&gt;

&lt;p&gt;But if you want to enjoy a good read, in this article, I will share with you how I use &lt;a href="https://livecycle.io/" rel="noopener noreferrer"&gt;Livecycle.io&lt;/a&gt; now with all my clients and why you should try it, too (it is free to try!).&lt;/p&gt;

&lt;h2&gt;
  
  
  A solution could be here
&lt;/h2&gt;

&lt;p&gt;As I said, I fell in love with this tool. I could go over all its features, but... that is not the article's point; the main topic is to show you how I use it.&lt;/p&gt;

&lt;p&gt;Basically, with this tool integrated into your project, you can have a UI in the project that your clients (&lt;em&gt;or maybe teammates&lt;/em&gt;) can use to give feedback on the web app in an easy way.&lt;/p&gt;

&lt;p&gt;But the good thing for me (&lt;em&gt;and for you, as a developer&lt;/em&gt;) is that &lt;strong&gt;the feedback is automatically synced to the project's GitHub repo&lt;/strong&gt; in the PR you are testing. So you get all the feedback and comments in a single place that you should check every day (😉), and your clients don't need to learn new "&lt;em&gt;complicated things.&lt;/em&gt;" It is a win-win, isn't it?&lt;/p&gt;

&lt;h2&gt;
  
  
  Time to integrate it into my project
&lt;/h2&gt;

&lt;p&gt;Obviously, I have already integrated it into one of my projects (&lt;em&gt;or I wouldn't be writing about it&lt;/em&gt;). Still, I think the best way to learn about something is by trying it by yourself, so this will be something like a &lt;strong&gt;short guide&lt;/strong&gt; so you can register for the trial and install it in some of your projects. Enjoy!&lt;/p&gt;

&lt;p&gt;The very first thing you have to do is to register on their website. You just need to go to &lt;a href="https://livecycle.io/" rel="noopener noreferrer"&gt;https://livecycle.io/&lt;/a&gt; and click on the big blue button that says "Try it now":&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2F0%2AfnNCKrAxT9jhJfI8" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2F0%2AfnNCKrAxT9jhJfI8" alt="try it now"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once you click that button, &lt;strong&gt;you will be prompted to register&lt;/strong&gt;, I picked my Google account, but you can choose any of them:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2F0%2Ak9CzgZzuxoSwI5XT" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2F0%2Ak9CzgZzuxoSwI5XT" alt="register"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once you are in, &lt;strong&gt;follow the wizard&lt;/strong&gt; to finish the account setup (it will be mostly things like creating a new organization in your account and connecting the project repo, nothing complicated).&lt;/p&gt;

&lt;p&gt;Now, it is time to connect to your project. In my case, I &lt;strong&gt;want to connect it to an admin dashboard&lt;/strong&gt; I am building for one of my clients. I want them to be able to give me UI feedback easily, so it seems like the perfect solution!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2F0%2AWX5xgn5ZFN8znkxK" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2F0%2AWX5xgn5ZFN8znkxK" alt="connect your project"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click in the left sidebar, under the Repositories section, to connect your repo. You will need to follow the steps given by the wizard, and &lt;strong&gt;in less than 5 minutes&lt;/strong&gt;, you will have the repo connected.&lt;/p&gt;

&lt;p&gt;In my case, the dashboard is coded in React, so to integrate LiveCycle SDK in my project, I need to install its NPM package (&lt;em&gt;as suggested by the handy wizard&lt;/em&gt;). Let's do it.&lt;/p&gt;

&lt;p&gt;The very first step is &lt;strong&gt;to create a branch for Livecycle&lt;/strong&gt; in your project. To do that, I went to my main development branch and executed this command:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git checkout -b livecycle-sdk&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now we have our "&lt;em&gt;testing&lt;/em&gt;" branch, so &lt;strong&gt;it is time to install the SDK there&lt;/strong&gt;. Use any package manager to do that; in my case, I will use yarn:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;yarn add @livecycle/sdk&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;There is only one step left! We have to initialize the SDK. To do that, paste the code given by the wizard &lt;strong&gt;into the root app file&lt;/strong&gt; of your project (&lt;em&gt;if you are using any other framework, you will have the instructions in the installation assistant, don't worry&lt;/em&gt;):&lt;/p&gt;

&lt;p&gt;In my case, the code looks like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2F0%2A-xayHrichWes3NKv" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2F0%2A-xayHrichWes3NKv" alt="sdk integra5tion"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you need more info about how to add it to your project, I recommend you to check their official docs &lt;a href="https://docs.livecycle.io/getting-started/connect-previews/frameworks/react" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;All the code is ready! Now just push the branch changes and open a new pull request. That is important because &lt;strong&gt;inside that pull request is where you will find all the feedback&lt;/strong&gt; your clients send you!&lt;/p&gt;

&lt;p&gt;The PR must be the livecycle-sdk branch to your development branch. Once you have created it, jump to the next step.&lt;/p&gt;

&lt;h2&gt;
  
  
  Linking your Pull Request to LiveCycle SDK
&lt;/h2&gt;

&lt;p&gt;The final step is here; it is now time to let Livecycle know which is the pull request where you want to receive the feedback.&lt;/p&gt;

&lt;p&gt;In the installation wizard, if you click next, you will see this step explained, but basically, you have to let Livecycle know where is your preview environment. If you are deploying your project in one of their supported platforms, the process is automatic; in any other case, you can do it manually with &lt;strong&gt;just one command!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In my case, the project is hosted in &lt;strong&gt;Vercel&lt;/strong&gt;, one of their supported platforms, so &lt;strong&gt;the installation was just one click&lt;/strong&gt;. That is cool.&lt;/p&gt;

&lt;p&gt;After that, we see the message that every developer loves to see:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2F0%2AHtEyCWruIODVsDJl" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2F0%2AHtEyCWruIODVsDJl" alt="confirmation message"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A well-done screen!&lt;/p&gt;

&lt;h2&gt;
  
  
  Playing in the Playground
&lt;/h2&gt;

&lt;p&gt;If we open the playground, we can start receiving feedback, so I did it:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2F0%2A-lEDI8uBtDxi9R4w" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2F0%2A-lEDI8uBtDxi9R4w" alt="testing the tool"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once you open it, you have a short wizard explaining different functions, and after that, you can start playing.&lt;/p&gt;

&lt;p&gt;One of the most frequent feedbacks I get from my clients is about changing some styling properties. Sometimes they tell me: "&lt;em&gt;I would like that header bigger&lt;/em&gt;." But... how much? They don't know &lt;strong&gt;because they don't know about font sizes&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;With this tool, that is no problem anymore since &lt;strong&gt;they can edit the page with just sliders&lt;/strong&gt; and buttons; no code is required. That's so cool.&lt;/p&gt;

&lt;p&gt;Imagine my client wants to give the following feedback: "&lt;em&gt;The profile card should have a bigger title and more space between the text lines. I would also like the background darker.&lt;/em&gt;"&lt;/p&gt;

&lt;p&gt;Well, now they can just edit and post the feedback!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2F0%2A7RljjVM7vsO7YGEI" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2F0%2A7RljjVM7vsO7YGEI" alt="edit and post the feedback"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After that, they just have to post it, and I automatically get all the new feedback in the GitHub pull request, &lt;strong&gt;with the CSS code that changed and before and after images&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2F0%2AVroxl0fWczUBbdfd" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2F0%2AVroxl0fWczUBbdfd" alt="repo updated"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What do my clients think about it?
&lt;/h2&gt;

&lt;p&gt;It is usual that when a dev finds a cool new feature, the rest of the world thinks that the new feature is complicated and prefers to use the old method. So when I started using this solution, &lt;strong&gt;I was worried&lt;/strong&gt; because even if I thought this was useful, maybe my clients would prefer using the old methods, even if they were way worse.&lt;/p&gt;

&lt;p&gt;But I was really happy to hear from them that thanks to the assistant you see when you open for the first time the playground, they were able to understand the entire process, and in a few minutes, &lt;strong&gt;they were already posting some feedback&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2F0%2A4dRLfjpSELnHTm0l" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2F0%2A4dRLfjpSELnHTm0l" alt="clients feedback"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  My final thoughts
&lt;/h2&gt;

&lt;p&gt;Well, as you can read, I am pretty happy with this finding. Obviously, it might not be useful for you. But you should at least try it. I mean, &lt;a href="https://livecycle.io/" rel="noopener noreferrer"&gt;&lt;strong&gt;it has a free trial&lt;/strong&gt;&lt;/a&gt;, takes no more than 5 minutes to install, has good documentation, and does its work as intended.&lt;/p&gt;

&lt;p&gt;If I were going to improve something from their tool, it would be just adding a more prominent overlay to the wizard that opens in the playground screen because it is just a small pink bubble that you have to click to read the message, and the first time my client went to the playground, he didn't notice it. But... it is just a minor UI thing, which I have already reported (&lt;em&gt;as feedback&lt;/em&gt;) to the team.&lt;/p&gt;

&lt;p&gt;Oh, and that is another cool thing. I just sent that e-mail, and &lt;strong&gt;in less than 10 minutes, I got a reply&lt;/strong&gt;. Only for that stupid little thing. So, that is a good thing for any product I intend to use since I can expect them to help me with more important problems.&lt;/p&gt;

&lt;p&gt;But, whatever, it is time to end the post; I am not trying to bore you or write a book about this. Take this just as my personal experience. A good one but a personal one. Make sure to try it by yourself; it &lt;strong&gt;will be worth it!&lt;/strong&gt; 🪄&lt;/p&gt;

&lt;h2&gt;
  
  
  🌎 Let's Connect!
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;  My &lt;a href="https://twitter.com/thenaubit" rel="noopener noreferrer"&gt;Twitter: @thenaubit&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;a href="https://coderpreneurs.substack.com/" rel="noopener noreferrer"&gt;My Substack&lt;/a&gt; (here I publish more in-depth articles)&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Unleash the Power of Your Data: 6 ES6 Array Functions You Need to Know 🚀</title>
      <dc:creator>Al - Naucode</dc:creator>
      <pubDate>Mon, 06 Feb 2023 02:43:41 +0000</pubDate>
      <link>https://dev.to/naubit/unleash-the-power-of-your-data-6-es6-array-functions-you-need-to-know-1e6</link>
      <guid>https://dev.to/naubit/unleash-the-power-of-your-data-6-es6-array-functions-you-need-to-know-1e6</guid>
      <description>&lt;p&gt;New day, new daily article! Yesterday we talked about some custom React hooks, but &lt;strong&gt;today it is time to talk about arrays&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Yeah, I know, it might sound boring but trust me, it is not. Today I will show you 6 ES6 methods we can find in arrays that &lt;strong&gt;you might not know and that are really useful.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Obviously, you can do the same without these methods, but... hey, this simplifies your life (&lt;em&gt;and it is cool&lt;/em&gt;), so &lt;strong&gt;why not give them a try?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Well, time to start!&lt;/p&gt;

&lt;h2&gt;
  
  
  🔍 Map
&lt;/h2&gt;

&lt;p&gt;This is a classic. You have probably used this one, but... I had to talk about it just in case.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;.map()&lt;/code&gt; function &lt;strong&gt;creates a new array by manipulating&lt;/strong&gt; every element in the original array and returning a new array with the results.&lt;/p&gt;

&lt;p&gt;This is useful for transforming arrays in an easier way to work with or visualize.&lt;/p&gt;

&lt;p&gt;As always, here is an example:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;By the way, since &lt;code&gt;map&lt;/code&gt; builds a new array, calling it without using the returned array is an anti-pattern; use &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach"&gt;forEach&lt;/a&gt; or &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of"&gt;for...of&lt;/a&gt; instead.&lt;/p&gt;

&lt;p&gt;🔗 &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map"&gt;More knowledge&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  💡 Filter
&lt;/h2&gt;

&lt;p&gt;This is really cool. Instead of "transforming" the items like in the map function, here, we filter the array (&lt;em&gt;as its name says&lt;/em&gt;). Basically, it creates a new array with all elements that pass the test implemented by the provider function. So yeah, &lt;strong&gt;it filters out any elements in the original array that don't meet a specific condition&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Now, one example:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;In that example, we are filtering out the numbers that are not even in the array.&lt;/p&gt;

&lt;p&gt;🔗 &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter"&gt;More knowledge&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  🔢 Reduce
&lt;/h2&gt;

&lt;p&gt;Now one I really like. The &lt;code&gt;.reduce()&lt;/code&gt; function. I*&lt;em&gt;t reduces the array to a single value&lt;/em&gt;* by iterating through the array and applying a provided function to each element. This function is often used to sum up, all the elements in an array or to find the max or min value.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;In this one, I am just getting the sum of all the numbers in the array. That easy.&lt;/p&gt;

&lt;p&gt;🔗 &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce"&gt;More knowledge&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  💬 Find
&lt;/h2&gt;

&lt;p&gt;This one is also used a lot. The &lt;code&gt;.find()&lt;/code&gt; function &lt;strong&gt;returns the first element in the array that satisfies the provided testing function&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;It is awesome for searching for a specific element in an array.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;In this one, we find the first even number in an array.&lt;/p&gt;

&lt;p&gt;🔗 &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find"&gt;More knowledge&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  🔃 Every &amp;amp; Some
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;.every()&lt;/code&gt; and &lt;code&gt;.some()&lt;/code&gt; are similar to &lt;code&gt;.filter()&lt;/code&gt; since they test elements in an array against a provided function.&lt;/p&gt;

&lt;p&gt;So, what is the difference? Well, &lt;code&gt;.every()&lt;/code&gt; returns &lt;code&gt;true&lt;/code&gt; if &lt;strong&gt;all the elements&lt;/strong&gt; in the array pass that test. And as you would expect, &lt;code&gt;.some()&lt;/code&gt; returns &lt;code&gt;true&lt;/code&gt; if &lt;strong&gt;at least one element&lt;/strong&gt; passes the test.&lt;/p&gt;

&lt;p&gt;Let's see an example using &lt;code&gt;.every()&lt;/code&gt; to check if all elements in an array are even numbers:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;And now, let's check an example of using &lt;code&gt;.some()&lt;/code&gt; to check if there is at least one odd number in an array:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;🔗 More knowledge about &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every"&gt;every&lt;/a&gt; and &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some"&gt;some&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;So, that is it! Well, not really. There are more helpful functions there, but I didn't want to create a long post. With this article, I wanted to show you that there are excellent functions that you can always find in the docs. &lt;strong&gt;But there are more!&lt;/strong&gt; For example, you could check the &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat"&gt;flat function&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;But no worries, I have more exciting articles coming soon. I publish one every day, so... &lt;strong&gt;make sure to follow&lt;/strong&gt; if you want these little JS pills every day!&lt;/p&gt;

&lt;h2&gt;
  
  
  🌎 Let's Connect!
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;  My &lt;a href="https://twitter.com/thenaubit"&gt;Twitter: @thenaubit&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;a href="https://coderpreneurs.substack.com/"&gt;My Substack&lt;/a&gt; (here I publish more in-depth articles)&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>5 Custom React Hooks That Will Transform Your Code 🤖</title>
      <dc:creator>Al - Naucode</dc:creator>
      <pubDate>Sun, 05 Feb 2023 02:10:42 +0000</pubDate>
      <link>https://dev.to/naubit/5-custom-react-hooks-that-will-transform-your-code-emo</link>
      <guid>https://dev.to/naubit/5-custom-react-hooks-that-will-transform-your-code-emo</guid>
      <description>&lt;p&gt;Yesterday after finishing my daily article (&lt;em&gt;yeah, I publish a new article about front-end development every day, so make sure to follow if you want a daily pill of code 😉&lt;/em&gt;), I went to code for a little and... I started coding &lt;strong&gt;some custom hooks&lt;/strong&gt; for a side project I am building (&lt;em&gt;I am talking about it on my Twitter:&lt;/em&gt; &lt;a href="https://twitter.com/thenaubit"&gt;&lt;em&gt;@thenaubit&lt;/em&gt;&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;I realized there are lots of &lt;strong&gt;really useful custom React hooks&lt;/strong&gt;. So I am starting a new series where I will post some of those (&lt;em&gt;coded by me or found on the Internet and converted to TypeScript&lt;/em&gt;).&lt;/p&gt;

&lt;p&gt;And if you have done one that you are proud of, feel free to &lt;strong&gt;share a gist link&lt;/strong&gt; in the comments, and I will add it to the following article!&lt;/p&gt;

&lt;h2&gt;
  
  
  1️⃣ useWindowSize Hook
&lt;/h2&gt;

&lt;p&gt;I am pretty sure you have needed to &lt;strong&gt;get the width and height&lt;/strong&gt; of the user's window in some projects you have worked on.&lt;/p&gt;

&lt;p&gt;Well, now you have a hook for that, so you can do it even easier than before!&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;This hook can be particularly useful when implementing responsive design, and for some reason, you need to run some specific code in some resolutions!&lt;/p&gt;

&lt;h2&gt;
  
  
  2️⃣ useKeyPress Hook
&lt;/h2&gt;

&lt;p&gt;The next hook lets you &lt;strong&gt;detect when a specific key is pressed&lt;/strong&gt;. This can trigger events or actions based on the key pressed. For example, for closing a modal, submitting a form... you know, there are lot of options.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Of course, I will give you an example of how to use it:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;const closeModalKeyPress = useKeyPress("Escape");&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Yeah, it is that easy.&lt;/p&gt;

&lt;h2&gt;
  
  
  3️⃣ useInterval Hook
&lt;/h2&gt;

&lt;p&gt;This hook allows you to &lt;strong&gt;use the famous setInterval function as a hook&lt;/strong&gt;! Like the setInterval function, this hook has many uses, like animations, updating data at regular intervals, or even setting a timer.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;You can use this hook like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const [count, setCount] = useState(0);

useInterval(() =&amp;gt; {
  setCount(count + 1);
}, 1000);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  4️⃣ useDebounce Hook
&lt;/h2&gt;

&lt;p&gt;Now we will talk about one for debouncing functions. If you don't know what it is, basically the function &lt;strong&gt;will only be executed after a certain amount of time has passed without it being called&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;This is useful, for example, for rate-limiting API calls or state updates on input changes, like when you are typing some text in a search input.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;



&lt;p&gt;A usage example would be:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const [inputValue, setInputValue] = useState("");

useDebounce(() =&amp;gt; {
// make API call
}, 500);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  5️⃣ useThrottle Hook
&lt;/h2&gt;

&lt;p&gt;The previous one was a debounce hook, and now it is the turn of a throttle hook.&lt;/p&gt;

&lt;p&gt;As its name says, it is a hook to throttle a function. It means &lt;strong&gt;it will be executed once per every specified interval of time&lt;/strong&gt;. This can be useful for preventing too many API calls or events from being triggered in rapid succession.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;



&lt;p&gt;An example would be:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const [inputValue, setInputValue] = useState("");

useThrottle(() =&amp;gt; {
// make API call
}, 500);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;Well, we reached the end of the article, but before you go, I want to say a few extra key things.&lt;/p&gt;

&lt;p&gt;The first one is these hooks are examples, just like any other code you find on the Internet. &lt;strong&gt;You should not just copy and paste&lt;/strong&gt; them into your project. You should read them, understand them and improve them!&lt;/p&gt;

&lt;p&gt;With that being said, I really enjoy writing this kind of article, so if you also like them, &lt;strong&gt;make sure to follow and like&lt;/strong&gt; them. That way, I will know people want more, and we will have more. Oh, and as I said at the beginning of the article, if you have some little hooks you like, share them here; &lt;strong&gt;I want to add them in the next post!&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  🌎 Let's Connect!
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;  My &lt;a href="https://twitter.com/thenaubit"&gt;Twitter: @thenaubit&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;a href="https://coderpreneurs.substack.com/"&gt;My Substack&lt;/a&gt; (here I publish more in-depth articles)&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>react</category>
      <category>beginners</category>
    </item>
    <item>
      <title>7 Small &amp; Underrated React Libraries 🔥</title>
      <dc:creator>Al - Naucode</dc:creator>
      <pubDate>Fri, 03 Feb 2023 21:59:38 +0000</pubDate>
      <link>https://dev.to/naubit/7-small-underrated-react-libraries-h54</link>
      <guid>https://dev.to/naubit/7-small-underrated-react-libraries-h54</guid>
      <description>&lt;p&gt;Hey! Welcome back to my daily article! Today we will talk about React. But not about React.js concepts, best practices, or so. Today I will talk about &lt;strong&gt;7 small and underrated React libraries&lt;/strong&gt; that I like to use and that you might like.&lt;/p&gt;

&lt;p&gt;Of course, you may already know some of them since I didn't pick the smallest ones. I tried to balance being &lt;strong&gt;less known and popular enough to be maintained&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Also, you probably have others you know, so feel free to answer to share yours; I will try to add them to the following article of this series!&lt;/p&gt;




&lt;h2&gt;
  
  
  1️⃣ React Testing Library
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--a9lZ2n0d--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/0%2Aq_7HccxM04dFdBOv.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--a9lZ2n0d--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/0%2Aq_7HccxM04dFdBOv.jpg" alt="React Testing Library" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It is a lightweight testing library that makes it really easy to test React components. Oh, it also provides a simple and intuitive API for testing them, &lt;strong&gt;making the process even easier!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It is designed to be used with Jest, a popular testing framework for React.&lt;/p&gt;

&lt;p&gt;As always, here is a code example using it (&lt;em&gt;don't worry, after the example, you have a link to the project, so you can check it in depth&lt;/em&gt;):&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;🔗 &lt;a href="https://testing-library.com/docs/react-testing-library/intro/"&gt;Official Website&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  2️⃣ React Hook Form
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Y6j02Szf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/0%2AV7R9AeiYwwAA3ZhE.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Y6j02Szf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/0%2AV7R9AeiYwwAA3ZhE.png" alt="React Hook Form" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is a cool one. This is a library that makes really easy to handle form state in React.&lt;/p&gt;

&lt;p&gt;Basically, it provides a simple API for handling form state and validation, and it is built &lt;strong&gt;using React hooks&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Another pro is it has a small size and is very efficient! (&lt;em&gt;It also works in React Native&lt;/em&gt;)&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;🔗 &lt;a href="https://react-hook-form.com/"&gt;Official Website&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  3️⃣ React Scroll
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--zT04dqFV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AlAcHJ-B6U4b50bhcWXqggQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zT04dqFV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AlAcHJ-B6U4b50bhcWXqggQ.png" alt="React Scroll" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you will expect, this library is for scrolling. Basically, &lt;strong&gt;it helps to implement smooth scrolling&lt;/strong&gt; in React apps. It provides an easy API (&lt;em&gt;but with lots of optional settings&lt;/em&gt;) and is lightweight.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;🔗 &lt;a href="https://www.npmjs.com/package/react-scroll"&gt;Official Website&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  4️⃣ React Transition Group
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RJ35lm-F--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/0%2A3mQ-cM1lLSEGtd2G.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RJ35lm-F--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/0%2A3mQ-cM1lLSEGtd2G.jpg" alt="React Transition Group" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This one is for implementing animations. Well, not every kind (&lt;em&gt;for that, I recommend checking&lt;/em&gt; &lt;a href="https://www.framer.com/motion/"&gt;&lt;em&gt;Framer Motion&lt;/em&gt;&lt;/a&gt;) but transitions.&lt;/p&gt;

&lt;p&gt;If you need quick and easy animations, &lt;em&gt;I recommend checking this one&lt;/em&gt;.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;🔗 &lt;a href="https://github.com/reactjs/react-transition-group"&gt;Official Website&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  5️⃣ React Lazy Load Image Component
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--D_iBHVFX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/0%2A0FIJATMysWAubumD.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--D_iBHVFX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/0%2A0FIJATMysWAubumD.png" alt="React Lazy Load Image Component" width="800" height="260"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Well, this one already says what it does in the title, but yeah, it helps &lt;strong&gt;implement lazy loading for images&lt;/strong&gt; in your React app.&lt;/p&gt;

&lt;p&gt;As you may know, it can help improve your website's performance by only loading images when needed. Quick and easy.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;🔗 &lt;a href="https://www.npmjs.com/package/react-lazy-load-image-component"&gt;Official Website&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  6️⃣ React Easy Edit
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RRYNUa8I--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/0%2AZGyw0I-h3WY-z0nl" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RRYNUa8I--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/0%2AZGyw0I-h3WY-z0nl" alt="React Easy Edit" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now we have a library that you will use in very few particular cases, but hey, it is always good to know!&lt;/p&gt;

&lt;p&gt;It is a library for &lt;strong&gt;implementing inline editing&lt;/strong&gt; in React. It is really easy to use.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;🔗 &lt;a href="https://github.com/giorgosart/react-easy-edit"&gt;Official Website&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  7️⃣ React Beautiful Dnd
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qtxLIQRK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn-images-1.medium.com/max/800/0%2AB601l3uqm4VqDsd0.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qtxLIQRK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn-images-1.medium.com/max/800/0%2AB601l3uqm4VqDsd0.gif" alt="React Beautiful Dnd" width="879" height="305"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This library is not that small, and it is very popular but... I really wanted to add it. I know there are lots of "drag-and-drop" libraries out there, but this one is really easy to use; &lt;strong&gt;it is beautiful and customizable&lt;/strong&gt;. Oh, and done by Atlassian (&lt;em&gt;the creators of Trello and Jira, both apps use this library&lt;/em&gt;).&lt;/p&gt;

&lt;p&gt;No code example since it is better to check all their examples &lt;a href="https://react-beautiful-dnd.netlify.app/?path=/story/single-vertical-list--basic"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;🔗 &lt;a href="https://github.com/atlassian/react-beautiful-dnd"&gt;Official Website&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;So, yeah, that is all the article. A short one, but I hope it was helpful and that you discovered at least one exciting library. I really enjoy doing this series; I will continue publishing more soon so... &lt;strong&gt;make sure to follow&lt;/strong&gt; if you liked it!&lt;/p&gt;

&lt;p&gt;And if you know others small libraries like these, &lt;strong&gt;share them here&lt;/strong&gt; so I can test and add them to the next article!&lt;/p&gt;

&lt;h2&gt;
  
  
  🌎 Let's Connect!
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;  My &lt;a href="https://twitter.com/thenaubit"&gt;Twitter: @thenaubit&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;a href="https://coderpreneurs.substack.com/"&gt;My Substack&lt;/a&gt; (here I publish more in-depth articles)&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>react</category>
      <category>beginners</category>
    </item>
    <item>
      <title>💻 7 Tips for Writing Clean and Efficient React Code</title>
      <dc:creator>Al - Naucode</dc:creator>
      <pubDate>Thu, 02 Feb 2023 22:54:09 +0000</pubDate>
      <link>https://dev.to/naubit/7-tips-for-writing-clean-and-efficient-react-code-34e7</link>
      <guid>https://dev.to/naubit/7-tips-for-writing-clean-and-efficient-react-code-34e7</guid>
      <description>&lt;p&gt;Hey! Welcome back to my daily article! Today I will talk about some tips for writing clean React code.&lt;/p&gt;

&lt;p&gt;Obviously, as always, &lt;strong&gt;people will have their own opinions&lt;/strong&gt;, and you might not like these. Heck, I might even change my opinion in a few months! Who knows. These tips are helpful today, and I wanted to share them with you.&lt;/p&gt;

&lt;h2&gt;
  
  
  💡 Tip 1: Use functional components instead of class components
&lt;/h2&gt;

&lt;p&gt;As I said in another article, functional components are the current standard in React, so &lt;strong&gt;almost everyone uses them&lt;/strong&gt;. But in case you are following some old tutorial, or you were wondering which one to use... use functional components.&lt;/p&gt;

&lt;p&gt;They are a more straightforward and concise way to define components!&lt;/p&gt;

&lt;p&gt;Also, &lt;strong&gt;they are faster and easier to understand&lt;/strong&gt;, especially for a junior developer.&lt;/p&gt;

&lt;p&gt;Here you have a basic React component coded as a class component:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;And here, you have the same component but as a functional component:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h2&gt;
  
  
  💡 Tip 2: Use the &lt;code&gt;useState&lt;/code&gt; hook for state management
&lt;/h2&gt;

&lt;p&gt;Well, this one is stupid if you are already using functional components, but just in case, yeah, use the &lt;code&gt;useState&lt;/code&gt; hook for your state.&lt;/p&gt;

&lt;p&gt;Here is an example:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;In this example, I am using the &lt;code&gt;useState&lt;/code&gt; hook to store the current count (the &lt;em&gt;count&lt;/em&gt; var), and I also got a function (&lt;em&gt;setCount&lt;/em&gt;) to update the count.&lt;/p&gt;

&lt;p&gt;So this allows me to &lt;strong&gt;manage the state in my components&lt;/strong&gt; without needing class components or complex state management libraries.&lt;/p&gt;

&lt;p&gt;In case you want to read more about it, check &lt;a href="https://beta.reactjs.org/reference/react/useState"&gt;this doc&lt;/a&gt;!&lt;/p&gt;

&lt;h2&gt;
  
  
  💡 Tip 3: Use the &lt;code&gt;useEffect&lt;/code&gt; hook for side effects
&lt;/h2&gt;

&lt;p&gt;Another pretty obvious if you are already using functional components, but... always good to remember.&lt;/p&gt;

&lt;p&gt;This hook is a powerful tool for handling side effects in React components. Basically, &lt;strong&gt;it allows you to perform actions after a component has been updated&lt;/strong&gt;, such as making API calls or updating the DOM.&lt;/p&gt;

&lt;p&gt;As always, here you have an example using the hook:&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;In the previous code, I used the useEffect hook to fetch data from an API when the component is mounted. The hook's second argument is an array of dependencies that determines when the effect should be rerun.&lt;/p&gt;

&lt;p&gt;In this case, an empty array means the effect will run only once when the component is mounted.&lt;/p&gt;

&lt;h2&gt;
  
  
  💡 Tip 4: Use destructuring to simplify code
&lt;/h2&gt;

&lt;p&gt;One of the most powerful features in the latest Javascript versions, this is not only a React feature; you can use it everywhere in Javascript. And you should!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It allows you to extract values from objects and arrays&lt;/strong&gt;. For example, you can use it in React to simplify your code and make it easier to read.&lt;/p&gt;

&lt;p&gt;Of course, I will share an example of restructuring in a functional component:&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;In this example, the message prop is destructured from the props object, making it available as a separate variable.&lt;/p&gt;

&lt;p&gt;As you can see, this allows you to simplify the code (you don't need to write everywhere something like props.message) and thus, making it easier to read.&lt;/p&gt;

&lt;h2&gt;
  
  
  💡 Tip 5: Use memoization to improve performance
&lt;/h2&gt;

&lt;p&gt;I know that I am always talking about this in the latest articles, but... I really love it, and when done right, &lt;strong&gt;it improves a lot the performance of a web app.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;So I had to include it again here.&lt;/p&gt;

&lt;p&gt;Memoization is a technique for optimizing the performance of your React components by avoiding unnecessary re-renders. You could use the React.memo higher-order component or the useMemo hook to memorize components.&lt;/p&gt;

&lt;p&gt;And yeah, here is an example:&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;In this example, the React.memo higher-order component is wrapping the component and memoizing it, so it will return a cached component if the value of the message prop is not changed.&lt;/p&gt;

&lt;p&gt;Of course, this is not a heavy component, so this optimization won't give real improvements, but... it was a simple way to showcase it.&lt;/p&gt;

&lt;p&gt;If you want to read more about the right ways to do it, I really recommend checking &lt;a href="https://beta.reactjs.org/reference/react/useMemo"&gt;this&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  💡 Tip 6: Use the &lt;code&gt;key&lt;/code&gt; prop to improve performance
&lt;/h2&gt;

&lt;p&gt;Maybe you have seen a warning in the dev console related to this one, so... it is a good one to know.&lt;/p&gt;

&lt;p&gt;The key prop is a special prop in React that allows you to optimize the rendering of an array of components.&lt;/p&gt;

&lt;p&gt;By specifying a unique key for each component in an array, React can keep track of which components have changed and &lt;strong&gt;only update the ones that need to be updated&lt;/strong&gt;, improving the performance.&lt;/p&gt;

&lt;p&gt;Less talk and more examples!&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;In this example, we render each item inside the array as a li element. And we are setting a key prop for each one based on the id we got on their objects.&lt;/p&gt;

&lt;p&gt;Usually, if you do this without the key prop, &lt;strong&gt;you will see a warning in the dev console advising you to add a key prop&lt;/strong&gt;. So probably you have already seen this.&lt;/p&gt;

&lt;p&gt;These are the basics of this prop, but if you have some spare time, I recommend checking its docs &lt;a href="https://beta.reactjs.org/learn/rendering-lists"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  💡 Tip 7: Use inline styles sparingly
&lt;/h2&gt;

&lt;p&gt;Some people will agree with this tip; others will hate me. But it is ok; I think this one is important for a clean codebase.&lt;/p&gt;

&lt;p&gt;Inline styles can be helpful in certain situations but &lt;strong&gt;can also lead to maintenance headaches and poor performance&lt;/strong&gt;. It is generally better to use CSS stylesheets (&lt;em&gt;or even UI kits, Tailwind, you know...&lt;/em&gt;) to style your components and keep your code organized and maintainable.&lt;/p&gt;

&lt;p&gt;Of course, you can prototype quickly doing inline styles but moving your code to something better (&lt;em&gt;like CSS modules&lt;/em&gt;) before going to production!&lt;/p&gt;

&lt;p&gt;As I said, a controversial tip.&lt;/p&gt;




&lt;p&gt;As with every article, this one should have a conclusion. And the conclusion is that writing clean and efficient React code is crucial for your application's success (&lt;em&gt;and for your fellow developers' mental health&lt;/em&gt;). But not only that, &lt;strong&gt;it will make your life easier once you get used to these practices&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;And as always, these tips are not the absolute truth, and you could disagree. Knowing them and having your own opinion about them is important. I hope this gave you some thought material, and always, &lt;strong&gt;thanks for reading!&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  🌎 Let's Connect!
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;  My &lt;a href="https://twitter.com/thenaubit"&gt;Twitter: @thenaubit&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;a href="https://coderpreneurs.substack.com/"&gt;My Substack&lt;/a&gt; (here I publish more in-depth articles)&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>beginners</category>
      <category>react</category>
    </item>
    <item>
      <title>🚀 5 Advanced ES6 Features Every JavaScript Developer Should Master</title>
      <dc:creator>Al - Naucode</dc:creator>
      <pubDate>Wed, 01 Feb 2023 22:34:39 +0000</pubDate>
      <link>https://dev.to/naubit/5-advanced-es6-features-every-javascript-developer-should-master-3mkn</link>
      <guid>https://dev.to/naubit/5-advanced-es6-features-every-javascript-developer-should-master-3mkn</guid>
      <description>&lt;p&gt;New day, new article! Today's article is about &lt;strong&gt;five advanced Javascript ES6 features&lt;/strong&gt; that I like and that I think everyone (&lt;em&gt;at least every developer&lt;/em&gt;) should understand.&lt;/p&gt;

&lt;p&gt;Are you ready?&lt;/p&gt;

&lt;h2&gt;
  
  
  💡 Destructuring
&lt;/h2&gt;

&lt;p&gt;Destructuring is a quick way to get values out of objects and arrays. For example, &lt;strong&gt;you can extract values&lt;/strong&gt; and assign them to variables with a single line of code.&lt;/p&gt;

&lt;p&gt;Here's an example of how destructuring can be used with an object:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;And here's an example with an array:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;As you can see, destructuring makes it simple to extract values from objects and arrays and assign them to variables.&lt;/p&gt;

&lt;h2&gt;
  
  
  🔒 Block Scoping
&lt;/h2&gt;

&lt;p&gt;You can use block scoping to declare variables that are only available within a specific block of code. There are two ways to declare variables in JavaScript: &lt;strong&gt;var&lt;/strong&gt; and &lt;strong&gt;let&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The var keyword declares a global or function-scoped variable, which means &lt;strong&gt;it can be accessed from anywhere within the same function&lt;/strong&gt;. On the other hand, the let keyword declares a variable that is block scoped, which means that it can only be accessed within the same block of code.&lt;/p&gt;

&lt;p&gt;Here's an example of let-based block scoping:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;As you can see, the message variable is only available within the if statement-defined block of code.&lt;/p&gt;

&lt;h2&gt;
  
  
  🚗 Spread Operator
&lt;/h2&gt;

&lt;p&gt;Spreading the values of an array or object into a new array or object is possible with the spread operator. &lt;strong&gt;It's a quick way to combine arrays or objects or to turn an array-like object&lt;/strong&gt; into a proper array.&lt;/p&gt;

&lt;p&gt;Here's an example of how to combine two arrays using the spread operator:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Here's an example of how to use the spread operator to transform an array-like object into a real array:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;A spread operator is a powerful tool for simplifying and improving the readability of your code.&lt;/p&gt;

&lt;h2&gt;
  
  
  🔮 Template Literals
&lt;/h2&gt;

&lt;p&gt;String literals that allow you to embed expressions within your strings are known as template literals. Instead of quotes (' or "), they are defined with the backtick (`) character.&lt;/p&gt;

&lt;p&gt;Here's an example of template literals in action:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;As you can see, template literals make it simple to embed expressions within strings and &lt;strong&gt;allow you to write multi-line strings&lt;/strong&gt; without using string concatenation.&lt;/p&gt;

&lt;h2&gt;
  
  
  💾 Arrow Functions
&lt;/h2&gt;

&lt;p&gt;In JavaScript, arrow functions are a shorthand syntax for writing anonymous functions. They enable you to write code that &lt;strong&gt;is shorter, more concise, and more readable&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Here's an example of how to use the arrow function:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;As you can see, arrow functions make it simple to write anonymous functions and have a shorter syntax than regular functions.&lt;/p&gt;




&lt;p&gt;It was a short article, but I hope it was helpful for you. I use these features daily and feel like &lt;strong&gt;they are crucial for every Javascript developer&lt;/strong&gt;. So hopefully, you have discovered something new today.&lt;/p&gt;

&lt;h2&gt;
  
  
  🌎 Let's Connect!
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;  My &lt;a href="https://twitter.com/thenaubit"&gt;Twitter: @thenaubit&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;a href="https://coderpreneurs.substack.com/"&gt;My Substack&lt;/a&gt; (here I will publish more in-depth articles)&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>🎯 9 Essential React Hooks Every Developer Should Know</title>
      <dc:creator>Al - Naucode</dc:creator>
      <pubDate>Mon, 30 Jan 2023 14:33:41 +0000</pubDate>
      <link>https://dev.to/naubit/9-essential-react-hooks-every-developer-should-know-278l</link>
      <guid>https://dev.to/naubit/9-essential-react-hooks-every-developer-should-know-278l</guid>
      <description>&lt;p&gt;Today's post could be controversial since some people could say: "&lt;em&gt;hey, this hook is not that important&lt;/em&gt;," but, you know, that is the beauty of the Internet; everyone can say their opinion.&lt;/p&gt;

&lt;p&gt;So, these are &lt;strong&gt;some hooks every React developer should know&lt;/strong&gt; and understand. (&lt;em&gt;And if you are a beginner and reading this, don't worry; I added code examples to each one&lt;/em&gt;).&lt;/p&gt;




&lt;p&gt;React Hooks were introduced in React 16.8 and quickly became essential for any React developer since they made &lt;strong&gt;creating maintainable and reusable components much more straightforward&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Today, I will talk about 10 essential ones to know!&lt;/p&gt;

&lt;h2&gt;
  
  
  💡 useState
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;useState&lt;/code&gt; hook &lt;strong&gt;is the most basic hook in React&lt;/strong&gt;, being used every time. As you probably already know, it adds a state to your functional components.&lt;/p&gt;

&lt;p&gt;The way it works is it returns an array with two elements. The first element will be the current state, and the second is a function that updates the state.&lt;/p&gt;

&lt;p&gt;Here you have a basic code example using it:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h2&gt;
  
  
  🔥 useEffect
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;useEffect&lt;/code&gt; hook is used to perform side effects in your functional components. In other words, it is a function called when some variables change their value.&lt;/p&gt;

&lt;p&gt;It has two arguments: the first is a function containing your side effects (&lt;em&gt;what you want to do when those variables change&lt;/em&gt;), and the second is an array of the dependencies that we want to watch for changes (&lt;em&gt;so React re-runs this effect&lt;/em&gt;).&lt;/p&gt;

&lt;p&gt;Time for a code example:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h2&gt;
  
  
  🚀 useContext
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;useContext&lt;/code&gt; hook is a more advanced hook (&lt;em&gt;compared to the previous two&lt;/em&gt;). But it is essential to know it!&lt;/p&gt;

&lt;p&gt;It makes it easy to consume context in your functional components. In other words, you can think of context as a way to share data between components &lt;strong&gt;without having to pass props down the component tree&lt;/strong&gt;. So it would be like a state hook shared between components (&lt;em&gt;but only for reading, not updating&lt;/em&gt;).&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h2&gt;
  
  
  🕹 useReducer
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;useReducer&lt;/code&gt; hook &lt;strong&gt;is used to manage your functional components' complex state and action logic&lt;/strong&gt;. It takes a reducer function and an initial state as arguments and returns the current state and a dispatch function.&lt;/p&gt;

&lt;p&gt;The reducer function is just a function that returns the next state based on the current state and an action.&lt;/p&gt;

&lt;p&gt;This is the most similar to the &lt;code&gt;useState&lt;/code&gt; hook since it allows reading and writing the "state," but instead of a single state value, you can have an entire state object, which can be accessed anywhere in your application.&lt;/p&gt;

&lt;p&gt;Don't worry if it sounds complex; with the following example, you will quickly understand it!&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h2&gt;
  
  
  📄 useCallback
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;useCallback&lt;/code&gt; hook is used to return a memorized callback function that only changes when one of its dependencies changes.&lt;/p&gt;

&lt;p&gt;Usually, you use this when you have in your component &lt;strong&gt;a heavy function, so you don't want to re-run it in every re-render the component&lt;/strong&gt; has, only when it is necessary (&lt;em&gt;when the variables used by that function are changed&lt;/em&gt;).&lt;/p&gt;

&lt;p&gt;As you know, it is useful for optimizing performance!&lt;/p&gt;

&lt;p&gt;The way to use it is like this:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h2&gt;
  
  
  🛠️ useMemo
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;useMemo&lt;/code&gt; hook is used to return a memoized value that only changes when one of its dependencies changes. It is similar to the &lt;code&gt;useCallback&lt;/code&gt; hook but &lt;strong&gt;is for memoizing values instead of function returns&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Like the other hook, it is useful for optimizing performance since it avoids unnecessary calculations on every render.&lt;/p&gt;

&lt;p&gt;A good basic example would be:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;In the previous example, we are using the &lt;code&gt;useMemo&lt;/code&gt; hook to avoid sorting the data array every time the component is rendered, improving the performance of the component.&lt;/p&gt;

&lt;h2&gt;
  
  
  📝 useRef
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;useRef&lt;/code&gt; hook &lt;strong&gt;is used to access the value of a DOM element or a component instance in your functional components&lt;/strong&gt;. It will return an object with a &lt;code&gt;current&lt;/code&gt; property that you can use to access that DOM element.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;In the previous example, we used the &lt;code&gt;useRef&lt;/code&gt; hook to access the &lt;code&gt;input&lt;/code&gt; element and set it as focused when clicking the button.&lt;/p&gt;

&lt;p&gt;This hook is useful when we need a direct reference to an element (for example, here, getting the focus to the input element).&lt;/p&gt;

&lt;h2&gt;
  
  
  🔓 useImperativeHandle
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;useImperativeHandle&lt;/code&gt; hook is less known, but it is useful. It is used to customize the instance value of a forwardRef component.&lt;/p&gt;

&lt;p&gt;If you don't know what a forwardRef is, that would be another thing to learn, but I can not explain it in this article since it is out of the scope. But I would recommend you check &lt;a href="https://beta.reactjs.org/reference/react/forwardRef"&gt;this doc&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This hook &lt;strong&gt;helps expose some internal state or methods of a component to the parent component&lt;/strong&gt;.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;In the previous example, the &lt;code&gt;useImperativeHandle&lt;/code&gt; hook is used to expose a custom interface, &lt;code&gt;TextInputRef&lt;/code&gt;, to the parent component.&lt;/p&gt;

&lt;p&gt;This interface has a single method, &lt;code&gt;focus&lt;/code&gt;which can be used to set focus on the text input from the parent component.&lt;/p&gt;

&lt;p&gt;The parent component could access this method through the &lt;code&gt;ref&lt;/code&gt; prop passed to the &lt;code&gt;TextInput&lt;/code&gt; component.&lt;/p&gt;

&lt;h2&gt;
  
  
  🔍 useDebugValue
&lt;/h2&gt;

&lt;p&gt;The last one is another unknown one. The &lt;code&gt;useDebugValue&lt;/code&gt; hook displays a custom label for your hook in the &lt;a href="https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi?hl=en"&gt;React Developer Tools&lt;/a&gt;. It takes as its first argument a value, and optionally it takes a formatted function as its second argument.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;In this example, the &lt;code&gt;useDebugValue&lt;/code&gt; hook provides a custom label for the &lt;code&gt;count&lt;/code&gt; state variable in the React developer tools. That label will change depending on the value of&lt;code&gt;count&lt;/code&gt; , to indicate if the count var is high or low.&lt;/p&gt;

&lt;p&gt;As you can see, &lt;strong&gt;this can be really helpful in debugging&lt;/strong&gt; since it provides more context about the state of your component.&lt;/p&gt;




&lt;p&gt;We are at the end of the article, and as I promised, we have seen 9 hooks that I feel are important to know. These hooks make it easier to build and manage your React components, and since &lt;strong&gt;you can find them in any codebase, it is good to know&lt;/strong&gt;!&lt;/p&gt;

&lt;h2&gt;
  
  
  🌎 Let's Connect!
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;  My &lt;a href="https://twitter.com/thenaubit"&gt;Twitter: @thenaubit&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;a href="https://coderpreneurs.substack.com/"&gt;My Substack&lt;/a&gt; (here I will publish more in-depth articles)&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>beginners</category>
      <category>react</category>
      <category>javascript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>5 Basic Tips Everyone Should Know for Optimizing React Performance 🚀</title>
      <dc:creator>Al - Naucode</dc:creator>
      <pubDate>Sun, 29 Jan 2023 17:08:15 +0000</pubDate>
      <link>https://dev.to/naubit/5-basic-tips-everyone-should-know-for-optimizing-react-performance-22o9</link>
      <guid>https://dev.to/naubit/5-basic-tips-everyone-should-know-for-optimizing-react-performance-22o9</guid>
      <description>&lt;p&gt;React is one of the most used Javascript libraries (&lt;em&gt;or frameworks, or however you want to describe it&lt;/em&gt;) out there. But let's be honest; the more complex the project becomes, the more critical it is to optimize its performance.&lt;/p&gt;

&lt;p&gt;In today's article, I will talk about &lt;strong&gt;10 little tips I have been using these years&lt;/strong&gt; to improve the performance of my React applications. Hopefully, you will find some new tricks here!&lt;/p&gt;

&lt;h2&gt;
  
  
  1️⃣ Use the Production Build
&lt;/h2&gt;

&lt;p&gt;This is pretty obvious, but you will be amazed at the number of projects where I had worked as a freelancer that when I joined, I found t*&lt;em&gt;hey were using the dev build in production&lt;/em&gt;*.&lt;/p&gt;

&lt;p&gt;When developing your application, you should always use the production build to ensure its best performance. Production builds perform many optimizations like modification and removing dead code (&lt;strong&gt;plus some dependencies behave differently depending on which kind of build is calling them&lt;/strong&gt;).&lt;/p&gt;

&lt;p&gt;To use a production build, if you are using CRA or Vite, you can run the &lt;code&gt;npm run build&lt;/code&gt; or &lt;code&gt;yarn build&lt;/code&gt; command or you can set the &lt;code&gt;NODE_ENV&lt;/code&gt; environment variable to &lt;code&gt;production&lt;/code&gt; when starting the development server.&lt;/p&gt;

&lt;h2&gt;
  
  
  2️⃣ Use a Dynamic Import
&lt;/h2&gt;

&lt;p&gt;Dynamic imports are impressive (&lt;em&gt;at least for me&lt;/em&gt;) since they allow you to load modules only when needed instead of loading them when the application starts.&lt;/p&gt;

&lt;p&gt;As you will think, that significantly improves the initial load time of the application.&lt;/p&gt;

&lt;p&gt;Lost of people would use the typical React method with the await import('') method, but I recommend you use a module called &lt;a href="https://github.com/gregberge/loadable-components"&gt;loadable-components&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I prefer this module because it dynamically loads modules, but it also code-splits them, and... it loads the modules only &lt;strong&gt;when used to render something&lt;/strong&gt;! So even better.&lt;/p&gt;

&lt;p&gt;You would use it like this:&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h2&gt;
  
  
  3️⃣ Use Functional Components
&lt;/h2&gt;

&lt;p&gt;Well, this is more of an opinion, but functional components are the current standard for React. Yes, you could still use class components, but you won't be able to use hooks as intended. And let's be honest, that is a core function for the latest React versions!&lt;/p&gt;

&lt;p&gt;Plus, functional components don't have the overhead class components, and you can easily implement features like memorization, which can further improve performance.&lt;/p&gt;

&lt;p&gt;An example of a functional component would be:&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h2&gt;
  
  
  4️⃣ Use Memoization
&lt;/h2&gt;

&lt;p&gt;Memoizing a component is a fantastic way to improve the performance since &lt;strong&gt;you will prevent re-renders if the props haven't changed&lt;/strong&gt; (plus, you can also avoid network requests if it happens you are performing some inside).&lt;/p&gt;

&lt;p&gt;As you may know, in React, you use the &lt;em&gt;useMemo&lt;/em&gt; and &lt;em&gt;useCallback&lt;/em&gt; hooks for this behavior.&lt;/p&gt;

&lt;p&gt;For example, if you want to cache a variable only to be updated when some state changes, you could use the following code:&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h2&gt;
  
  
  5️⃣ Use a Performance Profiler
&lt;/h2&gt;

&lt;p&gt;No optimization guide could be completed without this advice. All these little tips are helpful (&lt;em&gt;and there are many more you could use&lt;/em&gt;), but the key is to determine where the performance loss is happening in your application.&lt;/p&gt;

&lt;p&gt;And that is the objective of a performance profiler: &lt;strong&gt;to identify bottlenecks in your code&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Luckily, you could use one like the one included in the &lt;a href="https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi?hl=en"&gt;React Developer Tools extension&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;This article has been short, but that was the objective. I want to give you some essential insights into improvements I like to make, but I will start writing a series of articles around React optimization, &lt;strong&gt;where we will go in-depth on each technique&lt;/strong&gt;. So if you are interested in learning more about that, don't forget to follow me!&lt;/p&gt;

&lt;p&gt;With that being said, if you wish to connect with me...&lt;/p&gt;

&lt;h2&gt;
  
  
  🌎 Let's Connect!
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;  My &lt;a href="https://twitter.com/thenaubit"&gt;Twitter: @thenaubit&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;a href="https://coderpreneurs.substack.com/"&gt;My Substack&lt;/a&gt; (here I will publish more in-depth articles)&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>webdev</category>
      <category>react</category>
      <category>javascript</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Ace your next JavaScript Interview with these 7 Common Questions and Answers 💻</title>
      <dc:creator>Al - Naucode</dc:creator>
      <pubDate>Wed, 25 Jan 2023 17:53:25 +0000</pubDate>
      <link>https://dev.to/naubit/ace-your-next-javascript-interview-with-these-7-common-questions-and-answers-49co</link>
      <guid>https://dev.to/naubit/ace-your-next-javascript-interview-with-these-7-common-questions-and-answers-49co</guid>
      <description>&lt;p&gt;In this article, I will cover the most common questions you may encounter during &lt;strong&gt;a JavaScript interview&lt;/strong&gt;, providing detailed answers and examples to help you stand out from the competition. Whether you are a beginner or an experienced developer, this guide will give you the confidence you need &lt;strong&gt;to impress your interviewer and land the job&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  1️⃣ What is JavaScript, and how is it different from Java? 🤔
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--AsbzNulW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/0%2Al8XyU1op_VOjizrO" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--AsbzNulW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/0%2Al8XyU1op_VOjizrO" alt="What is JavaScript, and how is it different from Java?" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;JavaScript and Java are both programming languages, but they are used for different purposes and have some key differences.&lt;/p&gt;

&lt;p&gt;JavaScript is a scripting language primarily used to &lt;strong&gt;create interactive and dynamic websites.&lt;/strong&gt; At the same time, Java is a general-purpose programming language that can be used to create a wide range of applications, including mobile and desktop apps, web applications, and backend systems.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The browser executes JavaScript code&lt;/strong&gt;, while Java code is typically compiled and executed on a virtual machine or a specific device.&lt;/p&gt;

&lt;h3&gt;
  
  
  2️⃣ What is the difference between let and var?
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--eVjkoW-p--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/0%2AFPRsBD44FSekX1ln" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--eVjkoW-p--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/0%2AFPRsBD44FSekX1ln" alt="What is the difference between let and var?" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;var&lt;/code&gt; and &lt;code&gt;let&lt;/code&gt; are used to declare variables in JavaScript, but they have some key differences in terms of hoisting and scoping. &lt;code&gt;var&lt;/code&gt; variables are hoisted to the top of their scope and are accessible throughout the entire scope. &lt;code&gt;let&lt;/code&gt; variables, on the other hand, are &lt;strong&gt;only accessible&lt;/strong&gt; within the block they were declared in and do not get hoisted&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h3&gt;
  
  
  3️⃣ What is the difference between == and ===?
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;==&lt;/code&gt; and &lt;code&gt;===&lt;/code&gt; are used for equality comparison in JavaScript, but they behave differently regarding type coercion. &lt;code&gt;==&lt;/code&gt; compares values after type coercion, while `=== &lt;strong&gt;compares values without type coercion&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;{% embed &lt;a href="https://gist.github.com/NauCode/4fcedffd7548ec4195a76f6925f85ec7"&gt;https://gist.github.com/NauCode/4fcedffd7548ec4195a76f6925f85ec7&lt;/a&gt; %}&lt;/p&gt;

&lt;p&gt;It's generally recommended to use &lt;code&gt;===&lt;/code&gt; in most cases &lt;strong&gt;to avoid unexpected behavior&lt;/strong&gt; due to type coercion.&lt;/p&gt;

&lt;h3&gt;
  
  
  4️⃣ What is closure in JavaScript?
&lt;/h3&gt;

&lt;p&gt;A closure in JavaScript is a function that &lt;strong&gt;has access to the variables in its parent scope&lt;/strong&gt;, even after the parent function has returned.&lt;/p&gt;

&lt;p&gt;{% embed &lt;a href="https://gist.github.com/NauCode/e50c1c4c607c52da76ac620471c53664"&gt;https://gist.github.com/NauCode/e50c1c4c607c52da76ac620471c53664&lt;/a&gt; %}&lt;/p&gt;

&lt;p&gt;In this example, the innerFunction has access to the variable x from its parent scope, the outerFunction.&lt;/p&gt;

&lt;h3&gt;
  
  
  5️⃣ What is the difference between call and apply?
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2CFacb0C--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/0%2AHXZ-avr3WO2x_KTs" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2CFacb0C--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/0%2AHXZ-avr3WO2x_KTs" alt="What is the difference between call and apply?" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Both &lt;code&gt;call&lt;/code&gt; and &lt;code&gt;apply&lt;/code&gt; &lt;strong&gt;are used to call a function&lt;/strong&gt; and set the value of &lt;code&gt;this&lt;/code&gt; inside the function, but they have different syntaxes. &lt;code&gt;call&lt;/code&gt; takes in the value of &lt;code&gt;this&lt;/code&gt; as the first argument, followed by any additional arguments for the function.&lt;/p&gt;

&lt;p&gt;{% embed &lt;a href="https://gist.github.com/NauCode/1db71ff3db36d33c3bcb10d381d9671f"&gt;https://gist.github.com/NauCode/1db71ff3db36d33c3bcb10d381d9671f&lt;/a&gt; %}&lt;/p&gt;

&lt;p&gt;&lt;code&gt;apply&lt;/code&gt; also takes in the value of &lt;code&gt;this&lt;/code&gt; as the first argument, but &lt;strong&gt;it expects the additional arguments for the function to be passed in as an array&lt;/strong&gt;.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h3&gt;
  
  
  6️⃣ What is an event loop in JavaScript?
&lt;/h3&gt;

&lt;p&gt;JavaScript uses an event loop to handle concurrency and handle events as they occur. The event loop constantly checks the message queue and the call stack. When a function is called, i*&lt;em&gt;t is added to the call stack and executed&lt;/em&gt;*.&lt;/p&gt;

&lt;p&gt;If any events in the message queue need to be handled, they are added to the call stack and executed. This allows JavaScript to &lt;strong&gt;handle multiple events and function calls simultaneously&lt;/strong&gt; without freezing the main thread.&lt;/p&gt;

&lt;h3&gt;
  
  
  7️⃣ What is the difference between synchronous and asynchronous code?
&lt;/h3&gt;

&lt;p&gt;Synchronous code is &lt;strong&gt;executed line by line&lt;/strong&gt;, and the following line of code can't be executed until the current line is finished.&lt;/p&gt;

&lt;p&gt;Asynchronous code, on the other hand, &lt;strong&gt;allows for multiple operations to occur at the same time&lt;/strong&gt;. In JavaScript, this can be achieved through callbacks or promises.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;In the asynchronous example, the for loop is executed after the "&lt;em&gt;Moving on...&lt;/em&gt;" message is logged, allowing other code to continue executing.&lt;/p&gt;




&lt;p&gt;You have made it to the end of this guide and are now well-equipped with the knowledge and tools &lt;strong&gt;necessary to ace your next JavaScript interview&lt;/strong&gt;. Remember to practice, stay up to date with the latest features and best practices, and, most importantly, &lt;strong&gt;be confident.&lt;/strong&gt; I believe in you and know you will knock your interview out of the park. Good luck! 🍀&lt;/p&gt;

&lt;h3&gt;
  
  
  🌎 Let's Connect!
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;  My &lt;a href="https://twitter.com/thenaubit"&gt;Twitter: @thenaubit&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;a href="https://coderpreneurs.substack.com/"&gt;My Substack&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
    <item>
      <title>Why using just console.log in 2023 is a big no-no 🚀</title>
      <dc:creator>Al - Naucode</dc:creator>
      <pubDate>Wed, 07 Dec 2022 06:30:52 +0000</pubDate>
      <link>https://dev.to/naucode/why-using-just-consolelog-in-2023-is-a-big-no-no-2429</link>
      <guid>https://dev.to/naucode/why-using-just-consolelog-in-2023-is-a-big-no-no-2429</guid>
      <description>&lt;p&gt;Here are 5 must-know console object methods and tricks!&lt;/p&gt;

&lt;p&gt;Are you still using &lt;code&gt;console.log&lt;/code&gt; for all your JavaScript debugging needs in 2023?&lt;/p&gt;

&lt;p&gt;It's time to &lt;strong&gt;upgrade your skills&lt;/strong&gt; and discover the full power of the JavaScript console object.&lt;/p&gt;

&lt;p&gt;From &lt;code&gt;console.table&lt;/code&gt; to &lt;code&gt;console.time&lt;/code&gt;, these advanced methods and tricks will help you &lt;strong&gt;improve the quality and readability of your debug output&lt;/strong&gt; and make it easier to troubleshoot and fix problems in your code.&lt;/p&gt;

&lt;p&gt;So why not join the ranks of the JavaScript ninja debuggers in 2023, and learn these essential techniques? &lt;strong&gt;Your code will thank you.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  😞 The problem
&lt;/h2&gt;

&lt;p&gt;One of the biggest problems with using just &lt;code&gt;console.log&lt;/code&gt; is that it can clutter up your code and make it &lt;strong&gt;difficult to read.&lt;/strong&gt; Additionally, it's not very informative on its own. It just outputs the value of whatever you pass to it without any context or additional information.&lt;/p&gt;

&lt;p&gt;With that in mind, here are ten JavaScript console object methods and tricks &lt;strong&gt;you should know about&lt;/strong&gt; (&lt;em&gt;and give them a try; I know it is faster to just console.log, but it can make your debugging experience way better, do it for your future yourself!&lt;/em&gt;).&lt;/p&gt;

&lt;h2&gt;
  
  
  1️⃣ console.table
&lt;/h2&gt;

&lt;p&gt;This method allows you to &lt;strong&gt;output tabular data in a readable and easy-to-understand format.&lt;/strong&gt; Instead of just logging out an array or object, &lt;code&gt;console.table&lt;/code&gt; will display the data in a tabular format, which makes it easier to scan and understand.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Output an array of objects as a table
const users = [
  { id: 1, name: 'John Doe' },
  { id: 2, name: 'Jane Doe' }
];
console.table(users);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will output the &lt;code&gt;users&lt;/code&gt; array in a tabular format, with the properties of each object as columns and the objects as rows.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhek6gxo4x73b6mvmlawr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhek6gxo4x73b6mvmlawr.png" alt="console.table"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  2️⃣console.group
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;console.group&lt;/code&gt; and &lt;code&gt;console.groupEnd&lt;/code&gt;. These methods allow you to create a nested, collapsible group in the console. &lt;strong&gt;This can be useful for organizing and structuring your debug output&lt;/strong&gt;, so you can easily see what's happening at different levels of your code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;console.group('User Details');
console.log('Name: John Doe');
console.log('Age: 32');
console.groupEnd();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will create a nested, collapsible group in the console with the heading “User Details.” The log messages inside the group &lt;strong&gt;will be indented and grouped together.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8ybn1uwvyltjzxcaaytx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8ybn1uwvyltjzxcaaytx.png" alt="console.group"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  3️⃣console.time
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;console.time&lt;/code&gt; and &lt;code&gt;console.timeEnd&lt;/code&gt;. These methods allow you to measure &lt;strong&gt;the amount of time it takes for a block of code to execute.&lt;/strong&gt; This can be useful for identifying performance bottlenecks in your code and optimizing them.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;console.time('Fetching data');
fetch('https://reqres.in/api/users')
  .then(response =&amp;gt; response.json())
  .then(data =&amp;gt; {
    console.timeEnd('Fetching data');
    // Process the data
  });
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will measure the amount of time it takes to fetch data from the specified URL and parse the JSON response. The elapsed time will be output in the console.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff3hdvnz2of3an1a21j3c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff3hdvnz2of3an1a21j3c.png" alt="console.time"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  4️⃣console.assert
&lt;/h2&gt;

&lt;p&gt;This method allows you to write assertions in your code, which are statements that should always be true. If an assertion fails, &lt;code&gt;console.assert&lt;/code&gt; will output an error message in the console. &lt;strong&gt;This can be useful for catching bugs and ensuring your code is working as expected.&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function add(a, b) {
  return a + b;
}

// Test the add function
const result = add(2, 3);
console.assert(result === 5, 'Expected 2 + 3 = 5');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will output an error message in the console if the &lt;code&gt;add&lt;/code&gt; function does not return the expected result of 5 when given the input 2 and 3.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy25c157xwhasxnaiakd5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy25c157xwhasxnaiakd5.png" alt="console.assert"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  5️⃣Style your logs
&lt;/h2&gt;

&lt;p&gt;Use the &lt;code&gt;console&lt;/code&gt; object to output styles and colors. The &lt;code&gt;console&lt;/code&gt; object &lt;strong&gt;allows you to output text in different colors and styles&lt;/strong&gt;, making your debug output more readable and easier to understand.&lt;/p&gt;

&lt;p&gt;You can use the &lt;code&gt;%c&lt;/code&gt; placeholder in your &lt;code&gt;console.log&lt;/code&gt; statements to specify a CSS style for the output text.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;console.log('%cHello world!', 'color: red; font-weight: bold;');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will output the text “Hello world!” in red and bold, using the specified CSS style.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1p82u116icnlodu046nr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1p82u116icnlodu046nr.png" alt="Styling the console.log output with CSS"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;By the way, if you want even better logs, you might want to use a specialized logging library, which offers more settings. I added &lt;strong&gt;a really good one&lt;/strong&gt; in this article I wrote: &lt;a href="https://dev.to/naubit/5-small-and-hidden-react-libraries-you-should-already-be-using-nb5"&gt;https://dev.to/naubit/5-small-and-hidden-react-libraries-you-should-already-be-using-nb5&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  6️⃣console.trace
&lt;/h2&gt;

&lt;p&gt;Use the &lt;code&gt;console.trace&lt;/code&gt; method to output a stack trace. This can be useful for understanding the flow of execution in your code and for identifying &lt;strong&gt;where a particular log message is coming from.&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function foo() {
  console.trace();
}

function bar() {
  foo();
}

bar();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will output a stack trace in the console, showing the sequence of function calls leading up to the &lt;code&gt;console.trace&lt;/code&gt; call. The output will look something like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzx16nee1mp0avh04msri.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzx16nee1mp0avh04msri.png" alt="console.trace"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  7️⃣console.dir
&lt;/h2&gt;

&lt;p&gt;Use the &lt;code&gt;console.dir&lt;/code&gt; method to output the properties of an object in a hierarchical format. This can be &lt;strong&gt;useful for exploring the structure of an object&lt;/strong&gt; and for seeing all of its properties and methods.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const obj = {
  id: 1,
  name: 'John Doe',
  address: {
    street: '123 Main St',
    city: 'New York',
    zip: 10001
  }
};
console.dir(obj);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will output the properties of the &lt;code&gt;obj&lt;/code&gt; object in a hierarchical format, allowing you to see the structure of the object and all of its properties and values.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fihgkg5e4wxznpaqzb8jr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fihgkg5e4wxznpaqzb8jr.png" alt="console.dir"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  8️⃣console.count
&lt;/h2&gt;

&lt;p&gt;Use the &lt;code&gt;console.count&lt;/code&gt; method to count the number of times a specific log message is an output. This can be useful for &lt;strong&gt;keeping track of how many times a particular code path is executed&lt;/strong&gt; and for identifying hot spots in your code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function foo(x) {
  console.count(x);
}

foo('hello');
foo('world');
foo('hello');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will output the string “hello” in the console, followed by the number 1. It will then output the string “world” in the console, followed by the number 1. Finally, it will output the string “hello” again, followed by the number 2 (&lt;em&gt;since it has been called twice&lt;/em&gt;).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcx7n8aargexpq1pvqj6n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcx7n8aargexpq1pvqj6n.png" alt="console.count"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  9️⃣console.clear
&lt;/h2&gt;

&lt;p&gt;Use the &lt;code&gt;console.clear&lt;/code&gt; method to clear the console output. This can be useful for keeping your debug output &lt;strong&gt;organized and uncluttered&lt;/strong&gt; and for making it easier to focus on the information you're interested in.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;console.log('Hello world!');
console.clear();
console.log('This log message will appear after the console is cleared.');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will output the string “Hello world!” in the console, followed by a blank line (&lt;em&gt;since the console is cleared&lt;/em&gt;). It will then output the string “This log message will appear after the console is cleared.”&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fihzapi1gcin6gtqa600v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fihzapi1gcin6gtqa600v.png" alt="console.clear"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  1️⃣0️⃣console.profile
&lt;/h2&gt;

&lt;p&gt;Use the &lt;code&gt;console.profile&lt;/code&gt; and &lt;code&gt;console.profileEnd&lt;/code&gt; methods to measure the performance of a block of code. This can be useful for &lt;strong&gt;identifying performance bottlenecks and for optimizing your code&lt;/strong&gt; for speed and efficiency.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;console.profile('MyProfile');

// Run some code that you want to measure the performance of
for (let i = 0; i &amp;lt; 100000; i++) {
  // Do something
}

console.profileEnd('MyProfile');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will start profiling the block of code between the &lt;code&gt;console.profile&lt;/code&gt; and &lt;code&gt;console.profileEnd&lt;/code&gt; calls and will output the results in the console when the &lt;code&gt;console.profileEnd&lt;/code&gt; call is executed. The output will include details about the amount of time it took to execute the code and any other performance-related information.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwjw25tagjwdupmqxy1d5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwjw25tagjwdupmqxy1d5.png" alt="console.profile"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  💭 Some final thoughts
&lt;/h2&gt;

&lt;p&gt;In 2023, don’t just settle for &lt;code&gt;console.log&lt;/code&gt; - there are many &lt;strong&gt;more powerful and valuable tools and techniques available in the JavaScript console object.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;From &lt;code&gt;console.table&lt;/code&gt; to &lt;code&gt;console.time&lt;/code&gt;, these methods and tricks will help you improve the quality and readability of your debug output, and make it &lt;strong&gt;easier to troubleshoot and fix problems&lt;/strong&gt; in your code.&lt;/p&gt;

&lt;p&gt;So why not level up your debugging skills in 2023 and give these techniques a try? &lt;strong&gt;Your code (&lt;em&gt;and your sanity&lt;/em&gt;) will thank you.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Oh, and…&lt;/p&gt;

&lt;h2&gt;
  
  
  🌎 Let’s Connect!
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Twitter: &lt;a href="https://twitter.com/thenaubit" rel="noopener noreferrer"&gt;@thenaubit&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>react</category>
      <category>webdev</category>
    </item>
    <item>
      <title>The Secret to Clean and Efficient Code: How to Denest Your Code</title>
      <dc:creator>Al - Naucode</dc:creator>
      <pubDate>Wed, 07 Dec 2022 05:35:10 +0000</pubDate>
      <link>https://dev.to/naucode/the-secret-to-clean-and-efficient-code-how-to-denest-your-code-af1</link>
      <guid>https://dev.to/naucode/the-secret-to-clean-and-efficient-code-how-to-denest-your-code-af1</guid>
      <description>&lt;p&gt;As a programmer, you may be tempted to nest your code to create a more organized and efficient structure.&lt;/p&gt;

&lt;p&gt;But did you know that nesting your code can actually lead to several problems, including &lt;strong&gt;increased complexity&lt;/strong&gt; and decreased readability?&lt;/p&gt;

&lt;p&gt;In this article, we will discuss why you shouldn't nest your code and some methods for denesting it, including &lt;strong&gt;the extraction and inversion methods.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why should you avoid nesting?
&lt;/h2&gt;

&lt;p&gt;By avoiding nested code, you can create a clean and efficient structure that is easy to understand and maintain.&lt;/p&gt;

&lt;p&gt;This will &lt;strong&gt;improve the readability and maintainability of your program&lt;/strong&gt; and can even improve its performance. So, read on to learn more about the dangers of nested code and how to avoid them.&lt;/p&gt;

&lt;p&gt;First and foremost, nesting your code makes it more difficult to read and understand. When you nest multiple layers of code within each other, it &lt;strong&gt;becomes harder&lt;/strong&gt; for other programmers (&lt;em&gt;or even yourself&lt;/em&gt;) to follow the logic and flow of the program. This can lead to confusion and mistakes, especially when working on a large or complex project.&lt;/p&gt;

&lt;p&gt;Furthermore, nesting your code can increase the complexity of your program.&lt;/p&gt;

&lt;p&gt;Each level of nesting adds an additional abstraction layer, &lt;strong&gt;making it more challenging to identify and resolve errors.&lt;/strong&gt; This can lead to more time spent debugging and testing and can even cause your program to crash.&lt;/p&gt;

&lt;p&gt;Additionally, nesting your code can make it more challenging to maintain and update in the future.&lt;/p&gt;

&lt;p&gt;As your program grows and evolves, it can be challenging to keep track of all the nested code blocks and ensure that they are working correctly. This can lead to a tangled mess of code that is hard to work with and modify.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to avoid nesting your code?
&lt;/h2&gt;

&lt;p&gt;So, how can you avoid nesting your code and still maintain a clean and organized structure? Here are a few methods for denesting your code:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;The extraction method:&lt;/strong&gt; Use functions and subroutines to break up your code into smaller, modular chunks. This allows you to separate different logic and functionality, making it easier to understand and maintain.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The inversion method:&lt;/strong&gt; Use conditional statements (like if/else or switch/case) to handle different scenarios without nesting code blocks. This allows you to easily control the flow of your program without adding unnecessary complexity.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  1. The Extraction Method
&lt;/h2&gt;

&lt;p&gt;One method for denesting your code is the extraction method. This involves taking a nested code block and extracting it into its own function or subroutine. This allows you to separate the logic and functionality of the code block, making it easier to understand and maintain.&lt;/p&gt;

&lt;p&gt;Here is an example of the extraction method:&lt;/p&gt;

&lt;p&gt;Original nested code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if (condition1) {
  if (condition2) {
    if (condition3) {
      // Do something
    }
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Extracted code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function doSomething() {
  // Do something
}

if (condition1) {
  if (condition2) {
    if (condition3) {
      doSomething();
    }
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, the nested code block is extracted into a function called "&lt;em&gt;doSomething&lt;/em&gt;". This allows us to quickly reference the code block from multiple places in our program &lt;strong&gt;without duplicating the nested code&lt;/strong&gt; structure.&lt;/p&gt;

&lt;p&gt;The extraction method is a simple and effective way to denest your code and can be applied to any nested code block.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. The Inversion Method
&lt;/h2&gt;

&lt;p&gt;Another method for denesting your code is the &lt;strong&gt;inversion method&lt;/strong&gt;. This involves taking a nested code block and inverting the conditional statement that controls it.&lt;/p&gt;

&lt;p&gt;This allows you to avoid nesting code blocks and &lt;strong&gt;create a more streamlined and efficient structure.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here is an example of the inversion method:&lt;/p&gt;

&lt;p&gt;Original nested code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if (condition1) {
  if (condition2) {
    if (condition3) {
      // Do something
    }
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Inverted code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if (!condition1 || !condition2 || !condition3) {
  return;
}

// Do something
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, the nested code block is inverted by using the logical OR operator (||) to combine the three conditional statements. This allows us to avoid nesting code blocks and create a more concise and efficient structure.&lt;/p&gt;

&lt;h2&gt;
  
  
  Some final thoughts
&lt;/h2&gt;

&lt;p&gt;In conclusion, nesting your code may seem like a good idea initially, but it can lead to several problems.&lt;/p&gt;

&lt;p&gt;To avoid those issues, consider using the extraction and inversion methods to denest your code and create a clean and efficient structure.&lt;/p&gt;

&lt;p&gt;This will improve the readability and maintainability of your program, making it easier to work with and &lt;strong&gt;modify&lt;/strong&gt; in the future.&lt;/p&gt;

&lt;p&gt;So, next time you are tempted to nest your code, remember the dangers of nested code and consider using the extraction and inversion methods to avoid them; as you saw, &lt;strong&gt;it is really easy!&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  🌎 Let's Connect!
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://twitter.com/thenaubit"&gt;Twitter: @thenaubit&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>5 Small and Hidden React libraries You Should Already Be Using</title>
      <dc:creator>Al - Naucode</dc:creator>
      <pubDate>Sun, 04 Dec 2022 00:40:37 +0000</pubDate>
      <link>https://dev.to/naucode/5-small-and-hidden-react-libraries-you-should-already-be-using-nb5</link>
      <guid>https://dev.to/naucode/5-small-and-hidden-react-libraries-you-should-already-be-using-nb5</guid>
      <description>&lt;p&gt;If you, like me, love finding small gems in the NPM directory to improve your development process, today is your lucky day.&lt;/p&gt;

&lt;p&gt;I am starting a new series of articles where I will showcase some &lt;strong&gt;small and less-known libraries&lt;/strong&gt; that I found and use every day that will save you more than one headache.&lt;/p&gt;

&lt;p&gt;So, let's start!&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Urlcat
&lt;/h2&gt;

&lt;p&gt;Urlcat is a tiny Javascript library that makes building URLs very convenient and prevents common mistakes.&lt;/p&gt;

&lt;p&gt;Yeah, you could use the URL API to build your URLs. But still, you will have to take care of some details for yourself instead of just building the URL.&lt;/p&gt;

&lt;p&gt;That is why I love this library. It is just "&lt;em&gt;plug-and-play&lt;/em&gt;." &lt;strong&gt;You don't need to learn complicated patterns&lt;/strong&gt; or spend hours on documentation.&lt;/p&gt;

&lt;p&gt;So, feel free to give it a try: &lt;a href="https://github.com/balazsbotond/urlcat" rel="noopener noreferrer"&gt;https://github.com/balazsbotond/urlcat&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. UseHooks-ts
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk1cm9uacez2zdeidhdfy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk1cm9uacez2zdeidhdfy.png" alt="UseHooks-ts" width="800" height="290"&gt;&lt;/a&gt;&lt;br&gt;
If you are a React developer, you are using hooks (&lt;em&gt;I hope&lt;/em&gt;). If that is the case, &lt;strong&gt;there are probably lots of times you have to create a custom hook for very little things&lt;/strong&gt;. For example, for handling the dark mode. Or for the window resize event. Or lots of other cases.&lt;/p&gt;

&lt;p&gt;UseHooks is a small library with well-coded, well-documented, and fully typed (&lt;em&gt;for Typescript users&lt;/em&gt;) hooks for all those small cases, so you focus on the project itself.&lt;/p&gt;

&lt;p&gt;You can check it here: &lt;a href="https://github.com/juliencrn/usehooks-ts" rel="noopener noreferrer"&gt;https://github.com/juliencrn/usehooks-ts&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Logt
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Furma28vh80pmrnkxu6cm.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Furma28vh80pmrnkxu6cm.gif" alt="Logt" width="800" height="451"&gt;&lt;/a&gt;&lt;br&gt;
I like to have logs everywhere, so when there is some need to know what is going on, I can check them.&lt;/p&gt;

&lt;p&gt;And when I code the front end, &lt;strong&gt;I also want those logs&lt;/strong&gt;. But with some requisites:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It must be fully typed (so I can use it in Typescript without any headache)&lt;/li&gt;
&lt;li&gt;It must be small&lt;/li&gt;
&lt;li&gt;It must have colorful labels (so I know the log type quickly)&lt;/li&gt;
&lt;li&gt;It must have log levels&lt;/li&gt;
&lt;li&gt;It must have some way to hide some logs according to conditions (like if it is a production build or not)&lt;/li&gt;
&lt;li&gt;It must be possible to send those logs somewhere else (like to Sentry)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After a lot of time spent researching (&lt;em&gt;and almost starting to code my own one&lt;/em&gt;), I found Logt, &lt;strong&gt;which meets all my requirements&lt;/strong&gt;, plus a few more.&lt;br&gt;
100% recommended! &lt;a href="https://github.com/sidhantpanda/logt" rel="noopener noreferrer"&gt;https://github.com/sidhantpanda/logt&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Loadable Components
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyaya3p1mldm73idc37gx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyaya3p1mldm73idc37gx.png" alt="Loadable Components" width="800" height="800"&gt;&lt;/a&gt;&lt;br&gt;
If you are trying to optimize your React app, &lt;strong&gt;you are probably using React.lazy&lt;/strong&gt; and Suspense to lazy-load the components.&lt;/p&gt;

&lt;p&gt;That is fine.&lt;/p&gt;

&lt;p&gt;But there are even better ways! For example, this library. Obviously, in this article, I can not give a full explanation about why you should switch from React.lazy to this library but feel free to &lt;a href="https://loadable-components.com/docs/loadable-vs-react-lazy/" rel="noopener noreferrer"&gt;check this post from the author&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Basically, a few key things are it supports &lt;strong&gt;SSR&lt;/strong&gt; (&lt;em&gt;Server Side Rendering&lt;/em&gt;), &lt;strong&gt;Library Splitting&lt;/strong&gt;, and even &lt;strong&gt;full dynamic import&lt;/strong&gt;. Not bad, huh?&lt;/p&gt;

&lt;p&gt;And the best thing. It is really easy to use. &lt;strong&gt;Almost plug-and-play.&lt;/strong&gt; So, give it a try! &lt;a href="https://github.com/gregberge/loadable-components" rel="noopener noreferrer"&gt;https://github.com/gregberge/loadable-components&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Emoji Mart
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3vo44um6dct7k4bnoou4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3vo44um6dct7k4bnoou4.png" alt="Emoji Mart" width="800" height="792"&gt;&lt;/a&gt;&lt;br&gt;
When working on different projects, &lt;strong&gt;I always have to deal with emojis.&lt;/strong&gt; It is something used everywhere right now. And I usually have to add some emoji picker component in the project.&lt;/p&gt;

&lt;p&gt;That is not complicated. But then you start to receive more requirements: it must &lt;strong&gt;lazy-load the emojis&lt;/strong&gt;, it must support &lt;strong&gt;internationalization&lt;/strong&gt;, it must allow &lt;strong&gt;searching&lt;/strong&gt;, it must allow using the same query text as &lt;strong&gt;Slack&lt;/strong&gt;…&lt;/p&gt;

&lt;p&gt;And that takes time. I can do it. But the clients usually prefer me to focus on the project itself. So… I found this little library. &lt;strong&gt;A beautiful and useful one.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let me show you, Emoji Mart! &lt;a href="https://github.com/missive/emoji-mart" rel="noopener noreferrer"&gt;https://github.com/missive/emoji-mart&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;If you are like me, &lt;strong&gt;you love finding these kinds of little and useful libraries&lt;/strong&gt;, easy to use and perfect to integrate with your projects. So, don't worry. I have a big list already ready to share. This is the first 5 of this series. Be sure to &lt;strong&gt;follow me&lt;/strong&gt; to be notified soon when I publish the next ones!&lt;/p&gt;

&lt;p&gt;In the meanwhile…&lt;/p&gt;

&lt;h2&gt;
  
  
  🌎 Let's Connect!
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://twitter.com/thenaubit" rel="noopener noreferrer"&gt;Twitter: @thenaubit&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>watercooler</category>
      <category>career</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
