<?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"><channel><title><![CDATA[Mastering Front-End Development: Tips, Tricks, and Techniques]]></title><description><![CDATA[Unlock the world of Front-End Development with expert tips, tricks, and cutting-edge techniques. Stay ahead in the web development using react js.]]></description><link>https://blog.pehcst.dev</link><generator>RSS for Node</generator><lastBuildDate>Sat, 02 May 2026 06:55:00 GMT</lastBuildDate><atom:link href="https://blog.pehcst.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[React: Understanding useLayoutEffect vs. useEffect]]></title><description><![CDATA[There are two hooks in React, useEffect and useLayoutEffect, which appears to work similarly.
The way you call them seems the same:
useEffect(() => {
  // side effects
  return () => /* cleanup */
}, [dependency, array]);

useLayoutEffect(() => {
  /...]]></description><link>https://blog.pehcst.dev/react-understanding-uselayouteffect-vs-useeffect</link><guid isPermaLink="true">https://blog.pehcst.dev/react-understanding-uselayouteffect-vs-useeffect</guid><category><![CDATA[React]]></category><category><![CDATA[ReactHooks]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[Frontend Development]]></category><category><![CDATA[tips]]></category><dc:creator><![CDATA[Pedro Costa]]></dc:creator><pubDate>Mon, 24 Jul 2023 16:31:21 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1690216156968/10493198-5f33-4424-907c-d545119cfbab.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>There are two hooks in React, <code>useEffect</code> and <code>useLayoutEffect</code>, which appears to work similarly.</p>
<p>The way you call them seems the same:</p>
<pre><code class="lang-javascript">useEffect(<span class="hljs-function">() =&gt;</span> {
  <span class="hljs-comment">// side effects</span>
  <span class="hljs-keyword">return</span> <span class="hljs-function">() =&gt;</span> <span class="hljs-comment">/* cleanup */</span>
}, [dependency, array]);

useLayoutEffect(<span class="hljs-function">() =&gt;</span> {
  <span class="hljs-comment">// side effects</span>
  <span class="hljs-keyword">return</span> <span class="hljs-function">() =&gt;</span> <span class="hljs-comment">/* cleanup */</span>
}, [dependency, array]);
</code></pre>
<p>However, they are not the same. Let's see what makes them different and when to use each one. (tl; dr: most of the time you want to use <code>useEffect</code>)</p>
<p>The Difference Between <code>useEffect</code> and <code>useLayoutEffect</code> It's all about the timing of execution.</p>
<p><code>useEffect</code> is executed asynchronously and after a rendering is painted on the screen.</p>
<p>So it looks like this:</p>
<p>You trigger a rendering somehow (change the state or the parent component is rendered again). React renders your component (calls your component). The screen is visually updated. <strong>ONLY THEN</strong> <code>useEffect</code> is executed.</p>
<p><code>useLayoutEffect</code>, on the other hand, is executed synchronously after a rendering but before the screen update. This means:</p>
<p>You trigger a rendering somehow (change the state or the parent component is rendered again). React renders your component (calls your component). <code>useLayoutEffect</code> is executed, and React waits for it to finish. The screen is visually updated.</p>
<p>99% of the Time, <code>useEffect</code> In most cases, your effect is synchronizing some state or object with something that doesn't need to happen IMMEDIATELY or doesn't visually affect the page.</p>
<p>For example, if you are fetching data from a server, it won't result in an immediate change.</p>
<p>Or if you are setting up an event handler.</p>
<p>Or if you are resetting some state when a modal dialog appears or disappears.</p>
<p>Most of the time, <code>useEffect</code> is the right way to go.</p>
<p>When to use <code>useLayoutEffect</code> What is the right time to use <code>useLayoutEffect</code>? You'll know when you see it. Literally ;)</p>
<p>If your component flickers when the state is updated—meaning, it is first rendered in a partially ready state and then rendered again in its final state—that's a good clue that it's time to switch to useLayoutEffect.</p>
<p>Here's an example (artificial) so you can understand what I mean.</p>
<p>When you click on the page ([A]), the state immediately changes (value is reset to 0), which re-renders the component, and then the effect is executed—which sets the value to some random number and is rendered again.</p>
<p>The result is that two renderings happen in quick succession.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> React, { useState, useLayoutEffect } <span class="hljs-keyword">from</span> <span class="hljs-string">'react'</span>;
<span class="hljs-keyword">import</span> ReactDOM <span class="hljs-keyword">from</span> <span class="hljs-string">'react-dom'</span>;

