<?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: João Felipe</title>
    <description>The latest articles on DEV Community by João Felipe (@joaofelipe).</description>
    <link>https://dev.to/joaofelipe</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%2F949400%2F4f344d94-2f68-4591-972d-9af284e29667.jpeg</url>
      <title>DEV Community: João Felipe</title>
      <link>https://dev.to/joaofelipe</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/joaofelipe"/>
    <language>en</language>
    <item>
      <title>You should be this type of developer</title>
      <dc:creator>João Felipe</dc:creator>
      <pubDate>Thu, 13 Feb 2025 16:46:21 +0000</pubDate>
      <link>https://dev.to/quave/you-should-be-this-type-of-developer-n2i</link>
      <guid>https://dev.to/quave/you-should-be-this-type-of-developer-n2i</guid>
      <description>&lt;h2&gt;
  
  
  🎯 Introduction
&lt;/h2&gt;

&lt;p&gt;There are a lot of developer types, but this one is always a good fit for the most projects or companies.&lt;/p&gt;

&lt;p&gt;Have you ever worked with a developer who just ‘gets’ the product? Someone who doesn’t just code but also thinks about the user experience, business impact, and long-term product vision? That’s what a &lt;strong&gt;Product-Minded Developer&lt;/strong&gt; is all about.&lt;/p&gt;

&lt;p&gt;We have many benefits having this type of dev in our team:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Users&lt;/strong&gt;: Usually, they think about the user experience first, not just about tech.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Context&lt;/strong&gt;: Mainly because this dev has a lot of context about all the product, it's easier to create new features in different parts of the app.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Communication&lt;/strong&gt;: Normally, the product-minded developers have a good relation with non-tech people, probably because they make sure to have an understandable communication (E.g., if the API endpoint is down, they can explain it to the product owner not using technical terms).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Time&lt;/strong&gt;: They can save a lot of time for the team, because they can understand the product better.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For now, we'll explore some ways to be a product-minded developer.&lt;/p&gt;

&lt;h2&gt;
  
  
  🧠 A little obvious, but: Understand the product
&lt;/h2&gt;

&lt;p&gt;The first step to be a product-minded developer is to understand the product.&lt;/p&gt;

&lt;p&gt;You should ask questions, and you should be curious about the product. Make sure you know what problem the product is solving, and how it's being used.&lt;/p&gt;

&lt;p&gt;Try to answer questions like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What problem is the product solving?&lt;/li&gt;
&lt;li&gt;Who is the product for?&lt;/li&gt;
&lt;li&gt;How is the product being used?&lt;/li&gt;
&lt;li&gt;What are the main features?&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Tip: take a deep look at the landing page product, usually we have a really good summarized version of the product there.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  👥 Get to know the users
&lt;/h2&gt;

&lt;p&gt;You should know who the users of the product are, and what they expect from the product.&lt;/p&gt;

&lt;p&gt;Try to answer questions like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Who are the users?

&lt;ul&gt;
&lt;li&gt;Normally, are they using the product on desktop, mobile, or both?&lt;/li&gt;
&lt;li&gt;What about the age? Are they already experienced or not?&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;For example, if the product you're working on is a CRM system, probably the device more used is desktop, so we don't need to care so much about the mobile experience.&lt;/p&gt;

&lt;h2&gt;
  
  
  ❓ New features: a new opportunity to ask questions
&lt;/h2&gt;

&lt;p&gt;When you're working on a new feature, you should ask questions about the feature.&lt;/p&gt;

&lt;p&gt;Try to answer questions like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What problem is the feature solving?&lt;/li&gt;
&lt;li&gt;Why are we fixing this problem in that way and not in another?&lt;/li&gt;
&lt;li&gt;Who is the feature for?&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  💼 Consider business goals, not just tech ones
&lt;/h2&gt;

&lt;p&gt;When you're working on a feature or a bug, you should consider the business goals.&lt;/p&gt;

&lt;p&gt;Try to answer questions like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;This piece of code is solving a problem, but is it solving the right problem?&lt;/li&gt;
&lt;li&gt;Is this feature helping the business to achieve the goal?&lt;/li&gt;
&lt;li&gt;Is this bug affecting the business?&lt;/li&gt;
&lt;li&gt;How are we adding value to the user?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We, as developers, are normally focused on the code and some topics like performance, architecture, and so on. But, sometimes, we have choices to make, and we should consider the business goals.&lt;/p&gt;

