<?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>Forem: Letícia Vieira</title>
    <description>The latest articles on Forem by Letícia Vieira (@leticiabytes).</description>
    <link>https://forem.com/leticiabytes</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%2F492829%2Fb14afe64-7a3b-41b0-94f9-a23b2404cbf7.jpeg</url>
      <title>Forem: Letícia Vieira</title>
      <link>https://forem.com/leticiabytes</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/leticiabytes"/>
    <language>en</language>
    <item>
      <title>The Future of Frontend with AI</title>
      <dc:creator>Letícia Vieira</dc:creator>
      <pubDate>Mon, 17 Mar 2025 14:05:44 +0000</pubDate>
      <link>https://forem.com/leticiabytes/the-future-of-frontend-with-ai-47g2</link>
      <guid>https://forem.com/leticiabytes/the-future-of-frontend-with-ai-47g2</guid>
      <description>&lt;p&gt;Frontend development in 2025 is more demanding than ever. The need for high performance, scalability, and a flawless user experience is constantly growing, and artificial intelligence has fully entered the game—generating code, refining interfaces, and speeding up processes. Some companies even consider replacing developers with AI, but this perspective may be misguided. The real path forward is to use AI as an ally, enhancing our productivity and improving the quality of our deliverables.  &lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;AI Won’t Take Your Job (Relax!)&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;Advanced tools like AI-powered code assistants and interface generators may give the impression that frontend developers' days are numbered. However, reality tells a different story:  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Silent Technical Debt:&lt;/strong&gt; Automated solutions may work well in the short term but often fail in terms of scalability and maintenance.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Context is King:&lt;/strong&gt; AI can generate efficient code, but it doesn’t fully understand product nuances, user needs, or business rules.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Creativity and Intuition:&lt;/strong&gt; Frontend development is more than just coding. It requires understanding user experience, ensuring accessibility, and creating responsive designs—areas where human intuition makes all the difference.
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The right question isn’t whether AI will replace us, but rather how we can use it to become even more valuable in what we do.  &lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;AI on My Team? Yes, Please!&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;Instead of seeing AI as a threat, the best approach is to embrace it and take full advantage of what it offers:  &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;More Time for What Matters&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;AI can handle repetitive tasks, such as generating basic components or automating code reviews, freeing up developers to focus on more strategic and creative solutions.  &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Optimized Performance&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;With AI’s help, we can analyze file sizes, optimize loading times, and identify performance issues before they impact users.  &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Perfect Accessibility &amp;amp; SEO&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;AI tools can detect accessibility issues like poor contrast or confusing structures and help optimize search engine rankings.  &lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;The Secret? Master the Basics&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;No matter how advanced AI becomes, nothing replaces a developer who has mastered frontend fundamentals:  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fluency in &lt;strong&gt;HTML, CSS, and JavaScript&lt;/strong&gt;, the building blocks of the web.
&lt;/li&gt;
&lt;li&gt;Knowledge of &lt;strong&gt;scalable application architecture&lt;/strong&gt;.
&lt;/li&gt;
&lt;li&gt;Skills in &lt;strong&gt;WebAssembly and performance optimization techniques&lt;/strong&gt;.
&lt;/li&gt;
&lt;li&gt;Practical application of &lt;strong&gt;Core Web Vitals&lt;/strong&gt; and user experience principles.
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Without a strong foundation, we risk over-relying on AI and losing control over what we create.  &lt;/p&gt;

&lt;p&gt;The rise of AI is a unique opportunity for frontend developers to stand out, delivering faster and higher-quality projects. AI isn’t here to replace us—it’s here to empower us. The key is to integrate it into our workflow while maintaining the critical thinking and creativity that set us apart in the industry.  &lt;/p&gt;

&lt;p&gt;In the end, developers who combine solid technical skills with smart AI usage won’t just survive in 2025—they’ll become indispensable in any team. &lt;/p&gt;

