<?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: Dalcio</title>
    <description>The latest articles on DEV Community by Dalcio (@dalcio).</description>
    <link>https://dev.to/dalcio</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%2F371343%2Fa1777aba-0d69-4eb2-a482-1ecf6b5fbabd.png</url>
      <title>DEV Community: Dalcio</title>
      <link>https://dev.to/dalcio</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dalcio"/>
    <language>en</language>
    <item>
      <title>React Performance: use(State | Reducer | Ref) theoretical summary</title>
      <dc:creator>Dalcio</dc:creator>
      <pubDate>Sun, 26 Mar 2023 15:41:33 +0000</pubDate>
      <link>https://dev.to/dalcio/react-performance-usestate-reducer-ref-theoretical-summary-1bok</link>
      <guid>https://dev.to/dalcio/react-performance-usestate-reducer-ref-theoretical-summary-1bok</guid>
      <description>&lt;p&gt;When we speak about development using react in the years of 2023 its dificulte not to mention in one of his game-changer, the &lt;strong&gt;React Hooks&lt;/strong&gt;, the guilt of the easy way to manage state and lifecycle methods in functional components. However, with &lt;em&gt;great power comes great responsibility&lt;/em&gt;, having this in mind, it's important to understand the &lt;strong&gt;performance implications of using hooks&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Here, we'll discute the performance implications of some of the most commonly used hooks in React: &lt;strong&gt;useState&lt;/strong&gt;, &lt;strong&gt;useReducer&lt;/strong&gt;, and &lt;strong&gt;useRef&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;By understanding the performance characteristics of these hooks, you can optimize your code and ensure that your application runs as efficiently as possible.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;React lifecycle&lt;/li&gt;
&lt;li&gt;React Hooks and performance: in a flash&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;useState&lt;/strong&gt; performance implications&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;useReducer&lt;/strong&gt; performance implications&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;useRef&lt;/strong&gt; performance implications&lt;/li&gt;
&lt;li&gt;Conclusion&lt;/li&gt;
&lt;li&gt;Reference&lt;/li&gt;
&lt;li&gt;About the Author&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  React lifecycle
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;React lifecycle&lt;/strong&gt; refers to the set of stages or steps that a React component goes through during its existence, from creation to destruction (from birth to death). And understanding the React lifecycle is essential for writing efficient and effective React applications, and a misunderstanding can lead to performance problems.&lt;/p&gt;

&lt;p&gt;The React component lifecycle can be divided into three main phases: &lt;strong&gt;mounting&lt;/strong&gt;, &lt;strong&gt;updating&lt;/strong&gt;, and &lt;strong&gt;unmounting&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Mounting&lt;/strong&gt;: The mounting phase occurs when a functional component is first rendered. During this phase, the component function is called, and its JSX is returned. The component is then added to the DOM.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;  &lt;span class="nx"&gt;useEffect&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="c1"&gt;// This peace of code refers to mounting stage&lt;/span&gt;
    &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;title&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;The Component was mounted&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="c1"&gt;// the mounting phase is characterized ny en empty array of dependencies&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Updating&lt;/strong&gt;: The updating phase occurs when a functional component's props or state are updated. During this phase, the component function is called again with the new props or state, and its JSX is returned. The updated JSX is then used to update the DOM.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setState&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

  &lt;span class="nx"&gt;useEffect&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="c1"&gt;// This peace of code refers to update stage&lt;/span&gt;
    &lt;span class="nx"&gt;doSomethingWithState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;state&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="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt; &lt;span class="c1"&gt;// This array of dependencies is fundamental to represent the update phase&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Unmounting&lt;/strong&gt;: The unmounting phase occurs when a component is removed from the DOM. During this phase, the defined function is called, which allows developers to perform any necessary cleanup operations before the component is removed.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;  &lt;span class="nx"&gt;useEffect&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="c1"&gt;// This will be executed when the component mounts&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;timeoutId&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;setTimeout&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;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;executing some operation on mounting&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="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;unmountingPhase&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;
      &lt;span class="c1"&gt;// This will be executed when the component unmounts&lt;/span&gt;
      &lt;span class="nx"&gt;clearTimeout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;timeoutId&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// this will remove the timeout when the component unmounts&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;h2&gt;
  
  
  React Hooks and Performance: In a flash
&lt;/h2&gt;

&lt;p&gt;React Hooks are a set of functions that allow developers to use state and other React features in functional components. They were introduced in React 16.8 and have since become a staple of React development.&lt;/p&gt;

&lt;p&gt;Hooks can greatly improve the performance of React applications by enabling functional components to have their own state and lifecycle methods, which previously were only available in class components. This means that developers are allowed to write more concise and expressive code, as well as reuseable stateful logic across multiple components.&lt;/p&gt;

&lt;p&gt;However, it's important to understand the performance implications of using hooks. When using hooks like &lt;strong&gt;useState, useReducer, and useRef&lt;/strong&gt;, it's possible to accidentally trigger unnecessary re-renders, causing performance issues in your application. Additionally, if state objects are too large or if there are too many state updates in a component, this can also lead to performance problems.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Performance Implications of &lt;em&gt;useState&lt;/em&gt;
&lt;/h2&gt;

&lt;p&gt;The &lt;strong&gt;useState&lt;/strong&gt; hook is used to manage state in a functional component. It provides a simple way to update state and trigger re-renders when the state changes. The performance implications of useState are generally minimal, as React is optimized to handle updates to state efficiently. However, if the state object is large or the component has many useState calls, this could impact performance. In such cases, it may be better to use &lt;em&gt;useReducer&lt;/em&gt; instead.&lt;/p&gt;

&lt;p&gt;Although react is optimized to handle multiple state updates efficiently to perform a single update to the component's state. It doesn't mean that we wont have a problem, and it's important to have in mind that if the state object is large or the component has many useState calls, this could impact performance.&lt;/p&gt;

&lt;h3&gt;
  
  
  Tip💡🕯️
&lt;/h3&gt;