<span class="hljs-keyword">const</span> BlinkyRender = <span class="hljs-function">() =&gt;</span> {
  <span class="hljs-keyword">const</span> [value, setValue] = useState(<span class="hljs-number">0</span>);

  useLayoutEffect(<span class="hljs-function">() =&gt;</span> {
    <span class="hljs-keyword">if</span> (value === <span class="hljs-number">0</span>) {
      setValue(<span class="hljs-number">10</span> + <span class="hljs-built_in">Math</span>.random() * <span class="hljs-number">200</span>);
    }
  }, [value]);

  <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'render'</span>, value);

  <span class="hljs-keyword">return</span> (
    <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">onClick</span>=<span class="hljs-string">{()</span> =&gt;</span> setValue(0)}&gt;
      value: {value}
    <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span></span>
  );
};

ReactDOM.render(
  <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">BlinkyRender</span> /&gt;</span></span>,
  <span class="hljs-built_in">document</span>.querySelector(<span class="hljs-string">'#root'</span>)
);
</code></pre>
<p>[A]: In general, putting onClick handlers on divs is bad for accessibility (use buttons!), this is a disposable demo. I just wanted to mention it!</p>
<p>Try both versions:</p>
<p>Version with useLayoutEffect</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> React, { useState, useLayoutEffect } <span class="hljs-keyword">from</span> <span class="hljs-string">"react"</span>;
<span class="hljs-keyword">import</span> ReactDOM <span class="hljs-keyword">from</span> <span class="hljs-string">"react-dom"</span>;
<span class="hljs-keyword">import</span> <span class="hljs-string">"./styles.css"</span>;

<span class="hljs-keyword">const</span> BlinkyRender = <span class="hljs-function">() =&gt;</span> {
  <span class="hljs-keyword">const</span> [value, setValue] = useState(<span class="hljs-number">0</span>);

  useLayoutEffect(<span class="hljs-function">() =&gt;</span> {
    <span class="hljs-keyword">if</span> (value === <span class="hljs-number">0</span>) {
      setValue(<span class="hljs-number">10</span> + <span class="hljs-built_in">Math</span>.random() * <span class="hljs-number">200</span>);
    }
  }, [value]);

  <span class="hljs-built_in">console</span>.log(<span class="hljs-string">"render"</span>, value);

  <span class="hljs-keyword">return</span> (
    <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">onClick</span>=<span class="hljs-string">{()</span> =&gt;</span> setValue(0)}&gt;value: {value}<span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span></span>
  );
};

ReactDOM.render(
  <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">BlinkyRender</span> /&gt;</span></span>,
  <span class="hljs-built_in">document</span>.querySelector(<span class="hljs-string">"#root"</span>)
);
</code></pre>
<p>Version with useEffect — Visual flicker</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> React, { useState, useEffect } <span class="hljs-keyword">from</span> <span class="hljs-string">"react"</span>;
<span class="hljs-keyword">import</span> ReactDOM <span class="hljs-keyword">from</span> <span class="hljs-string">"react-dom"</span>;
<span class="hljs-keyword">import</span> <span class="hljs-string">"./styles.css"</span>;

<span class="hljs-keyword">const</span> BlinkyRender = <span class="hljs-function">() =&gt;</span> {
  <span class="hljs-keyword">const</span> [value, setValue] = useState(<span class="hljs-number">0</span>);

  useEffect(<span class="hljs-function">() =&gt;</span> {
    <span class="hljs-keyword">if</span> (value === <span class="hljs-number">0</span>) {
      setValue(<span class="hljs-number">10</span> + <span class="hljs-built_in">Math</span>.random() * <span class="hljs-number">200</span>);
    }
  }, [value]);

  <span class="hljs-built_in">console</span>.log(<span class="hljs-string">"render"</span>, value);

  <span class="hljs-keyword">return</span> (
    <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">onClick</span>=<span class="hljs-string">{()</span> =&gt;</span> setValue(0)}&gt;value: {value}<span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span></span>
  );
};