&lt;h2&gt;
  
  
  🤝 Your product manager is your best friend
&lt;/h2&gt;

&lt;p&gt;Your product manager is your best friend. They can help you to understand the product better, and they can help you to understand the users better.&lt;/p&gt;

&lt;p&gt;Your tech lead will review your code, but usually they are not the best person to ask about the product.&lt;/p&gt;

&lt;p&gt;Before starting a new project, it would be nice if you schedule a meeting with the product manager to understand the product better and ask questions about the context/market/users/etc.&lt;/p&gt;

&lt;h2&gt;
  
  
  💡 Come up with suggestions
&lt;/h2&gt;

&lt;p&gt;You should come up with suggestions about the product. Think about it: you're a developer in this project/product, but you're a user in another one.&lt;/p&gt;

&lt;p&gt;Try to think as a user, and come up with suggestions about the product.&lt;/p&gt;

&lt;p&gt;For example, I was working on a feature that the visual was a form and a preview in a grid template, if the user changes the form, the preview should be updated, something like that:&lt;/p&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%2Fasskerou2rn0zb1bs49q.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%2Fasskerou2rn0zb1bs49q.png" alt="A two-column layout with a form and preview sections. The form takes more space on the left while preview sits on the right." width="800" height="520"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If the user tries to change a field below in the form, the preview is fixed at the top of the page, creating a bad user experience.&lt;/p&gt;

&lt;p&gt;I've suggested to the team to make the preview sticky, so it will follow the user when they scroll down the form.&lt;/p&gt;

&lt;p&gt;A simple improvement, but in a large-scale project, it can save a lot of time for the users and create a better vision for our product.&lt;/p&gt;

&lt;h2&gt;
  
  
  🔑 Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Product-minded developers go beyond coding—they understand the product, users, and business.&lt;/li&gt;
&lt;li&gt;Asking the right questions is crucial when developing features.&lt;/li&gt;
&lt;li&gt;Collaboration with product managers leads to better decision-making.&lt;/li&gt;
&lt;li&gt;Small UX improvements can have a big impact on the overall experience.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🎬 Conclusion
&lt;/h2&gt;

&lt;p&gt;Being a product-minded developer is more than just writing great code, it's about understanding the bigger picture. When you deeply understand the product, its users, and the business goals, you become a more valuable team member, capable of making smarter decisions and delivering better experiences.&lt;/p&gt;

&lt;p&gt;By asking the right questions, collaborating with product managers, and thinking beyond technical implementation, you can bridge the gap between development and product strategy. This mindset improves the quality of the product and makes your work more impactful and fulfilling.&lt;/p&gt;

&lt;p&gt;At the end of the day, great products aren’t just built with great code, they're built with great &lt;strong&gt;perspective&lt;/strong&gt;. So, be curious, stay engaged, and always think beyond the code! 🚀&lt;/p&gt;

&lt;p&gt;How do you apply a product-minded approach in your work? Let’s discuss in the comments!&lt;/p&gt;

&lt;h2&gt;
  
  
  📝 Resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://blog.pragmaticengineer.com/the-product-minded-engineer/" rel="noopener noreferrer"&gt;The Product-Minded Software Engineer&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>career</category>
      <category>softwareengineering</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Impostor Syndrome Doesn’t Define You, Dev</title>
      <dc:creator>João Felipe</dc:creator>
      <pubDate>Fri, 25 Oct 2024 13:44:33 +0000</pubDate>
      <link>https://dev.to/quave/impostor-syndrome-doesnt-define-you-dev-27c5</link>
      <guid>https://dev.to/quave/impostor-syndrome-doesnt-define-you-dev-27c5</guid>
      <description>&lt;p&gt;If you're a developer, you've probably experienced moments when you lack confidence in making decisions or feel like you don't deserve to be where you are.&lt;/p&gt;

&lt;p&gt;This feeling has a name: &lt;strong&gt;Impostor Syndrome.&lt;/strong&gt; In this post, we'll explore some ways to deal with it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Have a mentor
&lt;/h2&gt;