</description>
      <category>ai</category>
      <category>frontend</category>
      <category>webdev</category>
    </item>
    <item>
      <title>O Futuro do Frontend com IA</title>
      <dc:creator>Letícia Vieira</dc:creator>
      <pubDate>Fri, 14 Mar 2025 13:30:54 +0000</pubDate>
      <link>https://forem.com/leticiabytes/o-futuro-do-frontend-com-ia-3lde</link>
      <guid>https://forem.com/leticiabytes/o-futuro-do-frontend-com-ia-3lde</guid>
      <description>&lt;p&gt;O desenvolvimento frontend em 2025 está mais exigente do que nunca. A necessidade de alto desempenho, escalabilidade e uma experiência impecável só cresce, e a inteligência artificial entrou de vez no jogo, gerando códigos, refinando interfaces e acelerando processos. Algumas empresas chegam a cogitar substituir desenvolvedores por IA, mas essa visão pode ser equivocada. O verdadeiro caminho é usar a IA como aliada, ampliando nossa produtividade e elevando a qualidade das entregas.  &lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;A IA Não Vai Roubar Seu Lugar (Relaxa!)&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Ferramentas avançadas, como geradores de interfaces e assistentes de código baseados em IA, podem dar a impressão de que o papel do desenvolvedor frontend está com os dias contados. Mas a realidade é bem diferente:  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Dívida Técnica Silenciosa:&lt;/strong&gt; Soluções automatizadas podem funcionar bem no curto prazo, mas costumam falhar em escalabilidade e manutenção.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Contexto é Rei:&lt;/strong&gt; A IA pode gerar códigos eficientes, mas ainda não entende as nuances do produto, as necessidades dos usuários ou as regras do negócio.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Criatividade e Feeling:&lt;/strong&gt; Desenvolver frontend vai muito além de programar. É preciso compreender a experiência do usuário, garantir acessibilidade e criar designs responsivos — áreas onde a intuição humana faz toda a diferença.
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A pergunta certa não é se a IA vai nos substituir, mas sim como podemos utilizá-la para nos tornarmos ainda mais valiosos no que fazemos.  &lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;IA no Meu Time, Sim Senhor!&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Em vez de encarar a IA como uma ameaça, o ideal é aproveitá-la a nosso favor e tirar o melhor proveito do que ela oferece:  &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Mais Tempo para o que Importa&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
A IA pode assumir tarefas repetitivas, como gerar componentes básicos ou automatizar revisões de código, liberando espaço para nos concentrarmos em soluções mais estratégicas e criativas.  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Desempenho Otimizado&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Com a ajuda da IA, é possível analisar o tamanho de arquivos, otimizar o carregamento e identificar problemas de performance antes que afetem os usuários.  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Acessibilidade e SEO na Medida Certa&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Ferramentas de IA podem detectar falhas de acessibilidade, como contrastes inadequados ou estruturas confusas, além de ajudar a otimizar o ranqueamento nos motores de busca.  &lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;O Segredo? Dominar o Básico&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Por mais avançada que a IA seja, nada substitui um desenvolvedor que domina os fundamentos do frontend:  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fluência em &lt;strong&gt;HTML, CSS e JavaScript&lt;/strong&gt;, a base de tudo.
&lt;/li&gt;
&lt;li&gt;Conhecimento em &lt;strong&gt;arquitetura de aplicações escaláveis&lt;/strong&gt;.
&lt;/li&gt;
&lt;li&gt;Habilidade com &lt;strong&gt;WebAssembly e técnicas de otimização de desempenho&lt;/strong&gt;.
&lt;/li&gt;
&lt;li&gt;Aplicação prática de &lt;strong&gt;Core Web Vitals e princípios de experiência do usuário&lt;/strong&gt;.
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Sem essa base sólida, corremos o risco de depender excessivamente da IA e perder o controle do que estamos criando.  &lt;/p&gt;

&lt;p&gt;A chegada da IA é uma oportunidade única para os desenvolvedores frontend se destacarem, entregando projetos mais rápidos e de qualidade superior. A IA não veio para substituir ninguém, mas para nos fortalecer. O segredo é integrá-la ao nosso fluxo de trabalho sem perder o olhar crítico e a criatividade que fazem a diferença no mercado.  &lt;/p&gt;