&lt;p&gt;To optimize performance when using useState, it's important to keep the state object as small as possible and to limit the number of useState calls in a component. If the state object is too large, consider splitting it into smaller pieces or using useReducer instead.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Performance Implications of &lt;em&gt;useReducer&lt;/em&gt;
&lt;/h2&gt;

&lt;p&gt;The &lt;strong&gt;useReducer&lt;/strong&gt; hook is like a super &lt;strong&gt;useState&lt;/strong&gt;, it means an alternative to &lt;em&gt;useState&lt;/em&gt; that provides a more powerful way to manage complex state. It allows you to define a reducer function that can handle multiple actions and state transitions. However, the performance implications of useReducer are similar to useState, but with some additional overhead due to the use of a reducer function.&lt;/p&gt;

&lt;p&gt;Like &lt;strong&gt;useState&lt;/strong&gt;, &lt;strong&gt;useReducer&lt;/strong&gt; can cause performance issues if the state object is too large or if there are too many state updates in a component. However, in some cases, useReducer can be more efficient than useState, particularly when dealing with complex state objects or when there are many state updates.&lt;/p&gt;

&lt;h3&gt;
  
  
  Tip💡🕯️
&lt;/h3&gt;

&lt;p&gt;To optimize performance when using useReducer, it's important to keep the state object as small as possible and to limit the number of state updates. Additionally, you can use memoization techniques, such as React.memo or useMemo, to avoid unnecessary re-renders.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Performance Implications of &lt;em&gt;useRef&lt;/em&gt;
&lt;/h2&gt;

&lt;p&gt;useRef is a hook that allows you to create a mutable reference that persists across renders. It can be used to store a value that doesn't trigger a re-render when it changes, or to reference a DOM element directly. The performance implications of useRef are generally minimal, as it doesn't trigger re-renders and has little overhead.&lt;/p&gt;

&lt;p&gt;However, if used improperly (e.g., creating a new useRef instance on every render), it could impact performance. Therefore, it's important to use useRef judiciously and only when necessary.&lt;/p&gt;

&lt;h3&gt;
  
  
  Tip💡🕯️
&lt;/h3&gt;

&lt;p&gt;To optimize performance when using useRef, it's important to only create a useRef instance when needed and to avoid creating unnecessary instances on every render.&lt;/p&gt;

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

&lt;p&gt;React Hooks have made it easier than ever to manage state and lifecycle methods in functional components. However, it's important to understand the performance implications of using hooks, as they can impact the overall performance of your application.&lt;/p&gt;

&lt;p&gt;By understanding the performance implications of useState, useReducer, and useRef, you can optimize your code and ensure that your application is running as efficiently as possible. Remember to keep the state object as small&lt;/p&gt;

&lt;h2&gt;
  
  
  Reference
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://react.dev/"&gt;React Official site&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://retool.com/blog/the-react-lifecycle-methods-and-hooks-explained/#:~:text=A%20React%20component%20undergoes%20three%20phases%20in%20its%20lifecycle%3A%20mounting,often%20called%20%E2%80%9Cinitial%20render.%E2%80%9D"&gt;React lifecycle&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://react.dev/reference/react"&gt;React Hooks&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://react.dev/reference/react/useState"&gt;useState&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://react.dev/reference/react/useReducer"&gt;useReducer&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://react.dev/reference/react/useRef"&gt;useRef&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  About the Author
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Name: &lt;strong&gt;Dálcio Garcia&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Role: &lt;strong&gt;Front End Developer&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Github: &lt;a href="https://github.com/dalcio"&gt;dalcio&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Linkedin: &lt;a href="https://linkedin.com/in/dalcio-garcia"&gt;Dálcio Macuete Garcia&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Portfolio: &lt;a href="https://dalciogarcia.vercel.app"&gt;dalciogarcia&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>react</category>
      <category>performance</category>
      <category>hooks</category>
      <category>reactlidecycle</category>
    </item>
    <item>
      <title>Monorepo with Next.js (2023): Managing Complex Projects Easier - A Theoretical Guide</title>
      <dc:creator>Dalcio</dc:creator>
      <pubDate>Mon, 20 Mar 2023 20:48:18 +0000</pubDate>
      <link>https://dev.to/dalcio/monorepo-with-nextjs-2023-managing-complex-projects-easier-a-theoretical-guide-5500</link>
      <guid>https://dev.to/dalcio/monorepo-with-nextjs-2023-managing-complex-projects-easier-a-theoretical-guide-5500</guid>
      <description>&lt;p&gt;One of the oldest problems that companies have gone through or are going through or will live through (from companies like Google, Uber, Facebook to startups) is related to the management of their projects, especially the most complex ones, which involve several teams working in different parts of the software whether large or small.&lt;br&gt;
And when that happens, companies tend to look for ways to manage projects and one of the most used approaches is Monorepo, which consists of storing all the project's source codes in a single repository.&lt;br&gt;
And with Next.js, this approach can be made even more efficient and easier to manage.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;What is Monorepo?&lt;/li&gt;
&lt;li&gt;Monorepo: Benefits&lt;/li&gt;
&lt;li&gt;Monorepo: Disadvantages&lt;/li&gt;
&lt;li&gt;Next.js and Monorepo&lt;/li&gt;
&lt;li&gt;Conclusion&lt;/li&gt;
&lt;li&gt;Author&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What is Monorepo?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Monorepo&lt;/strong&gt; or &lt;strong&gt;Monolithic Repository&lt;/strong&gt; is a single repository that contains multiple projects.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Monorepo&lt;/strong&gt;, is an approach used to manage software projects, which consists of storing all project source codes in a single source code repository.&lt;/p&gt;

&lt;p&gt;Instead of keeping software components in separate repositories like in &lt;a href="https://dev.tohttps://"&gt;Turborepo&lt;/a&gt;, the &lt;strong&gt;Monorepo&lt;/strong&gt; approach all components, projects, libraries and so on are kept in a single place/repository , making it easier for teams working on several projects at the same time to share code, as the codes used in various parts of different projects can be abstracted, thus facilitating their maintenance.&lt;/p&gt;