&lt;p&gt;First of all, it would be really cool if you had a mentor, someone with more experience than you, probably some senior developer or tech lead from your company.&lt;/p&gt;

&lt;p&gt;A mentor can guide you with the &lt;strong&gt;best practices&lt;/strong&gt;, technically and non-technically (like communication or leadership).&lt;/p&gt;

&lt;p&gt;With their experience, they can help you &lt;strong&gt;identify where you're doing well, where you're struggling, and where to focus your efforts.&lt;/strong&gt; And this is awesome for you, if you know it, it's much easier to take the right steps to grow your skills and become a better developer.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understand what they expect from you
&lt;/h2&gt;

&lt;p&gt;You have a mentor, right? Now, you need to understand what is expected from you. To do this, my best advice is a little bit obvious but efficient: &lt;strong&gt;ask it.&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"What do you expect from me?"&lt;/li&gt;
&lt;li&gt;"In 6 months, what do I need to achieve for you to be sure that hiring me was worth it?"&lt;/li&gt;
&lt;li&gt;"What are the characteristics you expect me to demonstrate in my daily work?"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can schedule a call with your mentor/leader and ask some questions like that. You'll demonstrate interest, and you'll have the details of expectations.&lt;/p&gt;

&lt;h2&gt;
  
  
  Come up with a plan
&lt;/h2&gt;

&lt;p&gt;You already know what they want from you, it's time to &lt;strong&gt;create a plan&lt;/strong&gt; to achieve it.&lt;/p&gt;

&lt;p&gt;There are a lot of ways to create this plan, you can select some books to read or even define some goals for your week.&lt;/p&gt;

&lt;p&gt;But my main advice is: &lt;strong&gt;be practical.&lt;/strong&gt; Create some tasks based on what they literally expected from you.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A communicative developer? Create reports every month to your leader with your best tasks.&lt;/li&gt;
&lt;li&gt;A programmer addicted to learning/curious? Write some posts about your learning and share them with your coworkers.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In a nutshell, &lt;strong&gt;create practical tasks&lt;/strong&gt; to achieve what they expect from you.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;You'll not achieve all these skills overnight, relax and enjoy the process.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Ask for feedback, A LOT
&lt;/h2&gt;

&lt;p&gt;How will you know if you are getting better or not? Feedback!&lt;/p&gt;

&lt;p&gt;Seriously, &lt;strong&gt;feedback will be your best friend&lt;/strong&gt; in dealing with imposter syndrome and being more confident. With it, you'll receive some compliments (it'll increase your confidence) and some negative reviews, which are ok, nobody is perfect.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"But how regularly should I ask for feedback?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In my humble opinion: &lt;strong&gt;the more, the better&lt;/strong&gt;. If you can ask it every single day, ask it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Create something new
&lt;/h2&gt;

&lt;p&gt;Sometimes, when you work on the same project/product for a long time, you'll feel that you are not learning or improving.&lt;/p&gt;

&lt;p&gt;You'll say to yourself: "I'm doing the same thing every single day, it is not making me better.".&lt;/p&gt;

&lt;p&gt;To keep learning and FEEL that you are learning, my advice is to &lt;strong&gt;create some personal projects.&lt;/strong&gt; You can test that tool that you thought was nice, but your company does not use it.&lt;/p&gt;

&lt;p&gt;Share this knowledge with the community, You can create a post on LinkedIn about your project and describe what you learned.&lt;/p&gt;

&lt;h2&gt;
  
  
  Be careful with AI
&lt;/h2&gt;

&lt;p&gt;The AI is here to help our lives, Cursor is a good example. But be careful about it, tools like these &lt;strong&gt;can affect your confidence.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Have you ever felt indestructible when you finished a very hard task? Or when you finally discovered the solution to that problem, for example. Actions like these increase our confidence because they show that we can solve problems and create nice things.&lt;/p&gt;

&lt;p&gt;You MUST practice your code skills, whether formatting some complex data, creating a more reusable component for FE, or learning what you should do to reduce the API response time. You must know how to solve these problems, not just how to create the best prompt to get the solution.&lt;/p&gt;

