<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by César O. Araújo on Medium]]></title>
        <description><![CDATA[Stories by César O. Araújo on Medium]]></description>
        <link>https://medium.com/@cesar0araujo?source=rss-5d637a7c370------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*qHraWl-dejcwfrd9jVy4Sg.jpeg</url>
            <title>Stories by César O. Araújo on Medium</title>
            <link>https://medium.com/@cesar0araujo?source=rss-5d637a7c370------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 23:25:51 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@cesar0araujo/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Multi params request using Axios]]></title>
            <link>https://medium.com/@cesar0araujo/multi-params-request-using-axios-451542ece266?source=rss-5d637a7c370------2</link>
            <guid isPermaLink="false">https://medium.com/p/451542ece266</guid>
            <category><![CDATA[axios]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[vuex]]></category>
            <category><![CDATA[http-request]]></category>
            <category><![CDATA[vuejs]]></category>
            <dc:creator><![CDATA[César O. Araújo]]></dc:creator>
            <pubDate>Sat, 29 Aug 2020 14:42:09 GMT</pubDate>
            <atom:updated>2020-08-31T13:32:35.576Z</atom:updated>
            <content:encoded><![CDATA[<p>Axios is an easy and widely used when we talk about fetching data. But have you ever had problems with multi query params? Let’s check how to do it properly then! :)</p><h3>QueryStrings</h3><p>Working with Query Strings, in general, can be an easy task, but sometimes we can face more specific situations that make the game a little bit more tricky. Okay, but what the heck is a Query String?? You may have seen some URLs that have the following format:</p><p><a href="https://www.yourdomain.com/user?id=3"><em>https://www.yourdomain.com/user?id=3</em></a></p><p>QueryStrings are part of the URL that contain an information that helps the backend to choose what it will be searching for in the database. The example above shows a GET method searching for user with id equals to 3.</p><h3>More than one param</h3><p>Now let’s think about lists! Lists are great, right?! so we gonna imagine a scenario where we need to access a list of users that live in a given city and has a given age. We can pass more than one param to the URL separating them with an “&amp;” sign like this:</p><p><a href="https://www.yourdomain.com/users?city=chicago&amp;age=22"><em>https://www.yourdomain.com/users?city=chicago&amp;age=22</em></a></p><p>easy, right?!</p><h3>The problem</h3><p>What if we need to tell the backend to send users from two different cities and different ages? Well, when working with checkbox type filters we have a problem. So let’s check this case out: We have these filters in a Vue.js with Vuex application and everytime we click in an option an action is dispatched sending these params in an Object structure to a “filters” array in our state:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/710/1*A_6J284KI2EvVbfqHipQVQ.png" /></figure><p>Now that we have the needed information in the state, we can make our request with Axios after setting up the <strong>base url</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/709/1*GDlh3LD-2ktXjmbRJeFmUg.png" /></figure><p>It looks simple, but we still have a problem. If we click in a “22 age” checkbox, we will get the following URL:</p><p><a href="https://yourdomain.com/users?city%5B%5D=&amp;age%5B%5D=22"><em>https://yourdomain.com/users?city[]=&amp;age[]=22</em></a></p><p>If we click again in another age, for exemple 18:</p><p><a href="https://yourdomain.com/users?city%5B%5D=&amp;city%5B%5D=&amp;age%5B%5D=22&amp;age%5B%5D=18"><em>https://yourdomain.com/users?city[]=&amp;city[]=&amp;age[]=22&amp;age[]=18</em></a></p><p>Maybe the first one will work, if the backend is correctly identifying the keys ending with []. However the second one will break your request returning a 400 status code (bad request).</p><h3>Solving it</h3><p>This can be solved by using <a href="https://www.npmjs.com/package/qs">QS package</a>. Basically it will allow us to stringify the array of params (cityParams and ageParams).</p><p>After download the package using npm or yarn and import it, we can pass it as a third argument in the axios request as it follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/707/1*yfA1QUF9CTFF1gSp7ZqMGQ.png" /></figure><p>Note that when we map the params, we must return <strong>undefined</strong> if there is no value. The values <strong>null</strong> and <strong>‘’ (empty string)</strong> return the key with empty value by default. Otherwise, <strong>undefined</strong> omit the whole param.</p><p>The following argument will repeat key=value for every value we have in the array.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/705/1*F4oYpalY-n_7vcq0WccQCA.png" /></figure><p>As result, we have a clean and readable URL (again clicking twice in checkboxes from age filter):</p><p><a href="https://yourdomain.com/users?age=22&amp;age=18"><em>https://yourdomain.com/users?age=22&amp;age=18</em></a></p><p>That was a little bit tricky but incredibly useful, right?! Hope it helps! :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=451542ece266" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Iniciando com React]]></title>
            <link>https://medium.com/@cesar0araujo/iniciando-com-react-908105f4e9ce?source=rss-5d637a7c370------2</link>
            <guid isPermaLink="false">https://medium.com/p/908105f4e9ce</guid>
            <category><![CDATA[html]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[front-end-development]]></category>
            <dc:creator><![CDATA[César O. Araújo]]></dc:creator>
            <pubDate>Sat, 10 Nov 2018 01:00:39 GMT</pubDate>
            <atom:updated>2018-11-10T01:29:11.542Z</atom:updated>
            <content:encoded><![CDATA[<p>Todos os dias emergem algumas ferramentas e tecnologias para auxiliar no desenvolvimento de aplicações web. <em>Frameworks </em>de <em>Javascript </em>por exemplo, “Todo dia lança um <em>framework </em>diferente de JS” é o que dizem, risos.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*nwhfNwNtPw-bPg8WC9uCBg.gif" /><figcaption>O interessante logo do React JS.</figcaption></figure><p>Com alguns (dois) anos brincando com tecnologias web, resolvi partir para uma abordagem ao <em>React</em>. Meu interesse foi despertado por alguns motivos aqui citados: 1. A crescente demanda no mercado por desenvolvedores <em>React</em>; 2. O <em>React Native</em>, necessário para criar aplicações inteiramente nativas (e com tecnologias web) para <em>mobile </em>e… 3. A sintaxe me chamou a atenção! haha!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/490/1*EVCL25ASS0zg4hPW9eGJxQ.jpeg" /><figcaption>COMO ASSIM HTML NO JAVASCRIPT? MAS QUE PORCARIA É ESTA?!</figcaption></figure><p>Basicamente irei documentar minha experiência aprendendo sobre React aqui no Medium. Espero que esta experiência documentada sirva de auxílio para alguém que tenha algum interesse em começar a aprender tal tecnologia. Vamos começar?</p><h3>O que é React?</h3><p>Esta é, provavelmente, a pergunta mais chata de se responder em qualquer coisa que você vá estudar, porém, uma das mais importantes para o fundamento que você almeja adquirir. Sendo assim, lá vamos nós…</p><p>O React é uma <em>library </em>(biblioteca) <em>Javascript </em>para a construção de interfaces gráficas baseadas em componentes. No padrão MVC (<em>Model, View, Controller</em>) ele representa a <em>View </em>(a parte visual da coisa). Foi criado e é mantido pelo pessoal manjador do Facebook/Instagram.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/552/1*aJ7KbVFnh3j9_txkr9JaeA.jpeg" /><figcaption>UI baseada em Componentes? Mas que p**** é essa?!</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*Us9NrnqD6T6F9igkJ2Z45w.png" /></figure><p>Imagine duas páginas implementadas com HTML e CSS como na parte A da imagem ao lado. Elas fazem parte de um mesmo <em>website </em>e você precisa alterar alguma coisa na navegação. Você provavelmente precisará fazer a alteração em cada uma das páginas separadamente.</p><p>Utilizando o <em>React</em>, você pode cortar a sua página em componentes menores (Lado B da imagem acima): Barra de navegação, <em>Sidebar</em>, <em>Section</em>, etc. E desta forma, poderá fazer a alteração no componente em si e a mudança acontecerá em todas as páginas que contiverem aquele componente. Ou seja, estes componentes tornam-se muito mais reutilizáveis.</p><p>Além da componentização, esta belezinha de Lib traz alguns outros benefícios como o Virtual DOM (<em>Document Object Model</em>), Otimização de performance e é possível rodar no servidor para melhor SEO!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/374/1*AQIiQYNA6L_ou2WMwx_JPw.gif" /><figcaption>Bitch!!!</figcaption></figure><h3>O Virtual DOM</h3><p>É por causa do Virtual DOM que os Devs deixam cair uma lágrima de felicidade :’)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*05Cb7BV8PpRrup2M85clJg.jpeg" /><figcaption>Minha primeira vez com o React me marcou! :’)</figcaption></figure><p>O React possui um método chamado render(). Este método cria um DOM virtual — Que ainda não está no <em>Browser </em>— e logo após é injetado no DOM verdadeiro. O ponto crítico é que, quando uma mudança em um componente ocorre, ele refaz este processo e SÓ manda o componente alterado para o DOM verdadeiro. É bom ou não é esse trem?!</p><h3>Continua no próximo episódio…</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*4OxhNfJan59-vPMiVqLoZw.jpeg" /><figcaption>❤</figcaption></figure><p>Espero que tenham gostado desta pequena introdução sobre uma tecnologia fantástica que vem tomando espaço no mercado! Eu aprendo, você aprende e nós programamos! Até a próxima!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=908105f4e9ce" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>