&lt;h2&gt;
  
  
  Monorepo: Benefits
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Easier code sharing between projects&lt;/strong&gt;: With all projects in a single repository, it's easy to share code and components between different projects. This can reduce development time, avoid code duplication, and maintain consistency across projects.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Simplifies the deployment of changes to multiple software components&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Facilitates discovering cross-project code dependencies&lt;/strong&gt;: May reduce the risk of merge conflicts&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Increased Project Visibility&lt;/strong&gt;: In a monorepo, it's easier to view all projects and components in one place, which can help management teams better understand project scope and make informed decisions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Ease of continuous integration and continuous delivery&lt;/strong&gt;: With all projects in a single repository, it's easier to manage continuous integration and continuous delivery, allowing development teams to work more efficiently and avoid issues with releases outdated.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Monorepo: Disadvantages
&lt;/h2&gt;

&lt;p&gt;Despite its benefits, managing a &lt;strong&gt;Monorepo&lt;/strong&gt; is still a challenging task, especially for large-scale projects.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Repository Size&lt;/strong&gt;: With all projects in a single repository, the repository size can get large and difficult to manage, especially in large projects. This can cause performance issues and difficulties working with the repository.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Code Conflicts&lt;/strong&gt;: With many developers working on a single repository, there can be code conflicts and issues with changes that affect multiple projects. This can be especially problematic with large teams and complex projects.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Testing&lt;/strong&gt;: Testing a monorepo can be more complicated than testing separate projects, as changes in one project can affect other projects and components. This can increase the complexity of testing and make it more difficult to guarantee code quality.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Developing in parallel&lt;/strong&gt;: In a monorepo, it can be difficult to develop projects in parallel, as changes in one project can affect other projects and components. This can make it difficult for multiple development teams working simultaneously.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Next.js and Monorepo
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Next.js&lt;/strong&gt; is a react framework used for web development allowing to create server side we applications (Server Side Render) with ease.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Next.js&lt;/strong&gt;, in addition to being the most used framework for web development, also has built-in resources that facilitate the implementation or integration of &lt;strong&gt;Monorepo&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Configuring Monorepo with NextJs
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://turbo.build/repo/docs/getting-started/create-new"&gt;Walkthrough&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With Next.js, it's easy to set up a Monorepo project. Next.js provides a set of dependency management features such as Yarn Workspaces that allow you to manage multiple package dependencies within a single project.&lt;/p&gt;

&lt;p&gt;Additionally, Next.js supports a shared component architecture, where you can create shared React components throughout your project. This can be especially useful in a Monorepo project, where components need to be shared across multiple apps.&lt;/p&gt;

&lt;p&gt;For example, suppose you are building an online store that consists of a main app and several secondary apps, such as an inventory management app and an order management app. In a Monorepo project with Next.js, you can have a shared directory called "components", where you can store React components that are shared across all apps. This can include components such as headers, footers, and sidebars that need to display across multiple apps.&lt;/p&gt;

&lt;p&gt;Another advantage of using Next.js in a Monorepo project is that it allows you to use different environments for different parts of your project, allowing for greater flexibility in managing your code. For example, you can have a separate development environment for each app and shared library, allowing teams to work on different parts of the project without interfering with each other's work.&lt;/p&gt;

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

&lt;p&gt;Monorepo is an increasingly popular approach to managing complex software projects. And with Next.js, this approach can be made even more efficient and easier to manage. With built-in features for dependency management and component sharing, Next.js is an excellent choice for Monorepo projects.&lt;/p&gt;

&lt;p&gt;However, it is important to remember that managing a Monorepo project can still be challenging, especially for large-scale projects. Make sure you have a clear strategy for managing dependencies, testing, deployment and continuous integration and continuous delivery, and use the right tools to help streamline the process.&lt;/p&gt;

&lt;p&gt;If you're considering using Monorepo in your next Next.js project, it's worth a try and evaluate the benefits and challenges this approach can bring to your software project.&lt;/p&gt;

&lt;h2&gt;
  
  
  To have in count
&lt;/h2&gt;

&lt;p&gt;While &lt;strong&gt;monorepo&lt;/strong&gt; is an efficient approach to managing software projects with multiple projects or components, it does not eliminate the fact that there are challenges to be considered. When deciding to use monorepo, it's important to weigh the advantages and disadvantages and assess whether this approach is right for your specific software project.&lt;/p&gt;

&lt;p&gt;Before deciding to use Monorepo the following question must be asked: &lt;em&gt;What is the problem I am trying to solve?&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Author
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Name: &lt;strong&gt;Dálcio Garcia&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Role: &lt;strong&gt;Front End Developer&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Github: &lt;a href="https://github.com/dalcio"&gt;dalcio&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Linkedin: &lt;a href="https://linkedin.com/in/dalcio-garcia"&gt;Dálcio Macuete Garcia&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Portfolio: &lt;a href="https://dalciogarcia.vercel.app"&gt;dalciogarcia&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Monorepo com Next.js (2023): Gerindo projetos complexos de forma mais simples - Um Guia teórico</title>
      <dc:creator>Dalcio</dc:creator>
      <pubDate>Thu, 16 Mar 2023 20:16:04 +0000</pubDate>
      <link>https://dev.to/dalcio/monorepo-com-nextjs-2023-gerindo-projetos-complexos-de-forma-mais-simples-um-guia-teorico-3kcp</link>
      <guid>https://dev.to/dalcio/monorepo-com-nextjs-2023-gerindo-projetos-complexos-de-forma-mais-simples-um-guia-teorico-3kcp</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PNDKxSr9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ilrds80itu2dechl7xt2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PNDKxSr9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ilrds80itu2dechl7xt2.png" alt="Monorepository illustration" width="496" height="518"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Um dos problemas mais antigos que na qual as empresas já passaram ou vivem ou viverão (desde empresas como o &lt;em&gt;Google&lt;/em&gt;, &lt;em&gt;Uber&lt;/em&gt;, &lt;em&gt;Facebook&lt;/em&gt; à startups) está relacionada com o gerenciamento de seus projetos sobre tudo dos mais complexos, que envolvem varias equipes trabalhando em diferentes partes do software sejam elas grandes ou pequenas.&lt;br&gt;