&lt;p&gt;Summing up, use AI for productivity and automation, but &lt;strong&gt;not as a crutch.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;To cut a long story short, &lt;strong&gt;this article described 6 topics&lt;/strong&gt; that can help you to feel more confidence and improve your skills.&lt;/p&gt;

&lt;p&gt;Moreover, the text makes it clear that &lt;strong&gt;you are not alone&lt;/strong&gt;, you are not the first, and you'll not be the last who feels like a fraud.&lt;/p&gt;

&lt;p&gt;Finally, feel free to &lt;strong&gt;share more ways&lt;/strong&gt; to deal with this feeling. &lt;/p&gt;

</description>
      <category>career</category>
      <category>programming</category>
      <category>discuss</category>
      <category>community</category>
    </item>
    <item>
      <title>Lefthook: benefits vs husky and how to use</title>
      <dc:creator>João Felipe</dc:creator>
      <pubDate>Tue, 24 Sep 2024 20:58:28 +0000</pubDate>
      <link>https://dev.to/quave/lefthook-benefits-vs-husky-and-how-to-use-30je</link>
      <guid>https://dev.to/quave/lefthook-benefits-vs-husky-and-how-to-use-30je</guid>
      <description>&lt;p&gt;In the world of Git hooks, two popular tools often come up: Lefthook and Husky. Both are designed to manage Git hooks efficiently, but they have different features and use cases. This article will compare the benefits of Lefthook over Husky and provide a step-by-step guide on how to use Lefthook in your projects.&lt;/p&gt;

&lt;h2&gt;
  
  
  Benefits of Lefthook vs Husky
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Performance&lt;br&gt;
Lefthook is known for its performance. It is written in Go, which makes it faster and more efficient compared to Husky, which is written in JavaScript. This can be particularly beneficial for large projects with many hooks.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Parallel Execution&lt;br&gt;
Lefthook supports parallel execution of hooks out of the box. This means that multiple hooks can run simultaneously, reducing the overall time taken for pre-commit or pre-push operations. Husky, on the other hand, executes hooks sequentially.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Configuration&lt;br&gt;
Lefthook uses a YAML configuration file, which is straightforward and easy to read. Husky uses a JSON configuration, which can be less intuitive for some users.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Language Agnostic&lt;br&gt;
While Husky is tightly integrated with Node.js and npm, Lefthook is language-agnostic. This makes Lefthook a better choice for projects that are not primarily JavaScript-based.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Flexibility&lt;br&gt;
Lefthook provides more flexibility in terms of hook management. It allows you to define hooks for different environments and conditions, making it a versatile tool for various workflows.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  How to Use Lefthook
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Step 1: Install Lefthook
&lt;/h3&gt;

&lt;p&gt;First, you need to install Lefthook, one of the most used ways is with NPM:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm i -D lefthook
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can check the other methods &lt;a href="https://github.com/evilmartians/lefthook/blob/master/docs/install.md" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Install Dependencies
&lt;/h3&gt;

&lt;p&gt;Before setting up our scripts, we need to install the necessary dependencies. Typically, we use ESLint and Prettier for code linting and formatting. Install these dependencies by running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm i -D eslint prettier
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 3: Add lint and format scripts to package.json
&lt;/h3&gt;

&lt;p&gt;Typically, in our projects at Quave, we include three scripts in our package.json file: one for ESLint, one for Prettier, and a combined script that runs both. This combined script is usually what we use as our pre-commit hook. Here's how you can set up these scripts:&lt;/p&gt;

&lt;p&gt;Add the following to your package.json file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"scripts"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"lint"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"eslint . --fix"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"format"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"prettier --write &lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;**/*.js&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"check-code"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"npm run lint &amp;amp;&amp;amp; npm run format"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These scripts allow you to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Run ESLint with auto-fix (&lt;code&gt;lint&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Run Prettier to format your code (&lt;code&gt;format&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Run both lint and format in sequence (&lt;code&gt;check-code&lt;/code&gt;)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The &lt;code&gt;check-code&lt;/code&gt; script is what we typically use in our pre-commit hook to ensure both linting and formatting are performed before each commit.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 4: Configure Lefthook
&lt;/h3&gt;