ReactDOM.render(
  <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">BlinkyRender</span> /&gt;</span></span>,
  <span class="hljs-built_in">document</span>.querySelector(<span class="hljs-string">"#root"</span>)
);
</code></pre>
<p>Notice how the <code>useLayoutEffect</code> version visually updates only once, even though the component has been rendered twice. The <code>useEffect</code> version, on the other hand, visually renders twice, where you can briefly see the value as 0.</p>
<p>Should I Use <code>useEffect</code> or <code>useLayoutEffect</code>? Most of the time, <code>useEffect</code> is the right choice. If your code is causing rendering flickers, switch to <code>useLayoutEffect</code> and see if that helps.</p>
<p>Since <code>useLayoutEffect</code> is synchronous (blocks rendering), and the app won't visually update until the effect finishes executing... this can cause performance issues if you have slow code in your effect. Along with the fact that most effects don't need the world to pause while they happen.</p>
]]></content:encoded></item><item><title><![CDATA[How to Avoid Excessive useState Usage in a React Component]]></title><description><![CDATA[If you're working with React components, you've probably encountered the need to manage the state within your components. React provides the useState hook for managing simple states, but sometimes, the number of states that need to be managed can mak...]]></description><link>https://blog.pehcst.dev/how-to-avoid-excessive-usestate-usage-in-a-react-component</link><guid isPermaLink="true">https://blog.pehcst.dev/how-to-avoid-excessive-usestate-usage-in-a-react-component</guid><category><![CDATA[React]]></category><category><![CDATA[Frontend Development]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[TypeScript]]></category><category><![CDATA[tips]]></category><dc:creator><![CDATA[Pedro Costa]]></dc:creator><pubDate>Fri, 07 Jul 2023 19:51:36 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1688828409715/1e8e6c08-0e6d-4674-a05e-9bd932e8f2c7.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>If you're working with React components, you've probably encountered the need to manage the state within your components. React provides the <code>useState</code> hook for managing simple states, but sometimes, the number of states that need to be managed can make the code confusing and disorganized.</p>
<p>In this post, we'll present a way to avoid excessive <code>useState</code> usage in a React component by grouping related states into an object and managing them with a single <code>useState</code>.</p>
<p>The first step is to create an initial object that contains all the related states. For example, if you have <em>states</em> for "name" and "age," you can create an initial object like this:</p>
<pre><code class="lang-jsx"><span class="hljs-keyword">const</span> initialState = {
  <span class="hljs-attr">name</span>: <span class="hljs-string">''</span>,
  <span class="hljs-attr">age</span>: <span class="hljs-string">''</span>
}
</code></pre>
<p>Next, use <code>useState</code> to manage the entire object. For example:</p>
<pre><code class="lang-jsx"><span class="hljs-keyword">const</span> [state, setState] = useState(initialState);
</code></pre>
<p>When you need to update a specific state, use <code>setState</code> to update the entire object. For example:</p>
<pre><code class="lang-jsx"><span class="hljs-keyword">const</span> handleNameChange = <span class="hljs-function">(<span class="hljs-params">event</span>) =&gt;</span> {
  setState({
    ...state,
    <span class="hljs-attr">name</span>: event.target.value
  });
}
</code></pre>
<p>To access individual states, you can destructure them from the entire object. For example:</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> { name, age } = state;
</code></pre>
<p>Conclusion</p>
<p>This way, you can avoid excessive <code>useState</code> usage and keep your code more organized and manageable. By grouping related states into an object and managing them with a single useState, you can maintain clear and simple code without sacrificing flexibility and scalability.</p>
]]></content:encoded></item><item><title><![CDATA[Rubber duck debugging? what?]]></title><description><![CDATA[If you're a programmer, have you ever found yourself talking to yourself to understand what your code is doing or to identify where a certain error is occurring? This debugging method is quite well-known, and programmers often debug with a "rubber du...]]></description><link>https://blog.pehcst.dev/rubber-duck-debugging-what</link><guid isPermaLink="true">https://blog.pehcst.dev/rubber-duck-debugging-what</guid><category><![CDATA[tips]]></category><category><![CDATA[Programming Blogs]]></category><category><![CDATA[books]]></category><category><![CDATA[Programming Tips]]></category><dc:creator><![CDATA[Pedro Costa]]></dc:creator><pubDate>Fri, 07 Jul 2023 19:49:02 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1688827947732/4efb37c6-99d1-433e-bd33-b8751bdc5a46.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>If you're a programmer, have you ever found yourself talking to yourself to understand what your code is doing or to identify where a certain error is occurring? This debugging method is quite well-known, and programmers often debug with a "<strong><em>rubber duck.</em></strong>" It may sound crazy, but it's a software engineering method. Debugging with a rubber duck refers to a story from the book "<em>The Pragmatic Programmer</em>" (which I highly recommend reading) where a programmer carries a rubber duck and debugs their code by explaining it, line by line, to the duck.</p>
<p><img src="https://images.prismic.io/pehcst/3c91444d-066b-47b5-88b8-efe93d48484f_duck.jpeg?auto=compress,format" alt="My duck" class="image--center mx-auto" /></p>
<p>I have done it, and I know that many programmers have had the experience of explaining a programming problem to someone else, possibly even to someone who knows nothing about this universe, and magically finding the solution during the explanation of the problem.</p>
<p>But how is this possible? By describing what the code should do and observing what it does, any differences between these processes become clearer and more noticeable. In general, explaining or teaching about a particular subject forces you to understand the case from different perspectives, aiding in the understanding of the problem.</p>
<p>But does it have to be a rubber duck? No, of course not. It can be anything. The duck is used as a representative figure in the book. Personally, I explain most of my code problems to a coworker or my little toy duck, Patolino, who sits at my desk.</p>
<p>The tip is: you can use a rubber duck or any other discreet object you can talk to (yes, programming is like that, folks, you have to be a bit crazy).</p>
<h1 id="heading-the-explanation">The Explanation</h1>
<p>It does work, and there is a whole psychological study behind how all of this works. The summary is that when we speak out loud, our brain can process the details better, and as a result, our attention to details or errors becomes sharper, allowing us to find problems more quickly.</p>
<p><img src="https://images.prismic.io/pehcst/03af10aa-d8c4-46c3-8edb-c85a2332ee42_duck2.png?auto=compress,format" alt="pato salva vidas" class="image--center mx-auto" /></p>
<p>The figure of a rubber duck, which we assume knows nothing about programming or any particular subject, requires us to explain in more detail what we are thinking when writing that block of code. By doing this, we are forced, while explaining the problem, to pay more attention to what we were previously doing alone.</p>
<p>Well, that's all! Thank you for reading, and here's the link to the book <a target="_blank" href="https://www.amazon.com.br/Programador-Pragm%C3%A1tico-Aprendiz-Mestre/dp/8577807002/ref=asc_df_8577807002/?tag=googleshopp00-20&amp;linkCode=df0&amp;hvadid=379765802639&amp;hvpos=&amp;hvnetw=g&amp;hvrand=7291085860891527701&amp;hvpone=&amp;hvptwo=&amp;hvqmt=&amp;hvdev=c&amp;hvdvcmdl=&amp;hvlocint=&amp;hvlocphy=1032132&amp;hvtargid=pla-1412458569268&amp;psc=1">The Pragmatic Programmer.</a></p>
]]></content:encoded></item><item><title><![CDATA[Unraveling console.log]]></title><description><![CDATA[Using console.log() is a very basic way to diagnose and troubleshoot minor issues in your code.
But did you know that there's more to the console than just a log? In this post, I bring you two additional functionalities to print to the console in JS....]]></description><link>https://blog.pehcst.dev/unraveling-consolelog</link><guid isPermaLink="true">https://blog.pehcst.dev/unraveling-consolelog</guid><category><![CDATA[JavaScript]]></category><category><![CDATA[Frontend Development]]></category><category><![CDATA[Tutorial]]></category><category><![CDATA[tips]]></category><dc:creator><![CDATA[Pedro Costa]]></dc:creator><pubDate>Fri, 07 Jul 2023 19:37:53 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1688827407644/bf57cfe7-0a20-4a4c-9592-e42897f3f503.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Using <code>console.log()</code> is a very basic way to diagnose and troubleshoot minor issues in your code.</p>
<p>But did you know that there's more to the console than just a log? In this post, I bring you two additional functionalities to print to the console in JS.</p>
<h1 id="heading-log"><strong>.log()</strong></h1>
<p>The <code>console.log()</code> method is the simplest and most well-known, which generates a message to your browser's console. The message can be a single string or one or more JavaScript objects.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> x = <span class="hljs-string">'Test'</span>
<span class="hljs-built_in">console</span>.log(x)
</code></pre>
<p>In this example, '<em>Test</em>' will be returned in the console, pretty simple, right?</p>
<p>We can also include multiple values in the console. Add a string at the beginning to identify what you're logging.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> x = <span class="hljs-string">'Test'</span>
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">"value"</span>, x)
</code></pre>
<p>But what if we have multiple values to show?</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> x = <span class="hljs-string">'Test'</span>
<span class="hljs-keyword">const</span> y = <span class="hljs-string">'Super test'</span>
<span class="hljs-keyword">const</span> z = <span class="hljs-string">'Mega test'</span>
</code></pre>
<p>Would we use console.log 3 times? No! We can include all of them in one and still add a string to identify each of them.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> x = <span class="hljs-string">'Test'</span>
<span class="hljs-keyword">const</span> y = <span class="hljs-string">'Super test'</span>
<span class="hljs-keyword">const</span> z = <span class="hljs-string">'Mega test'</span>
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">'x:'</span>, x, <span class="hljs-string">'y:'</span>, y, <span class="hljs-string">'z:'</span>, z)
</code></pre>
<p>But that's a lot of work. To make it easier, simply wrap the variables inside curly braces to transform the log into an object.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> x = <span class="hljs-string">'Test'</span>
<span class="hljs-keyword">const</span> y = <span class="hljs-string">'Super test'</span>
<span class="hljs-keyword">const</span> z = <span class="hljs-string">'Mega test'</span>
<span class="hljs-built_in">console</span>.log({x, y, z})
</code></pre>
<h1 id="heading-log-variations">Log Variations</h1>
<p>There are other variations to improve visibility in the browser console.</p>
<pre><code class="lang-javascript"><span class="hljs-built_in">console</span>.log(<span class="hljs-string">'Simple console log'</span>)
<span class="hljs-built_in">console</span>.info(<span class="hljs-string">'Information console'</span>)
<span class="hljs-built_in">console</span>.debug(<span class="hljs-string">'Debug console'</span>)
<span class="hljs-built_in">console</span>.warn(<span class="hljs-string">'Warning console'</span>)
<span class="hljs-built_in">console</span>.error(<span class="hljs-string">'Error console'</span>)
</code></pre>
<p>Each of these has a different interaction with the browser, making debugging easier. You can add styles to the logs, for example, where a warning will appear in <mark>yellow</mark> and an error in <strong>red</strong>.</p>
<p>The styles may vary depending on your browser.</p>
<h1 id="heading-assert"><strong>.assert()</strong></h1>
<p>We can also add conditionals to the browser console. By using <code>assert()</code>, we can print the log according to the boolean value of the information.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> works = <span class="hljs-literal">false</span>
<span class="hljs-built_in">console</span>.assert(works, <span class="hljs-string">'This is the reason'</span>)
</code></pre>
<p>If the first argument of assert is false, the message will be printed in the console. But if it returns true, it won't appear.</p>
<h1 id="heading-count"><strong>.count()</strong></h1>
<p>Yes, it's possible to create a counter within the console.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">for</span> (i = <span class="hljs-number">0</span>; i &lt; <span class="hljs-number">10</span>; i++) {
  <span class="hljs-built_in">console</span>.count()
}
</code></pre>
<p>Each iteration of the loop will print a counter in the console. In this case, you will see the default: 1 up to default: 10. If you execute the loop again, it will continue from where it left off, starting from 11 up to 20.</p>
<p>To reset the counter, you can use the <code>console.countReset()</code> after the loop.</p>
<h1 id="heading-time"><strong>.Time()</strong></h1>
<p>In addition to counting, we can also time the execution using the <code>console.time()</code>. However, it alone can't do much. To demonstrate, let's create a small interval that simulates rendering using <code>setTimeout()</code>. Within this time limit, we'll use <code>console.timeEnd()</code> to get the final execution time.</p>
<pre><code class="lang-javascript"><span class="hljs-built_in">console</span>.time()
<span class="hljs-built_in">setTimeout</span>(<span class="hljs-function">() =&gt;</span> {
  <span class="hljs-built_in">console</span>.timeEnd()
}, <span class="hljs-number">2000</span>)
</code></pre>
<p>By executing this code snippet, you can see that the console will display the time it took to execute the <code>setTimeout()</code>.</p>
<p>We can also display the elapsed time using timeLog to label a timer.</p>
<pre><code class="lang-javascript"><span class="hljs-built_in">console</span>.time()
<span class="hljs-built_in">setTimeout</span>(<span class="hljs-function">() =&gt;</span> {
  <span class="hljs-built_in">console</span>.timeLog()
}, <span class="hljs-number">2000</span>)
</code></pre>
<h1 id="heading-table"><strong>.Table()</strong></h1>
<p>Want to see your log as a table? It's possible with <code>.table()</code>. This is one of the uses to improve the visualization of certain objects.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">let</span> devices = [
  {
    <span class="hljs-attr">name</span>: <span class="hljs-string">'iPhone'</span>,
    <span class="hljs-attr">brand</span>: <span class="hljs-string">'Apple'</span>
  },
  {
    <span class="hljs-attr">name</span>: <span class="hljs-string">'Galaxy'</span>,
    <span class="hljs-attr">brand</span>: <span class="hljs-string">'Samsung'</span>
  },
  {
    <span class="hljs-attr">name</span>: <span class="hljs-string">'Pixel'</span>,
    <span class="hljs-attr">brand</span>: <span class="hljs-string">'Google'</span>
  },
  {
    <span class="hljs-attr">name</span>: <span class="hljs-string">'Poco'</span>,
    <span class="hljs-attr">brand</span>: <span class="hljs-string">'Huawei'</span>
  }
]
<span class="hljs-built_in">console</span>.table(devices);
</code></pre>
<p><img src="https://images.prismic.io/pehcst/af4e16f5-9c69-402f-856d-5b8254a66b51_log.jpeg?auto=compress,format" alt /></p>
<h1 id="heading-clear"><strong>.clear()</strong></h1>
<p>Have trouble finding a log due to the multiple renders you're doing on the page? Are you constantly refreshing and getting lost in the browser console?</p>
<p>Simple, add <code>console.clear()</code> at the beginning of your code, and every time you render, you'll have a fresh console.</p>
<p>Just don't add it at the end of your code 🤪🤪🤪</p>
<p>Well, that's all! Thank you for reading, and of course, there are many other logs you can use.</p>
<p>Explore the documentation: <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/API/Console"><strong>https://developer.mozilla.org/enUS/docs/Web/API/Console</strong></a></p>
]]></content:encoded></item><item><title><![CDATA[3 apis every front-end developer should study]]></title><description><![CDATA[Every developer needs to practice, right? A developer's life isn't just about books or Stack Overflow, so I've gathered some APIs that I've used to learn while having fun on front-end projects and also add to your portfolio 😍
If you need inspiration...]]></description><link>https://blog.pehcst.dev/3-apis-every-front-end-developer-should-study</link><guid isPermaLink="true">https://blog.pehcst.dev/3-apis-every-front-end-developer-should-study</guid><category><![CDATA[React]]></category><category><![CDATA[React Native]]></category><category><![CDATA[Frontend Development]]></category><category><![CDATA[frontend]]></category><dc:creator><![CDATA[Pedro Costa]]></dc:creator><pubDate>Fri, 07 Jul 2023 19:25:03 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1688761408227/637d3600-fa0d-4630-b254-d00f9dbdd990.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Every developer needs to practice, right? A developer's life isn't just about books or Stack Overflow, so I've gathered some APIs that I've used to learn while having fun on front-end projects and also add to your portfolio 😍</p>
<p>If you need inspiration for the project, I use the <a target="_blank" href="https://dribbble.com/">dribble</a> to search for design references but don't worry too much about searching, I'll leave some templates for each API!</p>
<p>✋🏻 <strong>Don't forget to credit the designer, ok.</strong></p>
<h1 id="heading-pokeapi"><strong>PokeAPI</strong></h1>
<p><img src="https://images.prismic.io/pehcst/697cb6a6-f7fa-4c7b-a9f0-b40ef042a3d8_pokeapi.png?auto=compress,format" alt="Imagem de Seapul Nahwan - Dribbble" class="image--center mx-auto" /></p>
<p>Have you ever thought about creating a Pokedex? knowing all existing Pokemon? Then it's time to explore this magnificent API that provides all the necessary information to create a huge pokedex and make Ash jealous.</p>
<p>API 👉🏻 <a target="_blank" href="https://pokeapi.co/">https://pokeapi.co/</a></p>
<p>Let's go to the references to test your skills, Pokedex is cool to do for mobile, to have the same experience as our colleague Ash.</p>
<p>Mobile:</p>
<ul>
<li><p><a target="_blank" href="https://dribbble.com/shots/6540871-Pokedex-App">https://dribbble.com/shots/6540871-Pokedex-App</a></p>
</li>
<li><p><a target="_blank" href="https://dribbble.com/shots/16833947-Mobile-Pokedex-App-Design-Exploration">https://dribbble.com/shots/16833947-Mobile-Pokedex-App-Design-Exploration</a></p>
</li>
<li><p><a target="_blank" href="https://dribbble.com/shots/4862523-Pokedex-iOS-app-Squirtle">https://dribbble.com/shots/4862523-Pokedex-iOS-app-Squirtle</a></p>
</li>
</ul>
<p>Web:</p>
<ul>
<li><p><a target="_blank" href="https://dribbble.com/shots/15128634-Pokemon-Pokedex-Website-Redesign-Concept">https://dribbble.com/shots/15128634-Pokemon-Pokedex-Website-Redesign-Concept</a></p>
</li>
<li><p><a target="_blank" href="https://www.pokemon.com/us/pokedex/">https://www.pokemon.com/us/pokedex/</a></p>
</li>
</ul>
<h1 id="heading-moviedb"><strong>MovieDB</strong></h1>
<p><img src="https://images.prismic.io/pehcst/3acbcc75-ce5d-479a-b580-6a083c45b81d_moviedb.png?auto=compress,format" alt="Print do site themoviedb.org" class="image--center mx-auto" /></p>
<p>This one is classic! Who doesn't want to build a Netflix? But only with information, this API is COMPLETE, with tons of information about movies and series, with this API you will be able to search for movies in theaters, check the cast, ratings and WOW, it gives you a small authentication and user session control! I'm sure this is one of the best APIs to practice.</p>
<p>API 👉🏻 <a target="_blank" href="https://developers.themoviedb.org/3/">https://developers.themoviedb.org/3/</a></p>
<p>The reference I don't even need to say, is <strong>Netflix</strong>! but with the special touch of no movie, only information 🫠</p>
<p>Two amazing references to practice your dev skills:</p>
<ul>
<li><p><a target="_blank" href="https://dribbble.com/shots/15558638-Movie-Dashboard-Design-Dark-Mode">https://dribbble.com/shots/15558638-Movie-Dashboard-Design-Dark-Mode</a></p>
</li>
<li><p><a target="_blank" href="https://dribbble.com/shots/17230478-MOVEA-Movie-dashboard-design">https://dribbble.com/shots/17230478-MOVEA-Movie-dashboard-design</a></p>
</li>
</ul>
<h1 id="heading-marvel"><strong>Marvel</strong></h1>
<p><img src="https://images.prismic.io/pehcst/ed2cf6db-d350-48f4-a80c-47d4c54c4487_marvelapi.jpeg?auto=compress,format" alt="Banner do site da marvel" class="image--center mx-auto" /></p>
<p>Ultron released the code of the multiverse and now we can navigate through all the characters of this enormous API. For the nerds out there, I'm sure it will be an adventure to develop a guide with all the Marvel characters.</p>
<p>The Marvel API is commented on in each return field, making it even easier to understand.</p>
<p>API 👉🏻 <a target="_blank" href="https://developer.marvel.com/">https://developer.marvel.com/</a></p>
<p>Outsmart Tony Stark and build a powerful application with this reference 👊🏻</p>
<ul>
<li><a target="_blank" href="https://dribbble.com/shots/17032308-Comic-Books-Library">https://dribbble.com/shots/17032308-Comic-Books-Library</a></li>
</ul>
<p>That's it, folks, with these 3 examples you will already acquire a lot of knowledge on how to work with an API and for sure it will help you in future projects!</p>
<p>But don't limit yourself to just these APIs listed above, there are several public APIs for you to access and create your applications and tune up your portfolio.</p>
<p>Hope I helped! See you next time 👋🏻</p>
]]></content:encoded></item></channel></rss>