E quando isso acontece a tendência é de as empresas procurarem por formas de gerenciamento de projetos e uma das abordagens mais utilizadas é a de &lt;strong&gt;Monorepo&lt;/strong&gt; que consistem em armazenar todas os códigos-fontes do projeto em um único repositório.&lt;br&gt;
E com o &lt;strong&gt;Next.js&lt;/strong&gt;, essa abordagem pode ser ainda mais eficiente e fácil de gerenciar.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sumário
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;O que é Monorepo?&lt;/li&gt;
&lt;li&gt;Monorepo: Benefícios&lt;/li&gt;
&lt;li&gt;Monorepo: Desvantagens&lt;/li&gt;
&lt;li&gt;Next.js e Monorepo&lt;/li&gt;
&lt;li&gt;Conclusão&lt;/li&gt;
&lt;li&gt;Autor&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  O que é Monorepo?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Monorepo&lt;/strong&gt; ou &lt;strong&gt;Monolithic Repository&lt;/strong&gt; é um repositório único que contém múltiplos projetos.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Monorepo&lt;/strong&gt;, é uma abordagem utilizada para gerenciar projetos de software, que consiste em armazenar todos os códigos-fonte do projeto em um único repositório de código-fonte.&lt;/p&gt;

&lt;p&gt;Em vez de manter-mos os componentes do software em partes repositórios separados com em &lt;a href="https://dev.tohttps://"&gt;Turborepo&lt;/a&gt;, a abordagem &lt;strong&gt;Monorepo&lt;/strong&gt; todos os componentes, projetos, bibliotecas e outros são mantidos em um único lugar/repositório, facilitando as equipas que trabalham em vários projetos ao mesmo tempo com o compartilhanto de código pois os códigos usados em varias partes de diferentes projetos poderão ser abstraídos facilitando assim a manutenção do mesmo.&lt;/p&gt;

&lt;h2&gt;
  
  
  Monorepo: Benefícios
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Facilita o compartilhamento de código entre projetos&lt;/strong&gt;: Com todos os projetos em um único repositório, é fácil compartilhar código e componentes entre diferentes projetos. Isso pode reduzir o tempo de desenvolvimento, evitar duplicação de código e manter a consistência entre os projetos.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Simplifica a implantação de alterações em vários componentes do software&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Facilita a descoberta de dependências de código entre projetos&lt;/strong&gt;: Pode reduzir o risco de conflitos de mesclagem&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Maior visibilidade do projeto&lt;/strong&gt;: Em um monorepo, é mais fácil visualizar todos os projetos e componentes em um único lugar, o que pode ajudar as equipes de gerenciamento a entender melhor o escopo do projeto e a tomar decisões informadas.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Facilidade de integração contínua e entrega contínua&lt;/strong&gt;: Com todos os projetos em um único repositório, é mais fácil gerenciar a integração contínua e entrega contínua, permitindo que as equipes de desenvolvimento trabalhem de forma mais eficiente e evitem problemas com versões desatualizadas.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Monorepo: Desvantagens
&lt;/h2&gt;

&lt;p&gt;Apesar de seus beneficios, gerenciar um &lt;strong&gt;Monorepo&lt;/strong&gt; não deixa de ser uma tarefa desafiadora, especialmente para projetos de grande escala.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Tamanho do repositório&lt;/strong&gt;: Com todos os projetos em um único repositório, o tamanho do repositório pode ficar grande e difícil de gerenciar, especialmente em projetos grandes. Isso pode causar problemas de desempenho e dificuldades para trabalhar com o repositório.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Conflitos de código&lt;/strong&gt;: Com muitos desenvolvedores trabalhando em um único repositório, pode haver conflitos de código e problemas com mudanças que afetam vários projetos. Isso pode ser especialmente problemático em equipes grandes e projetos complexos.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Testes&lt;/strong&gt;: Testar um monorepo pode ser mais complicado do que testar projetos separados, já que as alterações em um projeto podem afetar outros projetos e componentes. Isso pode aumentar a complexidade dos testes e tornar mais difícil garantir a qualidade do código.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Desenvolvimento em paralelo&lt;/strong&gt;: Em um monorepo, pode ser difícil desenvolver projetos em paralelo, já que alterações em um projeto podem afetar outros projetos e componentes. Isso pode dificultar o trabalho de várias equipes de desenvolvimento trabalhando simultaneamente.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Next.js e Monorepo
&lt;/h2&gt;

&lt;p&gt;O &lt;strong&gt;Next.js&lt;/strong&gt; é um framework react utilizado para o desenvolvimento web em permitindo criar aplicações we do lado do servidor (Server Side Render) com facilidade.&lt;/p&gt;

&lt;p&gt;O &lt;strong&gt;Next.js&lt;/strong&gt;, além de ser o framework mais utilizado para o desenvolvimento web, possui também recuros embutidos que facilitam a implementação ou integração de &lt;strong&gt;Monorepo&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Configurando Monorepo com NextJs
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://turbo.build/repo/docs/getting-started/create-new"&gt;Passo a passo&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Com o Next.js, é fácil configurar um projeto de Monorepo. O Next.js fornece um conjunto de recursos para gerenciamento de dependências, como Yarn Workspaces, que permitem que você gerencie várias dependências de pacotes em um único projeto.&lt;/p&gt;

&lt;p&gt;Além disso, o Next.js oferece suporte a uma arquitetura de componentes compartilhados, onde você pode criar componentes React compartilhados em todo o projeto. Isso pode ser especialmente útil em um projeto de Monorepo, onde os componentes precisam ser compartilhados entre várias apps.&lt;/p&gt;

&lt;p&gt;Por exemplo, suponha que você esteja construindo uma loja on-line que consiste em um app principal e vários aplicativos secundários, como um aplicativo de gerenciamento de estoque e um aplicativo de gerenciamento de pedidos. Em um projeto de Monorepo com Next.js, você pode ter um diretório compartilhado chamado "components", onde você pode armazenar componentes React que são compartilhados em todos os apps. Isso pode incluir componentes como cabeçalhos, rodapés e barras laterais, que precisam ser exibidos em vários apps.&lt;/p&gt;