&lt;p&gt;Create a &lt;code&gt;lefthook.yml&lt;/code&gt; file in the root of your project. This file will define the hooks you want to use. Here is an example configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;pre-commit&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;commands&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;check-code&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;npm run check-code&lt;/span&gt;
    &lt;span class="na"&gt;update-index&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;git update-index --again&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is a base example that we use here at Quave. We added the &lt;code&gt;check-code&lt;/code&gt; to run our eslint and prettier.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The &lt;code&gt;update-index&lt;/code&gt; command is crucial here. When we run ESLint with the &lt;code&gt;--fix&lt;/code&gt; option and Prettier, they modify our files to fix linting issues and format the code. These modifications would normally be left unstaged, meaning they wouldn't be included in the current commit. By running &lt;code&gt;git update-index --again&lt;/code&gt;, we ensure that these automatic fixes are included in the current commit. This prevents a situation where you'd have pending changes to commit immediately after making a commit.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Step 5: Initialize Lefthook
&lt;/h3&gt;

&lt;p&gt;Navigate to your project directory and initialize Lefthook:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;lefthook install
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command will create a .lefthook directory in your project.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 6: Use &lt;a href="https://www.npmjs.com/package/@quave/eslint-config-quave" rel="noopener noreferrer"&gt;Quave ESLint config&lt;/a&gt; (Optional, but recommended)
&lt;/h3&gt;

&lt;p&gt;Install the npm dependency&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm i -D @quave/eslint-config-quave
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add to the root of your &lt;code&gt;package.json&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nl"&gt;"eslintConfig"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"extends"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;"@quave/quave"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create in the root of your project &lt;code&gt;prettier.config.js&lt;/code&gt; file and paste this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@quave/eslint-config-quave/prettier.config&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Also, you can create a file called &lt;code&gt;.prettierignore&lt;/code&gt;, this file is used to tell Prettier to ignore certain files or directories from being formatted.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Step 7: Run Lefthook
&lt;/h3&gt;

&lt;p&gt;Now, when you commit or push changes, Lefthook will automatically run the defined hooks. You can also manually run Lefthook to test your configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;lefthook run pre-commit
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Lefthook offers several advantages over Husky, including better performance, parallel execution, and greater flexibility.&lt;/p&gt;

&lt;p&gt;By following the steps outlined above, you can easily set up and configure Lefthook in your project, ensuring that your Git hooks run efficiently and effectively.&lt;/p&gt;

&lt;p&gt;Whether you are working on a small project or a large codebase, Lefthook can help streamline your development workflow.&lt;/p&gt;

</description>
      <category>lefthook</category>
      <category>git</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Boosting UX: How I Transformed Data Management in Our App with this lib</title>
      <dc:creator>João Felipe</dc:creator>
      <pubDate>Thu, 09 May 2024 17:57:49 +0000</pubDate>
      <link>https://dev.to/joaofelipe/boosting-ux-how-i-transformed-data-management-in-our-app-with-this-lib-1dkk</link>
      <guid>https://dev.to/joaofelipe/boosting-ux-how-i-transformed-data-management-in-our-app-with-this-lib-1dkk</guid>
      <description>&lt;p&gt;In this article, I'll talk about the time I improved the UX in software I'm currently developing at work just using this lib: &lt;a href="https://tanstack.com/query/latest" rel="noopener noreferrer"&gt;React Query (or TanStack Query)&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  🚨 The Problem
&lt;/h2&gt;

&lt;p&gt;In this software, we have a lot of lists and tables, being able to access the details of this data. Something like that:&lt;/p&gt;

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

&lt;p&gt;But every time the user click on table row, goes to detail page and return to the table page, all data starts reloading...&lt;/p&gt;

&lt;p&gt;We was using the useEffect pattern: create the request function, trigger inside an useEffect and put the data in a state. We used to create some Context too, trying to create a kind of entity hook, like useUser or useNotification.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd1lgc94ub4712osla9w9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd1lgc94ub4712osla9w9.png" alt="A loading table with an user list" width="746" height="383"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But calm down, we already fetched this data, &lt;strong&gt;how can we improve the UX?&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  💡 The Game-Changing Solution
&lt;/h2&gt;

&lt;p&gt;When I asked myself this question it coincided with the time I was studying more ways to scale frontend applications in different aspects, such as request management.&lt;/p&gt;