&lt;p&gt;No fim das contas, o desenvolvedor que alia uma base técnica sólida ao uso inteligente da IA não apenas sobrevive em 2025, mas se torna uma peça essencial em qualquer equipe.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>frontend</category>
    </item>
    <item>
      <title>What is React.cloneElement() function?</title>
      <dc:creator>Letícia Vieira</dc:creator>
      <pubDate>Mon, 16 Jan 2023 23:47:42 +0000</pubDate>
      <link>https://forem.com/leticiabytes/what-is-reactcloneelement-function-3nb5</link>
      <guid>https://forem.com/leticiabytes/what-is-reactcloneelement-function-3nb5</guid>
      <description>&lt;p&gt;When building web applications with React, one of the most important goals is to create reusable, modular components. This allows developers to easily reuse components in different parts of their application, making the development process faster and more efficient. One of the tools that developers can use to achieve this goal is the &lt;code&gt;React.cloneElement&lt;/code&gt; method.&lt;/p&gt;

&lt;p&gt;According to the official &lt;a href="https://beta.reactjs.org/reference/react/cloneElement" rel="noopener noreferrer"&gt;React documentation&lt;/a&gt;, &lt;code&gt;React.cloneElement&lt;/code&gt; is used to clone a React element and pass new props to it. This means that you can reuse a component multiple times in your application, but with different properties, styles or behaviors. For example, imagine you have a Card component that is used in multiple pages of your application, but in some situations, you want it to have a different background color or image. With &lt;code&gt;React.cloneElement&lt;/code&gt;, you can easily clone the card component and pass new props to it, without having to create a new implementation of the component.&lt;/p&gt;

&lt;p&gt;With &lt;code&gt;React.cloneElement&lt;/code&gt;, you can clone the card component and pass new props to it without having to create a new implementation of the component.&lt;/p&gt;

&lt;p&gt;Let’s walk through an example to see when it’s useful.&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="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&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&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;Card&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;props&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;cardStyle&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;backgroundColor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;white&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;10px&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;border&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;1px solid #ccc&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
  &lt;span class="p"&gt;};&lt;/span&gt;

  &lt;span class="c1"&gt;// Clone and modify the child element&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;clonedChild&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;cloneElement&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;children&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;fontWeight&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;bold&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="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="nx"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;cardStyle&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;clonedChild&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;/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="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;App&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;Card&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;h2&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Welcome&lt;/span&gt; &lt;span class="nx"&gt;to&lt;/span&gt; &lt;span class="nx"&gt;my&lt;/span&gt; &lt;span class="nx"&gt;website&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h2&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;/Card&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Card component used in example above, accepts child components and renders them inside a container using a specific style. We're using &lt;code&gt;React.cloneElement&lt;/code&gt; to clone the child element that is passed to the Card component and then adding a new style prop &lt;code&gt;fontWeight: 'bold'&lt;/code&gt; to it.&lt;/p&gt;

&lt;p&gt;In conclusion, the &lt;code&gt;React.cloneElement&lt;/code&gt; function duplicates the existing component and permits changes to some of its properties rather than creating a new component. &lt;strong&gt;As a result, it's a fantastic option if you want to modify an existing component without having to completely rewrite it.&lt;/strong&gt; This helps to keep the codebase clean, organized, and optimized for performance, which is a key goal when building web applications with React.&lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>SWR vs React-Query</title>
      <dc:creator>Letícia Vieira</dc:creator>
      <pubDate>Thu, 22 Dec 2022 14:36:10 +0000</pubDate>
      <link>https://forem.com/leticiabytes/swr-vs-react-query-5el0</link>
      <guid>https://forem.com/leticiabytes/swr-vs-react-query-5el0</guid>
      <description>&lt;p&gt;Data fetching is an essential part of any modern web application. It allows us to retrieve data from APIs and other sources to display it to the user. In a React application, many different libraries and techniques can be used to manage data fetching.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;SWR&lt;/strong&gt; (&lt;code&gt;stale-while-revalidate&lt;/code&gt;) and &lt;strong&gt;React-Query&lt;/strong&gt; are the two most popular libraries that can be used to manage data fetching in a React application. Both libraries can help you make HTTP requests, cache the results of those requests, and automatically update your UI when the data changes.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;The main difference between both&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;One of the main differences between the two libraries is the level of features and functionality they provide. SWR is a smaller library that focuses on providing a simple way to fetch and cache data, while React-Query is a larger library that provides many more features, including &lt;code&gt;pagination&lt;/code&gt;, &lt;code&gt;polling&lt;/code&gt;, &lt;code&gt;refetching&lt;/code&gt;, and &lt;code&gt;error handling&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Another difference is the way the libraries handle caching and data refreshing. In &lt;strong&gt;SWR&lt;/strong&gt;, you can use the &lt;code&gt;staleTime&lt;/code&gt; option to specify how long the data should be considered fresh before it is considered stale and eligible for revalidation. In &lt;strong&gt;React-Query&lt;/strong&gt;, you can use the &lt;code&gt;cacheTime&lt;/code&gt; option to specify the length of time that data should be kept in the cache before it is considered stale and eligible for refetching.&lt;/p&gt;