&lt;p&gt;Outra vantagem do uso do Next.js em um projeto de Monorepo é que ele permite que você use diferentes ambientes para diferentes partes do seu projeto, permitindo uma maior flexibilidade na gestão do seu código. Por exemplo, você pode ter um ambiente de desenvolvimento separado para cada app e biblioteca compartilhada, permitindo que as equipes trabalhem em diferentes partes do projeto sem interferir no trabalho dos outros.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusão
&lt;/h2&gt;

&lt;p&gt;O Monorepo é uma abordagem cada vez mais popular para gerenciamento de projetos de software complexos. E com o Next.js, essa abordagem pode ser ainda mais eficiente e fácil de gerenciar. Com os recursos embutidos para gerenciamento de dependências e compartilhamento de componentes, o Next.js é uma excelente opção para projetos de Monorepo.&lt;/p&gt;

&lt;p&gt;No entanto, é importante lembrar que a gestão de um projeto de Monorepo ainda pode ser desafiadora, especialmente para projetos de grande escala. Certifique-se de ter uma estratégia clara para gerenciamento de dependências, testes, implantação e integração contínua e entrega contínua, e use as ferramentas certas para ajudar a simplificar o processo.&lt;/p&gt;

&lt;p&gt;Se você está considerando usar o Monorepo em seu próximo projeto com Next.js, vale a pena experimentar e avaliar os benefícios e desafios que esta abordagem pode trazer para o seu projeto de software.&lt;/p&gt;

&lt;h2&gt;
  
  
  A ter em conta
&lt;/h2&gt;

&lt;p&gt;Embora, o &lt;strong&gt;monorepo&lt;/strong&gt; seja uma abordagem eficiente para gerenciar projetos de software com múltiplos projetos ou componentes, não elimina o fato de que existam desafios a serem considerados. Ao decidir usar o monorepo, é importante avaliar as vantagens e desvantagens e avaliar se essa abordagem é adequada para o seu projeto de software específico.&lt;/p&gt;