&lt;p&gt;And it was the perfect match ✨: why not start to use React Query to scale the app and, at same time, improve the UX navigation?&lt;/p&gt;

&lt;h3&gt;
  
  
  🔎 How
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Service Separation&lt;/strong&gt;: Before we only had the request functions inside a Context and trigger these functions inside an useEffect. But We decided to migrate API requests to a dedicated services folder, neatly organizing functionality by entity.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;getUser&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;api&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/user&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;userService&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;getUser&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;userService&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Query creation&lt;/strong&gt;: We created a queries folder and put all the queries, separated by entity.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useQuery&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react-query&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kr"&gt;interface&lt;/span&gt; &lt;span class="nx"&gt;UseUserParams&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;string&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;useUser&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;userId&lt;/span&gt; &lt;span class="p"&gt;}:&lt;/span&gt; &lt;span class="nx"&gt;UseUserParams&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;useQuery&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;queryKey&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/user&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;userId&lt;/span&gt; &lt;span class="p"&gt;}],&lt;/span&gt;
    &lt;span class="na"&gt;queryFn&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;userService&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getUser&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;enabled&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Boolean&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Empowering Components&lt;/strong&gt;: With this, we can now use queries through components.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useUser&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;../../api/queries/user&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Profile&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;userId&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;localStorage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;userId&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;isLoading&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;isUserLoading&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useUser&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="nx"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;

  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;isUserLoading&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;span&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Loading&lt;/span&gt;&lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/span&amp;gt;&lt;/span&gt;&lt;span class="err"&gt;;
&lt;/span&gt;  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;span&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="na"&gt;Name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/span&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;span&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;E&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="na"&gt;mail&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;email&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/span&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;Profile&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  ⚠️ Not Every App, Every Time
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;While React Query revolutionized our UX, remember: not every application requires such finesse. Prioritize value addition, especially in MVP scenarios.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  ✅ Conclusion
&lt;/h2&gt;

&lt;p&gt;With all these changes, We had some benefits:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Code level&lt;/strong&gt;: Now we have a code that is more organized, reusable and not full of states, like isLoading or isError.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;UX level&lt;/strong&gt;: the user no longer needs to wait for new data, we show the "old" data while revalidating in the background.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;As FrontEnd Engineers, our main stakeholder is the user, so if we can, we should improve the UX with code.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>react</category>
      <category>typescript</category>
      <category>frontend</category>
    </item>
    <item>
      <title>Do this and stop wasting time creating React components</title>
      <dc:creator>João Felipe</dc:creator>
      <pubDate>Sat, 07 Oct 2023 18:36:23 +0000</pubDate>
      <link>https://dev.to/joaofelipe/do-this-and-stop-wasting-time-creating-react-components-38lj</link>
      <guid>https://dev.to/joaofelipe/do-this-and-stop-wasting-time-creating-react-components-38lj</guid>
      <description>&lt;p&gt;In this article, I will talk about &lt;a href="https://plopjs.com/" rel="noopener noreferrer"&gt;Plop&lt;/a&gt;, which is a &lt;strong&gt;little tool that saves you time and helps your team build new files with consistency&lt;/strong&gt;, as the documentation suggests.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Common Challenge
&lt;/h2&gt;

&lt;p&gt;Let's suppose that for the architecture I'm using, I'm going to create a component called Button. In this architecture, I will create a folder called Button/ and the following files:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Button.tsx&lt;/li&gt;
&lt;li&gt;index.tsx&lt;/li&gt;
&lt;li&gt;styles.ts&lt;/li&gt;
&lt;li&gt;Button.test.tsx&lt;/li&gt;
&lt;li&gt;stories.tsx&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And fill in a minimal amount of code in each of them to get started.&lt;/p&gt;

&lt;p&gt;Doing all this takes a lot of time, right? 😭 Until now... Imagine doing this with one command.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Ingenious Solution
&lt;/h2&gt;

&lt;p&gt;With Plop, you'll automate all the entire file creation flow, you just need to create some configuration. Let's do this.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;For this example, we'll focus on creating a React component, covering component and style files. However, you can adapt this workflow to other file patterns or extend it by including tests and stories for React components.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Installing Plop
&lt;/h3&gt;

