<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Roberto Silva Zuñiga on Medium]]></title>
        <description><![CDATA[Stories by Roberto Silva Zuñiga on Medium]]></description>
        <link>https://medium.com/@RobertoSilvaZ?source=rss-45b306ad3651------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Eo0O-olcpXTr3Gv0nZUfoA.jpeg</url>
            <title>Stories by Roberto Silva Zuñiga on Medium</title>
            <link>https://medium.com/@RobertoSilvaZ?source=rss-45b306ad3651------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 27 Nov 2026 12:23:28 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@RobertoSilvaZ/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How I Moved My Commits from Main to a New Git Branch and Found Peace Again]]></title>
            <link>https://medium.com/@RobertoSilvaZ/how-i-moved-my-commits-from-main-to-a-new-git-branch-and-found-peace-again-bd1adcfbf23f?source=rss-45b306ad3651------2</link>
            <guid isPermaLink="false">https://medium.com/p/bd1adcfbf23f</guid>
            <category><![CDATA[development]]></category>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[git]]></category>
            <dc:creator><![CDATA[Roberto Silva Zuñiga]]></dc:creator>
            <pubDate>Thu, 10 Oct 2024 01:12:39 GMT</pubDate>
            <atom:updated>2024-10-10T01:12:39.921Z</atom:updated>
            <content:encoded><![CDATA[<p><em>“Accidentally pushed to </em><em>main? 😱 Here’s how I saved my Git history—step-by-step and stress-free!&quot;</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5GW1NUPzaV5pzNuO" /><figcaption>Photo by <a href="https://unsplash.com/@yancymin?utm_source=medium&amp;utm_medium=referral">Yancy Min</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>There’s no worse feeling for a developer than realizing you’ve committed several changes… to the wrong branch! If you’re in that situation, don’t worry — I’ve been there, too, and I found a way out. This is the story of how I successfully moved my commits from main to a new branch, restored main, and got everything back on track.</p><p>And the best part? I’ll show you how to do it in a way that’s simple, fun, and totally doable. Let’s dive in.</p><h4>😭 The Problem: Commits in Main and Wishing You Could Rewind Time</h4><p>Imagine this: you’ve been working on a couple of new features, maybe spending hours or even days on it. You confidently hit push... only to realize you’ve uploaded those commits to main! What should have been a simple update in your working branch now feels like a serious problem.</p><p>Why avoid unplanned commits in main? Well, main is usually our “holy branch,” where only clean, tested, and production-ready code belongs. So if you’ve accidentally pushed commits there, it’s likely you’ll want to move them to a new branch and leave main as if nothing happened.</p><h4>😃 The Solution: Moving Commits with a Temporary Branch and a Solid Reset</h4><p>Ready to restore peace in main? Here’s the Git trick I used to move the commits to a different branch while leaving main untouched. I broke it down into four simple steps:}</p><p><strong>1. Create a New Branch</strong> from the current state of main.<br>First, I wanted to ensure I didn’t lose my work, so I created a new branch with all the commits I’d just pushed to main:</p><pre>git checkout -b new-branch-name</pre><p>Now, I could breathe easier! My commits had a safe place to live in new-branch-name.</p><p><strong>2. Go Back to </strong><strong>Main and Restore Its Original State.</strong><br>Once my changes were safely stored in the new branch, I returned to main to remove the unwanted commits. I first found the last “clean” commit I wanted to keep (you can use git log to see the history). Then I used this command to reset main to the previous state:</p><pre>git checkout main<br>git reset --hard abc1234   # Replace with your last clean commit hash</pre><p>3. <strong>Force Push to </strong><strong>Main.</strong><br>With main in the desired state, the next step was to update the remote repository. Since this was an overwrite, I used a push --force:</p><pre>git push --force origin main</pre><p>This was the key step that restored main on GitHub, removing any recent changes from the primary branch.</p><p>4. <strong>Push the New Branch with the Saved Commits.</strong><br>And there you have it! Now it’s time to push the new branch we created at the beginning, ensuring no work is lost:</p><pre>git push -u origin new-branch-name</pre><h4>Why This Method Works So Well 🤩</h4><p>This strategy is pretty slick for several reasons:</p><ul><li><strong>Keeps the History Clean in </strong><strong>Main</strong>: Main stays free from unwanted commits, helping keep the history readable.</li><li><strong>Extra Security by Creating a New Branch</strong>: Having a branch with the commits ensures you don’t lose anything before running reset.</li><li><strong>Total Control over GitHub</strong>: After the push --force, you can double-check main and see the restored state before merging it anywhere else.</li></ul><p>Next time you find yourself in this situation, don’t worry! Now you have the step-by-step guide to move your commits and return main to normal. Git can be your best friend or your worst enemy, but with these tricks, you’ll have it working in your favor.</p><p><strong>Share your Git stories in the comments, and let me know if you’ve ever had to move commits like I did! …and don’t forget to give me lots of claps 😉</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bd1adcfbf23f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Git Revert: Your Error-Fixing Superpower!]]></title>
            <link>https://medium.com/@RobertoSilvaZ/git-revert-your-error-fixing-superpower-2018643dc9cb?source=rss-45b306ad3651------2</link>
            <guid isPermaLink="false">https://medium.com/p/2018643dc9cb</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[engineering]]></category>
            <dc:creator><![CDATA[Roberto Silva Zuñiga]]></dc:creator>
            <pubDate>Wed, 10 Jan 2024 17:02:37 GMT</pubDate>
            <atom:updated>2024-01-10T17:02:37.737Z</atom:updated>
            <content:encoded><![CDATA[<p><em>🦸‍♂️ Don’t Panic, Git Revert is Here to Save the Day!</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*M_fVszH5pW8fBXB1" /><figcaption>Photo by <a href="https://unsplash.com/@nullplus?utm_source=medium&amp;utm_medium=referral">Razvan Chisu</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Have you ever found yourself in the terrifying situation of pushing to the wrong Git branch and realizing you’ve made a crucial mistake? 🙀 Every programmer, at some point in their career, has experienced that overwhelming feeling of panic. But here’s the good news: Git Revert is here to rescue you.</p><h3>What is Git Revert? 🤔</h3><p>Git Revert is a magical tool that allows you to undo a specific commit without erasing your project’s history. This feature is like a superhero coming to your rescue when you make a mistake in your Git repository. Did you accidentally push to the wrong branch? Did you upload changes you shouldn’t have? Git Revert is your best friend in these situations.</p><h3>How Does Git Revert Work? 🛠️</h3><p>When you use Git Revert, what you’re really doing is creating a new commit that undoes the changes introduced by a previous commit. This means you can go back in time and fix your mistakes without wiping out your project’s history. Your collaborators won’t lose track of what has happened, and you won’t feel like the world is crashing down on you.</p><h3>The Power of Drama-Free Correction 🌟</h3><p>Imagine this scenario: you’re working on a critical project, and you accidentally push to the production branch instead of the development branch. In that moment, panic might seize you, thinking about the catastrophic consequences of your actions. But this is where Git Revert comes into play.</p><p>With Git Revert, you can swiftly and easily revert that troublesome commit from the production branch. This means you can correct the error without affecting your collaborators or the project’s stability. It’s as if you never made the mistake in the first place</p><p>👉 <strong>Example 1: Undoing the Last Commit<br></strong>Let’s say you accidentally made changes to a file and committed them to your master branch. You realize that these changes are incorrect and need to be undone. You can use git revert like this:</p><pre>&gt; git checkout master<br>&gt; git revert HEAD<br>&gt; git push origin master</pre><p>This command will create a new commit that undoes the changes introduced by the last commit, effectively fixing your mistake. After executing this command and pushing the changes, you’ll see a new commit on GitHub that negates the last commit’s changes.</p><p>👉 <strong>Example 2: Reverting a Specific Commit</strong><br>Suppose you made a commit with the hash abcdef123 that introduced a bug, and you need to revert it. You can use git revert with the commit&#39;s hash:</p><pre>&gt; git checkout master<br>&gt; git revert abcdef123<br>&gt; git push origin master</pre><p>Git will create a new commit that undoes the changes introduced by the abcdef123 commit. After pushing these changes, you&#39;ll see a new commit on GitHub that undoes the specified commit&#39;s changes.</p><p>👉 <strong>Example 3: Reverting Multiple Commits</strong><br>If you need to revert multiple commits, you can specify a range of commits to revert. For instance, if you want to revert commits 1234567 and 9876543, you can use:</p><pre>&gt; git checkout master<br>&gt; git revert 1234567..9876543<br>&gt; git push origin master</pre><p>Git will create separate revert commits for each of these two commits. After pushing these changes, you’ll see multiple new commits on GitHub, each undoing the changes introduced by one of the specified commits.</p><h3>Conclusion 🎉</h3><p>Git Revert is your superhero in the Git world. You no longer have to fear making mistakes when pushing to the wrong branch. With Git Revert, you have the power to fix your errors effectively and drama-free. So, the next time you find yourself in a panic-inducing situation due to a Git mistake, remember that Git Revert is there to rescue you and help you move forward with confidence and determination. Never let an error stand in your way to success as a programmer! 💪</p><p><strong>Let me know if you liked it…or if you want to know anything else 😉<br>…and don’t forget to give me lots of claps 😁</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2018643dc9cb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I should use PureComponent?]]></title>
            <link>https://medium.com/@RobertoSilvaZ/i-should-use-purecomponent-44e1ededb5ce?source=rss-45b306ad3651------2</link>
            <guid isPermaLink="false">https://medium.com/p/44e1ededb5ce</guid>
            <category><![CDATA[web]]></category>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[mobile]]></category>
            <dc:creator><![CDATA[Roberto Silva Zuñiga]]></dc:creator>
            <pubDate>Wed, 06 Dec 2023 23:21:31 GMT</pubDate>
            <atom:updated>2023-12-06T23:28:27.334Z</atom:updated>
            <content:encoded><![CDATA[<p>When developing React applications, optimizing performance is a crucial consideration, and one aspect of this optimization is minimizing unnecessary re-rendering of components.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*IPEbrx-z0pTT4PQx" /><figcaption>Photo by <a href="https://unsplash.com/@clemhlrdt?utm_source=medium&amp;utm_medium=referral">Clément Hélardot</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>In this article, we will explore two approaches to achieve better optimization for your components: PureComponent for class components and React.memo for functional components.</p><h4><strong>Understanding “PureComponent” 👀</strong></h4><p>PureComponent is a built-in class in React that can be used to optimize the rendering of class components. It is designed to automatically perform a shallow comparison of props and state to determine whether a component should re-render. Let&#39;s take a look at an example:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/caa2352d287b59be0bdb4162d41745da/href">https://medium.com/media/caa2352d287b59be0bdb4162d41745da/href</a></iframe><p>In this example, we use PureComponent to automatically handle the shouldComponentUpdate logic, ensuring that the component only re-renders when the relevant data (props and state) changes. This leads to a more efficient component.</p><h4>Utilizing “React.memo” with Functional Components 👀</h4><p>For functional components, we can achieve a similar optimization using the React.memo higher-order component. React.memo memoizes a functional component and re-renders it only if the props have changed. Here&#39;s an example:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9528bac2c19662c718bf94070309c593/href">https://medium.com/media/9528bac2c19662c718bf94070309c593/href</a></iframe><p>In this functional component, we wrap it with React.memo, which effectively achieves the same result as PureComponent. The component re-renders only when the name prop changes.</p><h3>Comparing the Two Approaches 🤓</h3><p>Both PureComponent and React.memo serve the same purpose: optimizing rendering by preventing unnecessary re-renders. However, there are some key differences:</p><ol><li><strong>Class vs. Functional Components</strong>: PureComponent is used with class components, while React.memo is used with functional components. This reflects the modern trend in React towards functional components.</li><li><strong>Code Conciseness</strong>: Functional components tend to have more concise code, especially when using hooks and React.memo. They promote a cleaner and more expressive coding style.</li><li><strong>Automatic vs. Manual</strong>: PureComponent automatically handles the shouldComponentUpdate logic, while with React.memo, you need to explicitly wrap your component. This can be seen as an advantage or disadvantage depending on your preference.</li></ol><h3>Conclusion</h3><p>Optimizing React components is essential for delivering a high-performance user experience. Both PureComponent and React.memo provide effective ways to achieve this goal, whether you are using class components or embracing the functional component paradigm.</p><p>In modern React development, functional components and hooks are becoming increasingly popular, making React.memo a more common choice for optimization. However, the choice between PureComponent and React.memo ultimately depends on your project&#39;s requirements and your coding style preferences.</p><p>By understanding these optimization techniques, you can ensure that your React applications are efficient and responsive, providing a smoother experience for your users.</p><p><strong>Let me know if you liked it…or if you want to know anything else 😉<br>…and don’t forget to give me lots of claps 😁</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=44e1ededb5ce" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to update all your dependencies]]></title>
            <link>https://medium.com/@RobertoSilvaZ/how-to-update-all-your-dependencies-1d11a1a2dea1?source=rss-45b306ad3651------2</link>
            <guid isPermaLink="false">https://medium.com/p/1d11a1a2dea1</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[backend-development]]></category>
            <dc:creator><![CDATA[Roberto Silva Zuñiga]]></dc:creator>
            <pubDate>Mon, 08 May 2023 22:57:26 GMT</pubDate>
            <atom:updated>2023-05-08T22:57:26.472Z</atom:updated>
            <content:encoded><![CDATA[<h4>I want to talk about a critical aspect of software development that is often overlooked: keeping the dependencies in package.json updated.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*V_scUNzLXf2CNDku" /><figcaption>Photo by <a href="https://unsplash.com/@flyd2069?utm_source=medium&amp;utm_medium=referral">FLY:D</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>When we create a project, we often rely on third-party packages and libraries to handle specific functionalities. We list these dependencies in the package.json file, along with their versions. Over time, as we make updates to our codebase, the packages we use may also change. As a result, it’s essential to keep our dependencies up-to-date to ensure that our project runs smoothly and efficiently.</p><p>In this post, I’ll discuss why it’s crucial to keep our dependencies updated, the potential risks of neglecting them, and some best practices to ensure that we’re managing them effectively. Whether you’re a seasoned developer or just getting started, this post will provide you with valuable insights into the importance of staying on top of your package.json dependencies. So, let’s dive in!</p><h4>⛑️ Why it’s crucial to keep our dependencies updated:</h4><ul><li><strong>Security vulnerabilities</strong>: outdated dependencies may contain security vulnerabilities that can be exploited by attackers to compromise your application and steal sensitive information.</li><li><strong>Performance</strong>: updates to dependencies can often include performance improvements that can significantly impact the speed and efficiency of your application.</li><li><strong>Compatibility</strong>: updates to dependencies can also ensure compatibility with other tools and technologies you may be using, preventing potential conflicts and issues down the road.</li></ul><h4>🛡️ The potential risks of neglecting them:</h4><ul><li><strong>Security breaches</strong>: outdated dependencies may contain known vulnerabilities that can be exploited by attackers to compromise your system and steal valuable data.</li><li><strong>Compatibility issues</strong>: outdated dependencies may become incompatible with other dependencies, leading to unexpected errors and crashes.</li><li><strong>Technical debt</strong>: neglecting dependency updates can lead to technical debt, making it harder and more time-consuming to update dependencies in the future.</li></ul><h4>✅ Some best practices to ensure that we’re managing them effectively:</h4><ul><li>Regularly review dependencies and their versions to ensure they are up-to-date.</li><li>Use automated tools to check for vulnerabilities and update dependencies automatically.</li><li>Keep track of any breaking changes in dependencies and plan accordingly.</li><li>Test your application thoroughly after updating dependencies to ensure everything is still working as expected.</li><li>Use a version control system to track changes to your dependencies over time.</li></ul><h3>The Magic 🤩</h3><p>npm-check-updates is a popular tool that can help automate the process of updating dependencies in your package.json file. It scans your project&#39;s dependencies and checks for available updates, allowing you to easily upgrade them with a single command.</p><p>Here’s an example of how to use npm-check-updates to update your project&#39;s dependencies:</p><p>1. First, you’ll need to install the npm-check-updates package globally by running the following command:</p><pre>npm install -g npm-check-updates</pre><p>2. Next, navigate to your project’s root directory and run the following command to see which dependencies have available updates:</p><pre>npm-check-updates</pre><p>This will show you a list of all the dependencies in your package.json file that can be updated, along with their current and latest versions.</p><p>3. To update all of your project’s dependencies to their latest versions, run the following command:</p><pre>npm-check-updates -u</pre><p>This will update your package.json file with the latest versions of all your dependencies.</p><p>4. Finally, run the following command to install the updated dependencies:</p><pre>npm install</pre><p>This will install the updated dependencies into your project. You will see something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/557/1*HL6MGfZdEmrNS_x0ddvRcw.png" /></figure><p><strong>Let me know if you liked it…or if you want to know anything else 😉<br>…and don’t forget to give me lots of claps 😁</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1d11a1a2dea1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Jupyter in Docker]]></title>
            <link>https://medium.com/@RobertoSilvaZ/jupyter-in-docker-fd8e398dd290?source=rss-45b306ad3651------2</link>
            <guid isPermaLink="false">https://medium.com/p/fd8e398dd290</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Roberto Silva Zuñiga]]></dc:creator>
            <pubDate>Wed, 12 Apr 2023 15:26:16 GMT</pubDate>
            <atom:updated>2023-04-12T15:26:16.000Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Check out how you can run Jupyter in a Docker container.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*j9Dg1hgyR8clx6D5" /><figcaption>Photo by <a href="https://unsplash.com/@mbaumi?utm_source=medium&amp;utm_medium=referral">Mika Baumeister</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Let me show you how you can run in a simple way <strong>Jupyter Notebook </strong>in a <strong>Docker </strong>container. This is useful if you want to run Jupyter on a server.</p><h4><strong>Features </strong>😎</h4><ul><li>Based on <strong>Python</strong> <strong>3.9</strong> and <strong>Jupyter 6.5</strong>.</li><li>Once you run the container, automatically will install the libraries located in the <strong>requirements.txt</strong> file.</li><li>If you want to install other libraries, you can add them to the requirements.txt file and rebuild the container.</li><li>Once you run the container, you can access to Jupyter in the <strong>port 8888</strong>.</li><li>There is no password for the Jupyter notebook.</li><li>You can add your own notebooks or files to the <strong>/notebooks</strong> folder and they will be available in Jupyter.</li><li>You can handle your environment variables in the <strong>.env</strong> file.</li></ul><h4>Show me the code 🙏</h4><ol><li>Create a new directory and let’s move there</li><li>Create the file <strong>.env</strong> and add the environments vars you need</li><li>Create the file <strong>requirements.txt</strong> and include the libraries below. Here you can add the library for Python whatever you want</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ab7c35928d4e2e08c19cf0b6925cf285/href">https://medium.com/media/ab7c35928d4e2e08c19cf0b6925cf285/href</a></iframe><p>4. Create the file <strong>Dockerfile</strong> and add the code below</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/40e8743af15557a181bf5e53f0b9accc/href">https://medium.com/media/40e8743af15557a181bf5e53f0b9accc/href</a></iframe><p>5. Create the file <strong>docker-compose.yaml </strong>to handle the build of the container for Jupyter</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7c57109c1ffc3ed4f8a7fbd90108b0a9/href">https://medium.com/media/7c57109c1ffc3ed4f8a7fbd90108b0a9/href</a></iframe><p>6. Now you are ready to run the Docker container 🎖️<br>6.1 Run docker-compose up<br>6.2 Open http://localhost:8888 in your browser<br>6.3 Enjoy! ✨</p><p>Because I love to make life easy for you🤩 …you can find the repository of the code <a href="https://github.com/RobertoSilvaZ/jupyter-docker">over here</a> 👇</p><p><a href="https://github.com/RobertoSilvaZ/jupyter-docker">GitHub - RobertoSilvaZ/jupyter-docker: The idea with this project is to have a simple way to run Jupyter in a Docker container</a></p><p><strong>Let me know if you liked it…or if you want to know anything else 😉<br>…and don’t forget to give me lots of claps 😁</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fd8e398dd290" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Adding Environments vars to Esbuild]]></title>
            <link>https://medium.com/@RobertoSilvaZ/adding-environments-vars-to-esbuild-b2a8e11b601e?source=rss-45b306ad3651------2</link>
            <guid isPermaLink="false">https://medium.com/p/b2a8e11b601e</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Roberto Silva Zuñiga]]></dc:creator>
            <pubDate>Tue, 11 Apr 2023 20:20:00 GMT</pubDate>
            <atom:updated>2023-04-11T20:37:54.125Z</atom:updated>
            <content:encoded><![CDATA[<p>Are you tired of hardcoding configuration values into your Esbuild scripts?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KxiQLthtWuoptRxH" /><figcaption>Photo by <a href="https://unsplash.com/@filisantillan?utm_source=medium&amp;utm_medium=referral">Fili Santillán</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>In this article I’ll show you how you can easily add environment variables to your code, obviously, you’ll need to have your project set up first, if not follow this other article <a href="https://medium.com/@RobertoSilvaZ/the-secret-to-lightning-fast-web-development-40b4443b914a">The Secret to Lightning Fast Web Development</a> and then you should take check out this article 👈</p><p><a href="https://medium.com/@RobertoSilvaZ/the-secret-to-lightning-fast-web-development-40b4443b914a">The Secret to Lightning-Fast Web Development</a></p><p>Now, once you have set up your project, follow the steps below:</p><ol><li>Go to your config file for Esbuild, according to the example in the previous article, the file is <strong>build.js</strong></li></ol><pre>/project<br>├── /public<br>├── /src<br>│   package.js<br>│   tsconfig.json<br>│   build.js 👈<br>...</pre><p>2. Add a new property in the body of the configuration code called “<strong>define</strong>”</p><pre>...<br>define: {<br>  &#39;process.env.TITLE&#39;: &#39;&quot;This is a Title&quot;&#39;,<br>  &#39;process.env.VERSION&#39;: &#39;&quot;1.0.0&quot;&#39;<br>}</pre><p>In that case, I’m creating two env vars “<strong>TITLE</strong>” and “<strong>VERSION</strong>”, now your config file should look like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8199b55e096e6b89ee7778966b3cf297/href">https://medium.com/media/8199b55e096e6b89ee7778966b3cf297/href</a></iframe><p>3. <strong>Perfect! 🎖️ </strong>Now you can start to call your custom env vars in your Typescript code:</p><pre>const title   = process.env.TITLE;<br>const version = process.env.VERSION;</pre><p><strong>Let me know if you liked it…or if you want to know anything else 😉<br>…and don’t forget to give me lots of claps 😁</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b2a8e11b601e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Secret to Lightning-Fast Web Development]]></title>
            <link>https://medium.com/@RobertoSilvaZ/the-secret-to-lightning-fast-web-development-40b4443b914a?source=rss-45b306ad3651------2</link>
            <guid isPermaLink="false">https://medium.com/p/40b4443b914a</guid>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Roberto Silva Zuñiga]]></dc:creator>
            <pubDate>Tue, 28 Mar 2023 23:02:46 GMT</pubDate>
            <atom:updated>2023-04-11T20:46:06.724Z</atom:updated>
            <content:encoded><![CDATA[<h3>How One Tool Can Save You Time and Boost Performance</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xyBfyCsPHpTG1-pM" /><figcaption>Photo by <a href="https://unsplash.com/@afgprogrammer?utm_source=medium&amp;utm_medium=referral">Mohammad Rahmani</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>As web applications grow in size and complexity, so too does the process of building and bundling the various assets required for them to function properly. This can be a time-consuming and frustrating process, especially for us developers who need to frequently rebuild and update our applications.</p><p>Fortunately, there is a solution that can significantly streamline the build process, saving developers time and improving overall application performance. <strong>Esbuild</strong> is a modern build tool that leverages advanced techniques to quickly and efficiently compile and bundle web applications.</p><p>One of the key benefits of using Esbuild is its seamless integration with <strong>TypeScript</strong>, <strong>a popular language for building scalable web applications</strong>. With Esbuild, developers can easily incorporate TypeScript into builds, allowing for faster and more reliable compilation of TypeScript code. This can help catch bugs earlier in the development process and improve overall code quality.</p><p>In this post, we’ll explore the benefits of<strong> using Esbuild with TypeScript</strong> and discuss how it<strong> can help us achieve faster and more efficient web development</strong>. So whether you’re an experienced developer looking to streamline your workflow or a newcomer to web development looking for ways to improve your skills, read on to find out how Esbuild and TypeScript can help you achieve your goals.</p><h4>Stop to talk…show me the code 😎</h4><p>….so the idea is to work in <strong>Typescript </strong>and make the build to generate <strong>Javascript files compressed</strong> and make them readable for the <strong>FrontEnd </strong>side</p><ol><li>Create a directory in your project and generate the main configuration</li></ol><pre>&gt; mkdir project &amp;&amp; cd project &amp;&amp; npm init --y</pre><p>2. Install the <strong>Esbuild </strong>and <strong>typescript </strong>packages into the dev dependencies</p><pre>&gt; npm i esbuild typescript --save-dev</pre><p>3. Create the folder structure to save our Typescript code. <em>For this example, every .ts file contains some piece of code related to a specific functionality</em></p><pre>/project<br>├── /src <br>│   ├── /ts<br>│   │   ├── variables.ts<br>│   │   ├── elements.ts<br>│   │   ├── form.ts<br>...</pre><p>4. Create the folder structure where each .ts file will be converted to a compressed javascript file automatically when hitting the build</p><pre>/project<br>├── /public<br>│   ├── /js (👈 in this folder each .ts will be converted to .js)<br>│   ├── /images<br>│   ├── /css<br>│   ├── index.html<br>...</pre><p>5. Create a file in the root of the project called <strong>tsconfig.json</strong> to set the config of Typescript for the project</p><pre>/project<br>├── /public<br>├── /src<br>│   package.js<br>│   tsconfig.json 👈<br>...</pre><p>6. Add the code below into the file <strong>tsconfig.json</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2831b8515871f4eea6dfbad95541c950/href">https://medium.com/media/2831b8515871f4eea6dfbad95541c950/href</a></iframe><p>7. Create a file in the root of the project called <strong>build.js</strong>, in this file we are going to add the config to generate the bundle</p><pre>/project<br>├── /public<br>├── /src<br>│   package.js<br>│   tsconfig.json<br>│   build.js 👈<br>...</pre><p>8. Add the code below into the file <strong>build.js</strong> to set the config for the build</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f7f6f9a8786dfa09db1df125da8db312/href">https://medium.com/media/f7f6f9a8786dfa09db1df125da8db312/href</a></iframe><blockquote>Keep in mind about <strong>entryPoints </strong>will generate the .js files following the order of the file in that array declared 🫡</blockquote><p>9. Now you will need to go to the <strong>package.json</strong> file to set the <strong>script</strong> in order to run the Esbuild compiler</p><pre>{<br>  &quot;name&quot;: &quot;project&quot;,<br>  &quot;version&quot;: &quot;0.0.1&quot;,<br>  &quot;description&quot;: &quot;&quot;,<br>  &quot;scripts&quot;: {<br>    &quot;build&quot;: &quot;node build.js&quot; &lt;==<br>  },<br>  &quot;author&quot;: &quot;&quot;,<br>  &quot;license&quot;: &quot;ISC&quot;,<br>  &quot;devDependencies&quot;: {<br>    &quot;esbuild&quot;: &quot;^0.17.10&quot;,<br>    &quot;typescript&quot;: &quot;^4.9.5&quot;<br>  }<br>}</pre><p>10. Perfect 🎉! Now just to need run the command:</p><pre>&gt; npm run build</pre><p>And the result will be:</p><pre>/project<br>├── /public<br>│   ├── /js<br>│   │   ├── variables.js<br>│   │   ├── elements.js<br>│   │   ├── form.js<br>...</pre><p>So, that means you can call each<strong> .js</strong> file independently in your <strong>.html </strong>file such as a simple bundle file 🏆</p><pre>&lt;script src=&quot;./js/form.js&quot;&gt;&lt;/script&gt;</pre><h4>With this awesome implementation, you just have to upload the public folder to your server with everything transpilated/minified previously 😻</h4><p>If you want to add environment vars to your project follow this other article 👇</p><p><a href="https://medium.com/@RobertoSilvaZ/adding-environments-vars-to-esbuild-b2a8e11b601e">Adding Environments vars to Esbuild</a></p><p><strong>Let me know if you liked it…or if you want to know anything else 😉 <br>…and don’t forget to give me lots of claps 😁</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=40b4443b914a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What cloud services do I need to start a project?]]></title>
            <link>https://medium.com/@RobertoSilvaZ/choosing-the-right-cloud-services-for-start-your-project-f70775fa0a32?source=rss-45b306ad3651------2</link>
            <guid isPermaLink="false">https://medium.com/p/f70775fa0a32</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[development]]></category>
            <dc:creator><![CDATA[Roberto Silva Zuñiga]]></dc:creator>
            <pubDate>Tue, 14 Feb 2023 20:59:35 GMT</pubDate>
            <atom:updated>2023-02-15T12:15:34.514Z</atom:updated>
            <content:encoded><![CDATA[<h4>If you don’t want to spend time searching for the technical requirements and focus on coding your solution, read this article</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vtz96Sa_ZefpbPSm" /><figcaption>Photo by <a href="https://unsplash.com/@domenicoloia?utm_source=medium&amp;utm_medium=referral">Domenico Loia</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><blockquote>When it comes to IT infrastructure for an application or website, there are three main options: <strong>Infrastructure-as-a-Service</strong> (IaaS), <strong>Platform-as-a-Service</strong> (PaaS), and <strong>Serverless Computing</strong>. Each of these options has its own advantages and disadvantages, so it’s important to carefully consider your needs before making a decision.</blockquote><p>Starting a new project can be an exciting but overwhelming experience. With so many technical requirements to consider, it can be hard to know where to start. In this article, I’ll take a look at the different types of cloud services and suggest some options to help you get started with your project using eCommerce as an example.</p><ol><li><strong>Endpoints</strong> (<strong><em>Serverless</em></strong>) 🖇<br>Endpoints are a crucial part of any web application, as they provide a way for users to interact with your system. Serverless computing is a great option for endpoints because it allows you to focus on writing code without worrying about server management. Some popular serverless options for endpoints are AWS Lambda, Google Cloud Functions, and Microsoft Azure Functions.</li><li><strong>Databases</strong> (<strong><em>PaaS</em></strong>) 🗄<br>Databases are where your application stores data, such as user information, product catalogues, and order history. Using a platform-as-a-service (PaaS) database can save you time and effort in database management, and many PaaS databases also come with features like automatic backups and scaling. Popular PaaS database options include Amazon RDS, Google Cloud SQL, and Azure SQL.</li><li><strong>Hosting for web</strong> (<strong><em>IaaS</em></strong>) 📂<br>When it comes to hosting your web application, infrastructure-as-a-service (IaaS) can give you more control and flexibility than a PaaS solution. With IaaS, you have complete control over the underlying infrastructure, which can be useful if you have specific requirements for your application. Popular IaaS options for web hosting are Amazon EC2, Google Compute Engine, and Microsoft Azure Virtual Machines.</li><li><strong>Hosting for images</strong> (<strong><em>IaaS</em></strong>) 🖼<br>If your eCommerce project includes images, you’ll need a way to store and serve those images to users. Cloud object storage can be a cost-effective and scalable way to do this. With infrastructure-as-a-service (IaaS) object storage, you can store and retrieve images via APIs, and scale storage up or down as needed. Popular IaaS object storage options are Amazon S3, Google Cloud Storage, and Microsoft Azure Blob Storage.</li><li><strong>Event Logging</strong> (<strong><em>Serverless</em></strong>) 🔍<br>When you’re developing an application, it’s important to have good logging in place to help you debug issues and monitor performance. With serverless logging, you can collect and view logs from your application without having to manage a logging infrastructure. Popular options for serverless logging are AWS CloudWatch Logs, Google Cloud Logging, and Azure Monitor.</li><li><strong>Login </strong>(<strong><em>PaaS</em></strong>) 🔐<br>For user authentication in your eCommerce application, we recommend using an authentication and authorization service, such as AWS Cognito or Firebase Authentication. These services allow you to easily add authentication and authorization functions to your application without having to write authentication code from scratch.</li><li><strong>SMS Messaging</strong> (<strong><em>PaaS</em></strong>) 💬<br>If you need to send SMS messages for things like account verification or order confirmations, using a platform-as-a-service (PaaS) messaging service can save you time and effort. With PaaS messaging, you can send SMS messages via APIs, and the provider will handle things like message delivery and carrier integrations. Popular PaaS messaging options are Amazon SNS, Google Cloud Messaging, and Azure Notification Hubs.</li><li><strong>PDF Generation</strong> (<strong><em>Serverless</em></strong>) 🧾<br>In an eCommerce application, you may need to generate PDF receipts or invoices for customers. With serverless PDF generation, you can create PDFs on the fly without having to manage a PDF generation infrastructure. Popular options for serverless PDF generation are AWS Lambda with PDFtk, Google Cloud Functions with DocHub, and Azure Functions with PDF.co.</li><li><strong>Domain SSL</strong> (<strong><em>PaaS</em></strong>) <strong>🌎</strong><br>Lastly, if you’re hosting a web application, it’s important to have SSL encryption in place to protect user data. With platform-as-a-service (PaaS) SSL, you can obtain and manage SSL certificates without having to manage your own certificate infrastructure. Popular PaaS SSL options are Amazon Certificate Manager, Google Cloud SSL certificates, and Azure Key Vault.</li></ol><p>In conclusion, starting a new project can be a daunting task, but with the right cloud services in place, you can focus on writing code and building your application. Using serverless and PaaS/IaaS solutions can save you 😉.</p><p>Let me know if you want to see some examples…<br>….and don’t forget to give me lots of claps 😁</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f70775fa0a32" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Instalar Postgres en WSL2]]></title>
            <link>https://medium.com/@RobertoSilvaZ/instalar-postgres-en-wsl2-96810563f177?source=rss-45b306ad3651------2</link>
            <guid isPermaLink="false">https://medium.com/p/96810563f177</guid>
            <category><![CDATA[wsl-2]]></category>
            <category><![CDATA[postgres]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[backend]]></category>
            <category><![CDATA[database]]></category>
            <dc:creator><![CDATA[Roberto Silva Zuñiga]]></dc:creator>
            <pubDate>Thu, 09 Feb 2023 21:26:50 GMT</pubDate>
            <atom:updated>2023-02-09T21:26:50.654Z</atom:updated>
            <content:encoded><![CDATA[<h4>PostgreSQL en WSL brinda compatibilidad, potencia, soporte, libertad y seguridad en la gestión de bases de datos.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*S79rite8DSI-rHrSJ4lUGA.jpeg" /><figcaption>Postgres + WSL2 (Roberto Silva)</figcaption></figure><p>Para instalar <strong>PostgreSQL </strong>en <strong>Windows WSL2</strong>, sigue los siguientes pasos:</p><ol><li>Habilita WSL en su sistema Windows: para ello, debes habilitar la función de Windows Subsystem para Linux en la Configuración de Windows o mediante el panel de control.</li><li>Instala una distribución de Linux en WSL: puede elegir entre muchas distribuciones, como Ubuntu (<em>mi preferido</em>), Debian o CentOS.</li><li>Abre el <strong>terminal de WSL </strong>y actualiza los paquetes:</li></ol><pre>sudo apt-get update<br>sudo apt-get upgrade</pre><p>4. Instalamos <strong>PostgreSQL</strong> en <strong>WSL</strong>:</p><pre>sudo apt-get install postgresql postgresql-contrib</pre><p>5. <strong>Inicia el servicio</strong> de PostgreSQL:</p><pre>sudo service postgresql start</pre><p>🧯En caso obtengas el error “<em>could not bind IPv4 address ‘127.0.0.1’: Address already in use</em>” significa que el puerto 5432 (que es el puerto predeterminado de PostgreSQL) ya está en uso y no puede ser utilizado por PostgreSQL. Para solucionar este problema deberás cambiar dicho puerto siguiendo estos pasos:</p><ol><li>Abre el archivo de <strong>configuración </strong>de PostgreSQL:</li></ol><pre>sudo nano /etc/postgresql/&lt;version&gt;/main/postgresql.conf<br><br># En mi caso es la versión 12 entonces...<br>sudo nano /etc/postgresql/12/main/postgresql.conf</pre><p>2. Busca la línea que dice port=5432 y cambia el número y guarda los cambios</p><p>3. Ahora ya deberías poder iniciar el servicio de Postgres con el comando</p><pre>sudo service postgresql start<br><br># Resultado:<br># * Starting PostgreSQL 12 database server             [OK]</pre><p>6. Verifica que PostgreSQL se ha instalado correctamente:</p><pre>psql -V<br><br># Resultado<br># psql (PostgreSQL) 12.10 (Ubuntu 12.10-0ubuntu0.20.04.1)</pre><p>7. Conexión a la consola de SQL:</p><pre>sudo -u postgres psql<br><br># Resultado<br># postgres=#</pre><p>8. Verificamos la versión instalada:</p><pre>- postgres=# SHOW server_version;<br><br># Resultado<br># 12.10 (Ubuntu 12.10-0ubuntu0.20.04.1)</pre><p>9. Ahora listaremos las base de datos instaladas por defecto:</p><pre>- postgres=# \list;<br><br># Resultado<br>                              List of databases<br>   Name    |  Owner   | Encoding | Collate |  Ctype  |   Access privileges   <br>-----------+----------+----------+---------+---------+-----------------------<br> postgres  | postgres | UTF8     | C.UTF-8 | C.UTF-8 | <br> template0 | postgres | UTF8     | C.UTF-8 | C.UTF-8 | =c/postgres          +<br>           |          |          |         |         | postgres=CTc/postgres<br> template1 | postgres | UTF8     | C.UTF-8 | C.UTF-8 | =c/postgres          +<br>           |          |          |         |         | postgres=CTc/postgres</pre><p>10. Actualizamos la contraseña del usuario master “<strong>postgres</strong>”:</p><pre>ALTER USER &lt;nombre_de_usuario&gt; WITH PASSWORD &#39;&lt;nueva_contraseña&gt;&#39;;<br>// ALTER USER postgres WITH PASSWORD &#39;postgres&#39;;</pre><p>🎉🎉Ahora ya puede acceder a <strong>PostgreSQL </strong>en <strong>WSL </strong>y empezar a trabajar con él.</p><p>Gracias por leer el artículo y no olvides darme algunos aplausos😁</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=96810563f177" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Best Practices using JSX.Element and React.FC]]></title>
            <link>https://medium.com/@RobertoSilvaZ/best-practices-using-jsx-element-and-react-fc-dd5e0c57cff1?source=rss-45b306ad3651------2</link>
            <guid isPermaLink="false">https://medium.com/p/dd5e0c57cff1</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Roberto Silva Zuñiga]]></dc:creator>
            <pubDate>Tue, 17 Jan 2023 22:33:54 GMT</pubDate>
            <atom:updated>2023-01-17T22:35:06.464Z</atom:updated>
            <content:encoded><![CDATA[<h4>Guidelines that can help developers write efficient and maintainable code when working with React</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MtqZlDya7WzMrsoK" /><figcaption>Photo by <a href="https://unsplash.com/@glenncarstenspeters?utm_source=medium&amp;utm_medium=referral">Glenn Carstens-Peters</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>When working with <strong>JSX.Element</strong> and<strong> React.FC </strong>in a React application, according to my experience there are several best practices that can help you write more efficient and maintainable code. Some of these include:</p><h3>Part 1 ☝️</h3><ol><li><strong>Using the correct type for your components</strong>: JSX.Element()<em> is used for stateless components</em>, while React.FC<em> is used for stateful components</em>.</li><li><strong>Using defaultProps and propTypes</strong>: Use defaultPropsand propTypesto define the types of props that a component expects and provide default values for any optional props.</li><li><strong>Using key prop</strong>: When rendering a list of components, always include a unique key prop on each element to help React identify which elements have changed.</li><li><strong>Avoid using unnecessary state</strong>: Try to minimize the use of state in your components and use useState hook to manage the state.</li><li><strong>Splitting the logic of the components</strong>: Keep your components small and focused by splitting the logic of the components into smaller reusable functions.</li><li><strong>Avoiding unnecessary re-renders</strong>: Use React.memoand useCallback hooks to prevent unnecessary re-renders in functional components.</li><li><strong>Properly handling events</strong>: Use event handlers like onClick, onChange, and onSubmitto handle user events in your components.</li><li><strong>Testing the components</strong>: Test your components using <strong>Jest </strong>and <strong>Enzyme </strong>to ensure they are working as expected.</li><li><strong>Use functional components as much as possible</strong>: Functional components are more efficient and easier to test than class components.</li><li><strong>Use the useEffect hook for side-effects</strong>: useEffect allows you to run side-effects like fetching data or setting up subscriptions in functional components.</li></ol><p><a href="https://medium.com/@RobertoSilvaZ/when-should-i-use-jsx-element-or-react-fc-29e61eb1e754">When should I use JSX.Element or React.FC?</a></p><h3>Part 2 ✌️️</h3><ol><li><strong>Use the useContext hook to consume context</strong>: useContext allows you to consume context in a functional component, without having to pass props down through multiple levels of the component tree.</li><li><strong>Use the useCallback hook to optimize component re-renders</strong>: useCallback allows you to memoize functions that are passed as props, so that they only change when the props they depend on change.</li><li><strong>Use the useMemo hook to optimize component re-renders</strong>: useMemo allows you to memoize the value of a complex calculation, so that it only re-calculates when the props it depends on change.</li><li><strong>Use the useRef hook to work with refs</strong>: useRef allows you to create a ref and attach it to a component, so that you can access the underlying DOM node.</li><li><strong>Use reducers to manage complex state</strong>: reducer is a function that takes the current state and an action as input and returns the next state of the application. It allows you to manage changes to the state in a predictable and consistent way.</li><li><strong>Use the useDebugValue hook for debugging</strong>: useDebugValue allows you to display a value in the <em>React DevTools</em>, so that you can see the current value of a hook while debugging. You only really need to add it if you have a complex hook.</li><li><strong>Use code splitting</strong>: Use dynamic imports import()to load only the code that’s needed for a specific route or component, rather than loading all the code at once. This can improve the performance and user experience of your application.</li><li><strong>Use type checking</strong>: Use type checking tools like <strong>TypeScript </strong>or <strong>PropTypes </strong>to catch errors and improve code quality.</li><li><strong>Use linting</strong>: Use a linter like <strong>ESLint </strong>to enforce coding conventions and catch errors early.</li><li><strong>Use performance tools</strong>: Use performance tools like the React DevTools and the Performance tab in the browser DevTools to identify and fix performance issues in your application.</li></ol><p><strong>Let me know your best practices…😉 and don’t forget to give me lots of claps 😁</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dd5e0c57cff1" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>