&lt;p&gt;Overall, the main difference between SWR and React-Query is the level of features and functionality they provide. SWR is a good choice for simple data fetching needs, while React-Query is a good choice for more advanced or complex data fetching requirements.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;How to use it?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;To use &lt;strong&gt;SWR&lt;/strong&gt; in a React application, you will need to install the library&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Inside your React project directory, run the following:&lt;/span&gt;
&lt;span class="n"&gt;yarn&lt;/span&gt; &lt;span class="n"&gt;add&lt;/span&gt; &lt;span class="n"&gt;swr&lt;/span&gt;

&lt;span class="c1"&gt;// Or with npm:&lt;/span&gt;
&lt;span class="n"&gt;npm&lt;/span&gt; &lt;span class="n"&gt;install&lt;/span&gt; &lt;span class="n"&gt;swr&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;then wrap your HTTP request in a &lt;code&gt;useSWR&lt;/code&gt; hook. The hook will return the data from the request. Here is a code snippet of how you might use the &lt;code&gt;useSWR&lt;/code&gt; hook to fetch data from an API:&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="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;useSWR&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;swr&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;fetcher&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;url&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="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;Users&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="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;error&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useSWR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/api/users&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;fetcher&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;error&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;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Failed&lt;/span&gt; &lt;span class="nx"&gt;to&lt;/span&gt; &lt;span class="nx"&gt;load&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&amp;gt;&lt;/span&gt;&lt;span class="err"&gt;;
&lt;/span&gt;  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;data&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;div&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;/div&amp;gt;&lt;/span&gt;&lt;span class="err"&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;div&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;data&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;/div&amp;gt;&lt;/span&gt;&lt;span class="err"&gt;;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To use &lt;strong&gt;React-Query&lt;/strong&gt;, you will need to &lt;a href="https://tanstack.com/query/v4/docs/react/installation" rel="noopener noreferrer"&gt;install the library&lt;/a&gt; and then wrap your component with &lt;code&gt;QueryClient&lt;/code&gt;. Once the library is installed, you can use the &lt;code&gt;useQuery&lt;/code&gt; hook in your React component to fetch and manage data from an API. The &lt;code&gt;useQuery&lt;/code&gt; hook accepts a &lt;code&gt;queryKey&lt;/code&gt; and a &lt;code&gt;queryFn&lt;/code&gt; as arguments, and returns an object with the data, loading state, and error state of the query.&lt;br&gt;
Import useQuery and start using it in any functional component:&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="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;@tanstack/react-query&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;Users&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="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;isLoading&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useQuery&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/api/users&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&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;res&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/api/users&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;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&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="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;isLoading&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;div&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;/div&amp;gt;&lt;/span&gt;&lt;span class="err"&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;error&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;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nb"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;message&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;/div&amp;gt;&lt;/span&gt;&lt;span class="err"&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;div&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;data&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;/div&amp;gt;&lt;/span&gt;&lt;span class="err"&gt;;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both SWR and React-Query provide many more options and configuration settings that you can use to customize the behavior of your data fetching. You can refer to the documentation for each library for more information.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Which one to choose?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The choice between using SWR or React-Query for data fetching in React app will depend on your specific needs and the complexity of your data dependencies.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SWR is a small library&lt;/strong&gt; that was created by Vercel (formerly known as Zeit). It works by wrapping your HTTP request in a useSWR hook, which returns the data from the request and some helper functions. When the data is stale, the hook will automatically re-fetch the data in the background while continuing to return the stale data to the UI. This allows the UI to stay responsive while the data is being updated.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;React-Query is a larger library&lt;/strong&gt; that provides many more features than SWR. In addition to caching and automatic data refreshing, it also has features for pagination, polling, refetching, and handling errors. It also provides tools for optimizing the performance of your data fetching, such as the ability to batch and deduplicate requests.&lt;/p&gt;