&lt;p&gt;Begin by installing Plop as a development dependency:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm install --save-dev plop&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Create a Plop Configuration
&lt;/h3&gt;

&lt;p&gt;I recommend creating a folder called generators in the root directory and placing the plopfile.js inside it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;generators/
   plopfile.js
public/
src/
   components/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3. Initiating the Automation
&lt;/h3&gt;

&lt;p&gt;With the plopfile created, we can start to create our generators:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;plop&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;plop&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setGenerator&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;component&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Create a component&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;prompts&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[],&lt;/span&gt;
        &lt;span class="na"&gt;actions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt; 
    &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this configuration, you specify the generator name (in this case, 'component') and its associated configuration. The prompts will be the questions asked when you run the generator, and actions will define the steps to create the files.&lt;/p&gt;

&lt;p&gt;Since we want to create a component, we need to get the component name, with this prompt:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;plop&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;plop&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setGenerator&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;component&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Create a component&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;prompts&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
      &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;input&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;name&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;What is your component name?&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="na"&gt;actions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So you set the prompt type (input to collect data), the name (like a variable name to use in the future), and the message (the question). &lt;/p&gt;

&lt;h3&gt;
  
  
  4. Create the Templates
&lt;/h3&gt;

&lt;p&gt;Templates serve as the initial code structure for your files. &lt;/p&gt;

&lt;p&gt;For this, create a templates folder within the generators directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;generators/
   templates/
      Component.tsx.hbs
      styles.ts.hbs
   plopfile.js
public/
src/
   components/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, I will create two files: &lt;code&gt;Component.tsx.hbs&lt;/code&gt; and &lt;code&gt;styles.ts.hbs&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Component.tsx.hbs&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import * as S from './styles'

const {{pascalCase name}} = () =&amp;gt; (
  &amp;lt;S.Wrapper&amp;gt;
    &amp;lt;h1&amp;gt;{{pascalCase name}}&amp;lt;/h1&amp;gt;
  &amp;lt;/S.Wrapper&amp;gt;
)

export default {{pascalCase name}}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can notice that we use the &lt;code&gt;{{}}&lt;/code&gt; syntax to define what will be dynamic in the file. Here, the component name (collected through the prompt) is used for variable names, component titles, and exports.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;styles.ts.hbs&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import styled from 'styled-components'

export const Wrapper = styled.main``
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  5. Completing the Automation
&lt;/h3&gt;

&lt;p&gt;Now, we just need to create the actions, right? So let's do this!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;plop&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;plop&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setGenerator&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;component&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Create a component&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;prompts&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
      &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;input&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;name&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;What is your component name?&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="na"&gt;actions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
      &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;add&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;../src/components/{{pascalCase name}}/index.tsx&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;templateFile&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;templates/Component.tsx.hbs&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
      &lt;span class="p"&gt;},&lt;/span&gt;
      &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;add&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;../src/components/{{pascalCase name}}/styles.ts&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;templateFile&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;templates/styles.ts.hbs&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And, finally, we create the actions: it's defined by type (add a file in this case), the path to the new file, and the template we created.&lt;/p&gt;

&lt;h3&gt;
  
  
  6.  Create a Convenient Script (Optional, but Recommended)
&lt;/h3&gt;

&lt;p&gt;Within your package.json file, you can create a script to generate a new component:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"scripts"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"generate"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"npx plop --plopfile generators/plopfile.js"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, whenever you need to create a new component, simply run:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm run generate&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Using This Mindblowing Tool
&lt;/h2&gt;

&lt;p&gt;Running &lt;code&gt;npm run generate&lt;/code&gt; in the terminal, I get this result:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvsv6v7gie5u6tsulgke1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvsv6v7gie5u6tsulgke1.png" alt="terminal running npm run generate" width="642" height="178"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In VSCode:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3wcd1iilrj6y3izsjegb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3wcd1iilrj6y3izsjegb.png" alt="files created with plop" width="800" height="290"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;So why not give Plop a try? Start automating your file creation process today and experience the benefits of a more efficient and consistent development workflow.&lt;/p&gt;

</description>
      <category>frontend</category>
      <category>react</category>
      <category>typescript</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