&lt;p&gt;Antes de decidir utilizar Monorepo a seguinte pergunta deve ser feita: &lt;em&gt;Qual é o problema que estou tentando resolver?&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Autor
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Name: &lt;strong&gt;Dálcio Garcia&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Role: &lt;strong&gt;Front End Developer&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Github: &lt;a href="https://github.com/dalcio"&gt;dalcio&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Linkedin: &lt;a href="https://linkedin.com/in/dalcio-garcia"&gt;Dálcio Macuete Garcia&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Portfolio: &lt;a href="https://dalciogarcia.vercel.app"&gt;dalciogarcia&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>What React drag and drop lib you can recommend?</title>
      <dc:creator>Dalcio</dc:creator>
      <pubDate>Thu, 09 Jun 2022 17:29:29 +0000</pubDate>
      <link>https://dev.to/dalcio/what-react-drag-and-drop-lib-you-can-recommend-3flf</link>
      <guid>https://dev.to/dalcio/what-react-drag-and-drop-lib-you-can-recommend-3flf</guid>
      <description></description>
    </item>
    <item>
      <title>Context API &amp; State Managers</title>
      <dc:creator>Dalcio</dc:creator>
      <pubDate>Wed, 25 May 2022 10:39:46 +0000</pubDate>
      <link>https://dev.to/dalcio/context-api-state-managers-9m0</link>
      <guid>https://dev.to/dalcio/context-api-state-managers-9m0</guid>
      <description>&lt;p&gt;For some reason libraries like &lt;strong&gt;Redux&lt;/strong&gt; are built using &lt;strong&gt;Context API&lt;/strong&gt;. And when someone in the React world gets to know tools like &lt;em&gt;Context API&lt;/em&gt;, &lt;em&gt;Redux&lt;/em&gt;, &lt;em&gt;Zustand&lt;/em&gt;, &lt;em&gt;Recoil&lt;/em&gt; and so on, a lot of times they get stuck in the very common doubt (at least I've been through it), which is &lt;strong&gt;When should I use the Context API instead of a State Manager?&lt;/strong&gt;. Well here's what I think about it.&lt;/p&gt;

&lt;p&gt;Before answering, let's go through some definitions.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's Context API?
&lt;/h2&gt;

&lt;p&gt;The Context API represents a way of sharing variables or global states with its internal components (avoiding situations like &lt;a href="https://blog.logrocket.com/solving-prop-drilling-react-apps/#:~:text=Prop%20drilling%20is%20the%20unofficial,actual%20need%20for%20this%20data."&gt;&lt;strong&gt;Prop drilling&lt;/strong&gt;&lt;/a&gt;). &lt;/p&gt;

&lt;h2&gt;
  
  
  What're State Managers?
&lt;/h2&gt;

&lt;p&gt;They are tools that help us manage the most complex states of an application. Controlling how data can be mutated.&lt;/p&gt;

&lt;p&gt;According to &lt;a href="https://blog.openreplay.com/top-6-react-state-management-libraries-for-2022"&gt;Open Replay&lt;/a&gt;, in the React ecosystem the most popular State Managers are: &lt;strong&gt;Redux* *, **Recoil&lt;/strong&gt;, &lt;strong&gt;Zustand&lt;/strong&gt;, &lt;strong&gt;Jotai&lt;/strong&gt;, &lt;strong&gt;Rematch&lt;/strong&gt; and the &lt;strong&gt;Hookstate&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  And now?
&lt;/h2&gt;

&lt;p&gt;OK, now that you know what &lt;strong&gt;Context API&lt;/strong&gt; is and what &lt;strong&gt;State Managers&lt;/strong&gt; are, let me just say that anything you can do with &lt;strong&gt;State Managers&lt;/strong&gt; you can do with &lt;strong&gt;Context API&lt;/strong&gt;, but the point is: &lt;strong&gt;Is it worth it?&lt;/strong&gt; or &lt;strong&gt;Should I spend time on this?&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;And I tell you no, it's not worth it, after all, &lt;strong&gt;why reinvent the wheel?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;What going on, is that the &lt;strong&gt;State Managers&lt;/strong&gt; already provide a well-elaborated tool to be able to manage our states as efficiently as possible and if we use the &lt;strong&gt;Context API&lt;/strong&gt; instead of libs like &lt;em&gt;Redux&lt;/em&gt;, we would have to worry about handling the states to avoid unnecessary rendering affecting the performance of our application.&lt;/p&gt;

&lt;h2&gt;
  
  
  When we should Context API?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Theming&lt;/strong&gt; — Swipe down the app theme&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;i18n&lt;/strong&gt; — Transmit translation messages&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Authentication&lt;/strong&gt; — Pass the current authenticated user&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Atomic Component Globalization&lt;/strong&gt;: When we have a component with some states that need to be used by more internal components.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CJ8BY45L--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/me4b7zp6puxgewl4i3w5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CJ8BY45L--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/me4b7zp6puxgewl4i3w5.png" alt="Image description" width="477" height="402"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=P95DuIBwnqw"&gt;Picking From 20 React State Managers&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=_gRxCvDjWjs"&gt;WATCH LATER ADD TO QUEUE NextJS + State Management = Good Idea???&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://blog.openreplay.com/top-6-react-state-management-libraries-for-2022"&gt;Top 6 React state management libraries for 2022&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Context API &amp; State Managers</title>
      <dc:creator>Dalcio</dc:creator>
      <pubDate>Wed, 25 May 2022 10:19:54 +0000</pubDate>
      <link>https://dev.to/dalcio/context-api-state-managers-2k45</link>
      <guid>https://dev.to/dalcio/context-api-state-managers-2k45</guid>
      <description>&lt;p&gt;Por alguma razão bibliotecas como &lt;strong&gt;Redux&lt;/strong&gt; são construidas usando &lt;strong&gt;Context API&lt;/strong&gt;. E quando alguém no mundo React passa a conhecer ferramentas como &lt;em&gt;Context API&lt;/em&gt;, &lt;em&gt;Redux&lt;/em&gt;, &lt;em&gt;Zustand&lt;/em&gt;, &lt;em&gt;Recoil&lt;/em&gt; e por aí, muita das vezes fica preso na duvida muito comum (pelo menos eu já passei por isso), que é &lt;strong&gt;Quando devo usar o Context API ao invés de um State Manager?&lt;/strong&gt;. Pois bem aqui vai o que penso sobre isso.&lt;/p&gt;

&lt;p&gt;Antes de responde-lo vamos a algumas definições.&lt;/p&gt;

&lt;h2&gt;
  
  
  O que é o Context API?
&lt;/h2&gt;

&lt;p&gt;O Context API representa uma forma de partilhar variaveis ou estados globais com componentes internos do mesmo (evitando situações como &lt;a href="https://blog.logrocket.com/solving-prop-drilling-react-apps/#:~:text=Prop%20drilling%20is%20the%20unofficial,actual%20need%20for%20this%20data."&gt;&lt;strong&gt;Prop drilling&lt;/strong&gt;&lt;/a&gt;). &lt;/p&gt;

&lt;h2&gt;
  
  
  O que são State Managers?
&lt;/h2&gt;

&lt;p&gt;São ferramentas que nos ajudam a gerenciar os estados mais complexos de uma aplicação. Controlando a forma que os dados podem ser modificadas, quando devem ser modificadas, porque, e por a´´i vai.&lt;/p&gt;

&lt;p&gt;De acordo com o &lt;a href="https://blog.openreplay.com/top-6-react-state-management-libraries-for-2022"&gt;Open Replay&lt;/a&gt;, no ecossistema React os State Managers mais populares são: &lt;strong&gt;Redux&lt;/strong&gt;, &lt;strong&gt;Recoil&lt;/strong&gt;, &lt;strong&gt;Zustand&lt;/strong&gt;, &lt;strong&gt;Jotai&lt;/strong&gt;, &lt;strong&gt;Rematch&lt;/strong&gt; e o &lt;strong&gt;Hookstate&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  E então?
&lt;/h2&gt;

&lt;p&gt;OK, agora que sabes o que é &lt;strong&gt;Context API&lt;/strong&gt; e o que são &lt;strong&gt;State Managers&lt;/strong&gt;, deixe-me dize-lo que tudo que consegues fazer com os &lt;strong&gt;State Managers&lt;/strong&gt; consegues faze-lo com o &lt;strong&gt;Context API&lt;/strong&gt;, mais o ponto é: &lt;strong&gt;Vale a pena?&lt;/strong&gt; ou &lt;strong&gt;Devo perder tempo com isso?&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;E eu digo-te que não, não vale a pena, afinal &lt;strong&gt;porque  reinventar a roda?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;O que acontece é que os &lt;strong&gt;State Managers&lt;/strong&gt; já fornecem consigo um ferramental bem elaborado para podermos gerenciar os nossos estados de forma mais eficiente possível e o que acontece é que se tivéssemos que usar o &lt;strong&gt;Context API&lt;/strong&gt; no lugar de libs como &lt;em&gt;Redux&lt;/em&gt;, teriamos que nos preocupar em tratar os estados de forma a evitar renderizações desnecessárias afetando a perfomace da nossa aplicação.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quando usar o Context API?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Temas&lt;/strong&gt; — Passe para baixo o tema do aplicativo&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;i18n&lt;/strong&gt; — Transmitir mensagens de tradução&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Autenticação&lt;/strong&gt; — Passar o usuário autenticado atual&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Atomic Component Globalization&lt;/strong&gt;: Quando temos um componente com alguns estados que precisam ser usados por componentes mais internos.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CJ8BY45L--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/me4b7zp6puxgewl4i3w5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CJ8BY45L--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/me4b7zp6puxgewl4i3w5.png" alt="Image description" width="477" height="402"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href="https://blog.openreplay.com/top-6-react-state-management-libraries-for-2022"&gt;Top 6 React state management libraries for 2022&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/watch?v=P95DuIBwnqw"&gt;Picking From 20 React State Managers&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/watch?v=_gRxCvDjWjs"&gt;WATCH LATER ADD TO QUEUE NextJS + State Management = Good Idea???&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>contextapi</category>
      <category>react</category>
      <category>redux</category>
    </item>
    <item>
      <title>Building A PWA With NextJS 12 and Typescript</title>
      <dc:creator>Dalcio</dc:creator>
      <pubDate>Mon, 23 May 2022 10:46:10 +0000</pubDate>
      <link>https://dev.to/dalcio/building-a-pwa-with-nextjs-and-typescript-4kf3</link>
      <guid>https://dev.to/dalcio/building-a-pwa-with-nextjs-and-typescript-4kf3</guid>
      <description>&lt;h2&gt;
  
  
  Intro 
&lt;/h2&gt;

&lt;p&gt;Hello GUYS!!&lt;/p&gt;

&lt;p&gt;Are you tired of building the same app thing twice or even more? What if I tell and so you one way that can help you save time and a lot of effort? So let me introduce to you a way that can help you saving time time sometimes. So what I'm gonna introduce to you is a way of creating &lt;a href="https://web.dev/progressive-web-apps/" rel="noopener noreferrer"&gt;&lt;strong&gt;PWA&lt;/strong&gt;&lt;/a&gt; with &lt;a href="https://nextjs.org/" rel="noopener noreferrer"&gt;&lt;strong&gt;Next JS&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Table of contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Intro&lt;/li&gt;
&lt;li&gt;What's a PWA?&lt;/li&gt;
&lt;li&gt;What we're building?&lt;/li&gt;
&lt;li&gt;Our Arsenal&lt;/li&gt;
&lt;li&gt;The Application&lt;/li&gt;
&lt;li&gt; Making The Application PWA&lt;/li&gt;
&lt;li&gt;Congratulations&lt;/li&gt;
&lt;li&gt;References&lt;/li&gt;
&lt;li&gt;The project&lt;/li&gt;
&lt;li&gt;See Demo&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What's a PWA? &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;According to &lt;a href="https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps" rel="noopener noreferrer"&gt;Developer Mozilla&lt;/a&gt;, &lt;strong&gt;PWAs&lt;/strong&gt;(Progressive Web Apps) are web apps that use service workers, manifests, and other web-platform features in combination with progressive enhancement to give users an experience on par with native apps.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;And what this means?&lt;/strong&gt; This means that you can make your web apps work like a native app (no matter what platform you will use, windows, mac OS, android, IOS,...), you will be able to write once and make you web app &lt;em&gt;installable&lt;/em&gt; making your app browser independent.&lt;/p&gt;

&lt;p&gt;Checkout for more details about PWA: &lt;a href="https://web.dev/progressive-web-apps/" rel="noopener noreferrer"&gt;&lt;em&gt;web.dev&lt;/em&gt;&lt;/a&gt;, &lt;a href="https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps" rel="noopener noreferrer"&gt;Developer Mozilla&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What we're building? &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;We'll build an &lt;strong&gt;Countdown App&lt;/strong&gt;, that notifies the user in every &lt;em&gt;two hours&lt;/em&gt;, to help us stand up and fight against the sedentary.&lt;/p&gt;

&lt;h2&gt;
  
  
  Our Arsenal &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Since the goal is to build a Next JS app, it's mandatory to know the basics of &lt;a href="https://reactjs.org/" rel="noopener noreferrer"&gt;React jS&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;To bring this idea to life we'll use the following tools: &lt;a href="https://nextjs.org/" rel="noopener noreferrer"&gt;&lt;strong&gt;Next JS&lt;/strong&gt;&lt;/a&gt;, &lt;a href="https://www.typescriptlang.org/" rel="noopener noreferrer"&gt;&lt;strong&gt;TypeScript&lt;/strong&gt;&lt;/a&gt; and &lt;a href="https://mantine.dev/" rel="noopener noreferrer"&gt;&lt;strong&gt;Mantine UI&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TypesScript&lt;/strong&gt; is a strongly typed programming language that builds on JavaScript, giving you better tooling at any scale.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Mantine UI&lt;/strong&gt; is a fully featured react component library.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Application &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;If&lt;/strong&gt; you already have your app done and you just want make it a PWA app, you can jump into &lt;strong&gt;Making The Application PWA&lt;/strong&gt; section.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Else&lt;/strong&gt; let's star by cloning &lt;/p&gt;

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

git clone https://github.com/Dalcio/sedentarism-alert

cd sedentarism-alert


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

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

yarn install &amp;amp;&amp;amp; yarn run dev 


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

&lt;/div&gt;

&lt;p&gt;or&lt;/p&gt;

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

npm install &amp;amp;&amp;amp; npm run dev 


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

&lt;/div&gt;
&lt;h3&gt;
  
  
  Sedentarism App Alert
&lt;/h3&gt;

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

&lt;p&gt;Now that we have our project settled, let's jump into and take a quick look at our project structure:&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;public/&lt;/strong&gt;* we have two files, our logo and the sound that's played when the times end.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;src/styles&lt;/strong&gt; contains a simple component at &lt;strong&gt;src/styles/global&lt;/strong&gt; that contains a couple of global styles.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;src/pages&lt;/strong&gt; responsible to contain our pages, we have only one page (the Home page).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;src/components&lt;/strong&gt; contains the body of our countdown.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;src/hooks&lt;/strong&gt; contains our custom hooks &lt;strong&gt;useCounter&lt;/strong&gt; responsible to handle the time and &lt;strong&gt;usePlaySound&lt;/strong&gt; responsible to handle the audio played when the clock is zero.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So, now that we understand our project let make our tiny app PWA.&lt;/p&gt;
&lt;h2&gt;
  
  
  Making The Application PWA &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Now that we have an app (if don't), it's time to make our app PWA.&lt;/p&gt;

&lt;p&gt;First I'll resize the icons 4x because of the the different screen that exist.&lt;/p&gt;
&lt;h3&gt;
  
  
  Steps
&lt;/h3&gt;

&lt;p&gt;To make our app pwa we need to do the following steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;install next-pwa dependency&lt;/li&gt;
&lt;li&gt;configure PWA in Next Config&lt;/li&gt;
&lt;li&gt;generate the manifest&lt;/li&gt;
&lt;li&gt;add the manifest in _document.tsx&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
  
  
  Installing Next PWA dependency 
&lt;/h4&gt;

&lt;p&gt;We have to install &lt;a href="https://www.npmjs.com/package/next-pwa" rel="noopener noreferrer"&gt;&lt;strong&gt;next-pwa&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

yarn add next-pwa


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

&lt;/div&gt;

&lt;p&gt;or&lt;/p&gt;

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

npm i next-pwa 


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

&lt;/div&gt;
&lt;h4&gt;
  
  
  Configuring Next Config &lt;a href="step-two"&gt;&lt;/a&gt;
&lt;/h4&gt;

&lt;p&gt;Now we need to configure our &lt;code&gt;next.config.js&lt;/code&gt; to look the following:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;

&lt;span class="cm"&gt;/** @type {import('next').NextConfig} */&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;withPWA&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;next-pwa&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;nextConfig&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;withPWA&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;pwa&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;dest&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;public&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;register&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;skipWaiting&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="na"&gt;reactStrictMode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&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="nx"&gt;nextConfig&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="s2"&gt;```

#### Generating the manifest &amp;lt;a href="step-three"&amp;gt;&amp;lt;/a&amp;gt;

There's many option available that can help you generate the **manifest**, I'll just use [simicart](https://www.simicart.com/manifest-generator.html/)
and fill the form.

![Manifest Generator field](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tptarks0qqyz0l85cmui.PNG)

and click on generate and upload the files generated to your public folder. After all rename the `&lt;/span&gt;&lt;span class="nx"&gt;manifest&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;webmanifest&lt;/span&gt;&lt;span class="s2"&gt;` to `&lt;/span&gt;&lt;span class="nx"&gt;manifest&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="s2"&gt;`

The generated JSON file


````json
{
    "theme_color": "#247ED6",
    "background_color": "#77eed8",
    "display": "standalone",
    "scope": "/",
    "start_url": "/",
    "name": "Sedentarism Alert",
    "short_name": "SAlert",
    "description": "It's an app that plays a sound when the time is 0 ",
    "icons": [
        {
            "src": "/icon-192x192.png",
            "sizes": "192x192",
            "type": "image/png"
        },
        {
            "src": "/icon-256x256.png",
            "sizes": "256x256",
            "type": "image/png"
        },
        {
            "src": "/icon-384x384.png",
            "sizes": "384x384",
            "type": "image/png"
        },
        {
            "src": "/icon-512x512.png",
            "sizes": "512x512",
            "type": "image/png"
        }
    ]
}
```&lt;/span&gt;



&lt;span class="err"&gt;####&lt;/span&gt; &lt;span class="nx"&gt;Add&lt;/span&gt; &lt;span class="nx"&gt;the&lt;/span&gt; &lt;span class="nx"&gt;manifest&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nx"&gt;_document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;tsx&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="nx"&gt;href&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;step-four&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/a&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;
&lt;span class="nx"&gt;Now&lt;/span&gt; &lt;span class="nx"&gt;we&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;ll configure the manifest in our `_document.tsx` file, looking like:



```tsx
import { createGetInitialProps } from &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;mantine&lt;/span&gt;&lt;span class="sr"&gt;/next'&lt;/span&gt;&lt;span class="err"&gt;;
&lt;/span&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;Document&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Head&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Html&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Main&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;NextScript&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;next/document&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;getInitialProps&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;createGetInitialProps&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="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;_Document&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Document&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="nx"&gt;getInitialProps&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;getInitialProps&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="nf"&gt;render&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="p"&gt;(&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Html&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;Head&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;title&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Sedentarism&lt;/span&gt; &lt;span class="nx"&gt;Alert&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;PWA&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/title&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;link&lt;/span&gt;
            &lt;span class="nx"&gt;rel&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;shortcut icon&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
            &lt;span class="nx"&gt;href&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;alarm-clock.png&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
            &lt;span class="nx"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;image/x-icon&lt;/span&gt;&lt;span class="dl"&gt;"&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;link&lt;/span&gt; &lt;span class="nx"&gt;rel&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;manifest&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;href&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/manifest.json&lt;/span&gt;&lt;span class="dl"&gt;"&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="sr"&gt;/Head&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;body&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;Main&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;NextScript&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="sr"&gt;/body&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;/Html&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="p"&gt;}&lt;/span&gt;

&lt;span class="s2"&gt;```



## Congratulations &amp;lt;a name="section-6"&amp;gt;&amp;lt;/a&amp;gt;

Now our app is a PWA. Congratulation. Now you can deploy it on [**Vercel?»*](https://vercel.com/guides/deploying-nextjs-with-vercel)

## References &amp;lt;a name="section-7"&amp;gt;&amp;lt;/a&amp;gt;
[Progressive web apps (PWAs)](https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps)
[Progressive Web Apps](https://web.dev/progressive-web-apps/?gclid=CjwKCAjw4ayUBhA4EiwATWyBrvb4n5SU8fTzo774tAXUQ8CgYo-bT1z2-EeUXuMtvN_yCvQOm6JE-BoC-nAQAvD_BwE)
[How to Create a PWA With Next.js in 10 Minutes](https://www.youtube.com/watch?v=ARNN_zmrwcw)
[How to make a Next.js app a PWA](https://medium.com/geekculture/how-to-make-a-next-js-app-a-pwa-a5e2b13da548)

## The Project &amp;lt;a name="the-project"&amp;gt;&amp;lt;/a&amp;gt;

### [**Project Repository**](https://github.com/Dalcio/sedentarism-alert)

## See Demo &amp;lt;a name="demo"&amp;gt;&amp;lt;/a&amp;gt;

### [Live Demo](https://sedentarism-alert.vercel.app/)
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>pwa</category>
      <category>nextjspwa</category>
      <category>nextjs</category>
      <category>pwatypescript</category>
    </item>
  </channel>
</rss>