&lt;p&gt;In general, &lt;strong&gt;SWR is a good choice if you just need a simple way to fetch and cache data in your application. React-Query is a good choice if you need more advanced features or if you are working on a larger application with a lot of data dependencies.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Both libraries can be useful for improving the performance of your application by making it easier to fetch, cache, and update data in a performant way.&lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>5 Best Gnome Shell Extensions</title>
      <dc:creator>Letícia Vieira</dc:creator>
      <pubDate>Mon, 24 Oct 2022 20:24:23 +0000</pubDate>
      <link>https://forem.com/leticiabytes/5-best-gnome-extensions-5798</link>
      <guid>https://forem.com/leticiabytes/5-best-gnome-extensions-5798</guid>
      <description>&lt;p&gt;My preferred desktop environment is Gnome, which I've been using since 2018.&lt;br&gt;
I admit that extensions greatly improve the experience and were what initially drew me to GNOME.&lt;/p&gt;

&lt;p&gt;I've brought my necessary extensions with me. I'm hoping you like it.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;I'm currently using ubuntu 20.04 LTS and GNOME 3.36.8&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Use Theme
&lt;/h3&gt;

&lt;p&gt;It's a fantastic addition for customization. Use Themes enabling us to modify the GNOME Shell theme, giving us the opportunity to fully customize our experience.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://extensions.gnome.org/extension/19/user-themes" rel="noopener noreferrer"&gt;https://extensions.gnome.org/extension/19/user-themes&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Dash to Dock
&lt;/h3&gt;

&lt;p&gt;This plugin takes the dash out of the overview and converts it into a dock so that apps can be launched more easily and windows and desktops can be switched between more quickly. There are placement possibilities on the side and bottom.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://extensions.gnome.org/extension/307/dash-to-dock" rel="noopener noreferrer"&gt;https://extensions.gnome.org/extension/307/dash-to-dock&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Clipboard Indicator
&lt;/h3&gt;

&lt;p&gt;This useful application creates a little clipboard icon in the tray and, as a result, saves a history of the contents of the clipboard so you may quickly re-copy them in the future. You can instantly turn on/off a private mode as needed and define the memory cache size (for example, last 10 items or last 100 things).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://extensions.gnome.org/extension/779/clipboard-indicator" rel="noopener noreferrer"&gt;https://extensions.gnome.org/extension/779/clipboard-indicator&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  4. ArcMenu
&lt;/h3&gt;

&lt;p&gt;Similar to the Start menu in Windows, Arc Menu is a more "conventional" app menu for GNOME Shell that can be accessed from the desktop. But this item is much more flexible than Windows' Start Menu.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://extensions.gnome.org/extension/3628/arcmenu" rel="noopener noreferrer"&gt;https://extensions.gnome.org/extension/3628/arcmenu&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Sound Input &amp;amp; Output Device Chooser
&lt;/h3&gt;

&lt;p&gt;Displays a list of sound input and output devices in the status menu below the volume slider (similar to the gnome sound settings).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://extensions.gnome.org/extension/906/sound-output-device-chooser" rel="noopener noreferrer"&gt;https://extensions.gnome.org/extension/906/sound-output-device-chooser&lt;/a&gt;&lt;/p&gt;

</description>
      <category>linux</category>
      <category>gnome</category>
      <category>ubuntu</category>
      <category>extensions</category>
    </item>
  </channel>
</rss>
