<?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: Sashe V.</title>
    <description>The latest articles on DEV Community by Sashe V. (@sashevuchkov).</description>
    <link>https://dev.to/sashevuchkov</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%2F687843%2Fdfa680a8-d236-4452-ad16-e401983d43fb.png</url>
      <title>DEV Community: Sashe V.</title>
      <link>https://dev.to/sashevuchkov</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sashevuchkov"/>
    <language>en</language>
    <item>
      <title>A Handy Way of Building Reusable React Components (Inspired by Hemingway)</title>
      <dc:creator>Sashe V.</dc:creator>
      <pubDate>Sun, 29 Jan 2023 13:33:48 +0000</pubDate>
      <link>https://dev.to/sashevuchkov/a-handy-way-of-building-reusable-react-components-inspired-by-hemingway-4938</link>
      <guid>https://dev.to/sashevuchkov/a-handy-way-of-building-reusable-react-components-inspired-by-hemingway-4938</guid>
      <description>&lt;p&gt;Should we think about the reusability of our code all the time?&lt;/p&gt;

&lt;p&gt;Some advise us to think about it only after we face the need for it. That means if we're creating a brand new component and don't know whether it will be used somewhere else, then we shouldn't try to make it reusable because that complicates our life (think "analysis-paralysis" and "premature optimization").&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;After all - we can't know the future, you know?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Well, I disagree with that!&lt;/p&gt;

&lt;p&gt;I believe we should plan our work and set up the scene correctly so we can later improve it more easily. In real life, nobody likes to touch stuff that "works well as is," especially when there is a deadline and a bad legacy "smell."&lt;/p&gt;

&lt;p&gt;So the tendency is to write "new and better stuff"…&lt;/p&gt;

&lt;p&gt;Like it's supposed to be better just because it's newly created. But the harsh reality is that most of us are far from perfection, and what's good enough today will invariably become a "legacy" that needs to be improved by refactoring or replacing.&lt;/p&gt;

&lt;p&gt;In Object Oriented Programming, the SOLID principles guide programmers and developers on how to plan (or refactor) their software for better design.&lt;/p&gt;

&lt;p&gt;Although we'll talk about functional React components, a big chunk of the "philosophy" behind SOLID is also applicable in our case, so I strongly encourage you to investigate this topic further.&lt;/p&gt;

&lt;p&gt;The main takeaway is that we can and should plan to create understandable, testable, maintainable, and reusable code.&lt;/p&gt;

&lt;p&gt;It never happens by chance…&lt;/p&gt;

&lt;p&gt;In a minute, we'll slice and dice one hardly reusable chunk of code into elegant React components, but before that, I will share with you my strategy for producing better results that I learned from a famous novelist.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Can We Learn About Coding From Hemingway?
&lt;/h2&gt;

&lt;p&gt;I'm totally convinced that making software is creative writing on a higher plane. So we can learn a lot about the process of "writing" from the great novelists of the past.&lt;/p&gt;

&lt;p&gt;Hemingway once said to an aspiring writer:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"The first draft of anything is rubbish."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It's true in coding, too. Whenever I try to come up with the perfect component or function, that slows me down and makes me anxious.&lt;/p&gt;

&lt;p&gt;That's why I always start with a "first draft."&lt;/p&gt;

&lt;p&gt;I make the app to show me the component.&lt;/p&gt;

&lt;p&gt;It should look as designed. And it should behave as planned. I don't think about quality, reusability, or testability in this phase. I write what comes first to my mind.&lt;/p&gt;

&lt;p&gt;When it's on my screen, I switch to my editor again and start pondering how to make it better…&lt;/p&gt;

&lt;p&gt;Let's take this for example:&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="p"&gt;,&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="nx"&gt;useState&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;FeaturedPostsSection&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;posts&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setPosts&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;([]);&lt;/span&gt;

    &lt;span class="nf"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="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="s2"&gt;https://buhalbu.com/api/blog/featured&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="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;response&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="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;featuredPosts&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;setPosts&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;posts&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
            &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&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="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;section&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;blog-featured-posts&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;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;container&lt;/span&gt;&lt;span class="dl"&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;posts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(({&lt;/span&gt;&lt;span class="nx"&gt;slug&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;featuredMedia&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;category&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;author&lt;/span&gt;&lt;span class="p"&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;div&lt;/span&gt; &lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;slug&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;snippet&lt;/span&gt;&lt;span class="dl"&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;featuredMedia&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&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;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;snippet-img&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;img&lt;/span&gt;
                            &lt;span class="nx"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;featuredMedia&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="nx"&gt;alt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
                            &lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;428&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
                            &lt;span class="nx"&gt;height&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;285&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
                        &lt;span class="sr"&gt;/&amp;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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;snippet-img-overlay&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;a&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;badge&lt;/span&gt;&lt;span class="dl"&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;category&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;/a&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;a&lt;/span&gt; &lt;span class="nx"&gt;href&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="p"&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;h5&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;snippet-title&lt;/span&gt;&lt;span class="dl"&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;title&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;/h5&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;/a&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;p&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;snippet-text&lt;/span&gt;&lt;span class="dl"&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;author&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;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;                        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;                    &lt;span class="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="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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/section&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 purpose of this component is to show a set of featured blog posts on top of the main archive page. It's not so reusable because it doesn't accept any props meaning that you can't customize it dynamically. Also, it's tightly coupled to my API and data structure.&lt;/p&gt;

&lt;p&gt;If I don't need precisely the same featured post snippets somewhere else, then I can't reuse the section.&lt;br&gt;
But no worry - it's just a shitty first draft.&lt;br&gt;
How can we make it better?&lt;/p&gt;

&lt;p&gt;After analyzing it briefly, I can see eight stand-alone React components.&lt;/p&gt;

&lt;p&gt;Let's start with the easiest ones:&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="c1"&gt;//First Step&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;SnippetText&lt;/span&gt; &lt;span class="o"&gt;=&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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;snippet-text&lt;/span&gt;&lt;span class="dl"&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;children&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;/p&amp;gt;&lt;/span&gt;&lt;span class="err"&gt;;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;//Second Step&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;SnippetText&lt;/span&gt; &lt;span class="o"&gt;=&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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&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;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;`snippet-text &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;className&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&amp;gt;&lt;/span&gt;&lt;span class="se"&gt;)&lt;/span&gt;&lt;span class="err"&gt;;
&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="c1"&gt;//Third Step&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;SnippetText&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;forwardRef&lt;/span&gt;&lt;span class="p"&gt;(&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;ref&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;
            &lt;span class="nx"&gt;ref&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;ref&lt;/span&gt;&lt;span class="p"&gt;}&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;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;`snippet-text &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;className&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&amp;gt;&lt;/span&gt;&lt;span class="se"&gt;)&lt;/span&gt;&lt;span class="err"&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;SnippetText&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;displayName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;SnippetText&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

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

&lt;/div&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="c1"&gt;//First Step&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Badge&lt;/span&gt; &lt;span class="o"&gt;=&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="nx"&gt;href&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="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="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;href&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;badge&lt;/span&gt;&lt;span class="dl"&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;children&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;/p&amp;gt;&lt;/span&gt;&lt;span class="err"&gt;;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;//Second Step&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Badge&lt;/span&gt; &lt;span class="o"&gt;=&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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
    &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&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="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;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;`badge &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;className&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; 
            &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/a&amp;gt;&lt;/span&gt;&lt;span class="se"&gt;)&lt;/span&gt;&lt;span class="sr"&gt;;&lt;/span&gt;&lt;span class="err"&gt; 
&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="c1"&gt;// Third Step&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Badge&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;forwardRef&lt;/span&gt;&lt;span class="p"&gt;(&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;ref&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&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;ref&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;ref&lt;/span&gt;&lt;span class="p"&gt;}&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;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;`badge &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;className&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; 
                &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
                &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/a&amp;gt;&lt;/span&gt;&lt;span class="se"&gt;)&lt;/span&gt;&lt;span class="sr"&gt;;&lt;/span&gt;&lt;span class="err"&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;Badge&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;displayName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Badge&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;  

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

&lt;/div&gt;



&lt;p&gt;The components above are just styled HTML elements. By extracting them, we save ourselves from the effort of typing more code than needed. They are not a big win but illustrate the process well.&lt;/p&gt;

&lt;p&gt;In step 1, we copy-paste the markup into its functional component;&lt;/p&gt;

&lt;p&gt;In step 2, we adapt the component to accept all kinds of props that an HTML paragraph or anchor can take;&lt;/p&gt;

&lt;p&gt;In step 3, we forward a reference (if any);&lt;/p&gt;

&lt;p&gt;Let's see more:&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="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;SnippetTitle&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;forwardRef&lt;/span&gt;&lt;span class="p"&gt;(&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;ref&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;Title&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;h5&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="p"&gt;(&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;ref&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;ref&lt;/span&gt;&lt;span class="p"&gt;}&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;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;`snippet-title &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;className&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;  
       &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; 
            &lt;span class="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="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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/Title&amp;gt;&lt;/span&gt;&lt;span class="err"&gt; 
&lt;/span&gt;        &lt;span class="o"&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="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="nx"&gt;SnippetTitle&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;displayName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;SnippetTitle&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;This is also a simple one - it's the clickable post title that leads to the full text. As you might notice, I've made it slightly more reusable by adding the "as" property. That way, the title is not always H5, and it no longer has to be a heading at all.&lt;/p&gt;

&lt;p&gt;And what about this one:&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="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;SnippetImgOverlay&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;forwardRef&lt;/span&gt;&lt;span class="p"&gt;(&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;ref&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;  
    &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="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;ref&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;ref&lt;/span&gt;&lt;span class="p"&gt;}&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;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;`snippet-img-overlay &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;className&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;   
            &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&amp;gt;&lt;/span&gt;&lt;span class="se"&gt;)&lt;/span&gt;&lt;span class="sr"&gt;; &lt;/span&gt;&lt;span class="err"&gt; 
&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="nx"&gt;SnippetImgOverlay&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;displayName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;SnippetImgOverlay&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;Here we extracted the container that holds the badge, the title, and the author's name. Now we can create an alternative element that doesn't make an overlay but places the three inner components below the image.&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="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;SnippetBody&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;forwardRef&lt;/span&gt;&lt;span class="p"&gt;(&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;ref&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;  
    &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="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;ref&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;ref&lt;/span&gt;&lt;span class="p"&gt;}&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;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;`snippet-body &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;className&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;   
            &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&amp;gt;&lt;/span&gt;&lt;span class="se"&gt;)&lt;/span&gt;&lt;span class="sr"&gt;; &lt;/span&gt;&lt;span class="err"&gt; 
&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="nx"&gt;SnippetBody&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;displayName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;SnippetBody&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;Nice. Now let's extract the featured images into their own 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="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;const&lt;/span&gt; &lt;span class="nx"&gt;SnippetImage&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;forwardRef&lt;/span&gt;&lt;span class="p"&gt;(&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;ref&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="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;src&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;alt&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;height&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;props&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;ref&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;ref&lt;/span&gt;&lt;span class="p"&gt;}&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;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;`snippet-img &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;  
            &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;img&lt;/span&gt;  
                &lt;span class="nx"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;src&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; 
                &lt;span class="nx"&gt;alt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;alt&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; 
                &lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; 
                &lt;span class="nx"&gt;height&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;height&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; 
             &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="nx"&gt;SnippetImage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;displayName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;SnippetImage&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;Ok, let's stop for a moment and put into use the new React goodies we've created.&lt;/p&gt;

&lt;p&gt;What would the first code snippet look like?&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="p"&gt;,&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="nx"&gt;useState&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;FeaturedPostsSection&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;posts&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setPosts&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;([]);&lt;/span&gt;

    &lt;span class="nf"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="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="s2"&gt;https://buhalbu.com/api/blog/featured&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="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;response&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="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;featuredPosts&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;setPosts&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;posts&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
            &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&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="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;section&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;blog-featured-posts&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;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;container&lt;/span&gt;&lt;span class="dl"&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;posts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(({&lt;/span&gt;&lt;span class="nx"&gt;slug&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;featuredMedia&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;category&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;author&lt;/span&gt;&lt;span class="p"&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;div&lt;/span&gt; &lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;slug&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;snippet&lt;/span&gt;&lt;span class="dl"&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;featuredMedia&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;SnippetImage&lt;/span&gt; 
                                &lt;span class="nx"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;featuredMedia&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="nx"&gt;alt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
                                &lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;428&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
                                &lt;span class="nx"&gt;height&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;285&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
                            &lt;span class="sr"&gt;/&amp;gt;}&lt;/span&gt;&lt;span class="err"&gt; 
&lt;/span&gt;                            &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;SnippetImgOverlay&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;Badge&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;category&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;/Badge&amp;gt;&lt;/span&gt;&lt;span class="err"&gt; 
&lt;/span&gt;                                &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;SnippetTitle&lt;/span&gt; &lt;span class="nx"&gt;href&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;path&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;title&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;/SnippetTitle&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;SnippetText&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;author&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;/SnippetText&amp;gt;&lt;/span&gt;&lt;span class="err"&gt; 
&lt;/span&gt;                            &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/SnippetImgOverlay&amp;gt;&lt;/span&gt;&lt;span class="err"&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="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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/section&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;It looks a lot better, doesn't it?&lt;/p&gt;

&lt;p&gt;But we can extract at least two more components: One named Snippet that will wrap all the other snippet parts and one called "Section" that will hold a set of snippets.&lt;/p&gt;

&lt;p&gt;Let's do it:&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="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Snippet&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;forwardRef&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;ref&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;ref&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;ref&lt;/span&gt;&lt;span class="p"&gt;}&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;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;snippet&lt;/span&gt;&lt;span class="dl"&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;children&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;span class="nx"&gt;Snippet&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;displayName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Snippet&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

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

&lt;/div&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="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Section&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;forwardRef&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;ref&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;section&lt;/span&gt; &lt;span class="nx"&gt;ref&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;ref&lt;/span&gt;&lt;span class="p"&gt;}&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="o"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
              &lt;span class="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="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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/section&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="nx"&gt;Section&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;displayName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Section&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;But why I'm creating this section component when I have FeaturedPostsSection?&lt;/p&gt;

&lt;p&gt;Well, I want to decouple the presentation logic from the business logic. You may already know that there are three general types of components: Container, Presentation, and Higher-Order Components.&lt;/p&gt;

&lt;p&gt;In our case, I'm extracting the JSX markup into its own functional component so it can be reused elsewhere.&lt;/p&gt;

&lt;p&gt;For example, suppose I don't want to feature on my homepage blog posts but on website pages. In that case, I can create a new container component named "FeaturedPagesSection" and put all the other stuff we made without substantial changes.&lt;/p&gt;

&lt;p&gt;Let's see the final result of our work:&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="p"&gt;,&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="nx"&gt;useState&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;FeaturedPostsSection&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;posts&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setPosts&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;([]);&lt;/span&gt;

    &lt;span class="nf"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="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="s2"&gt;https://buhalbu.com/api/blog/featured&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="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;response&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="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;featuredPosts&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;setPosts&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;featuredPosts&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
            &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&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="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;Section&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;blog-featured-posts&lt;/span&gt;&lt;span class="dl"&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;posts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(({&lt;/span&gt;&lt;span class="nx"&gt;slug&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;featuredMedia&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;category&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;author&lt;/span&gt;&lt;span class="p"&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;Snippet&lt;/span&gt; &lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;slug&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;featuredMedia&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;SnippetImage&lt;/span&gt; 
                                &lt;span class="nx"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;featuredMedia&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="nx"&gt;alt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
                                &lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;428&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
                                &lt;span class="nx"&gt;height&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;285&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
                            &lt;span class="sr"&gt;/&amp;gt;}&lt;/span&gt;&lt;span class="err"&gt; 
&lt;/span&gt;                            &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;SnippetImgOverlay&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;Badge&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;category&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;/Badge&amp;gt;&lt;/span&gt;&lt;span class="err"&gt; 
&lt;/span&gt;                                &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;SnippetTitle&lt;/span&gt; &lt;span class="nx"&gt;href&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;path&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;title&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;/SnippetTitle&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;SnippetText&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;author&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;/SnippetText&amp;gt;&lt;/span&gt;&lt;span class="err"&gt; 
&lt;/span&gt;                            &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/SnippetImgOverlay&amp;gt;&lt;/span&gt;&lt;span class="err"&gt; 
&lt;/span&gt;                        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/Snippet&amp;gt;&lt;/span&gt;&lt;span class="err"&gt; 
&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;/Section&amp;gt;&lt;/span&gt;&lt;span class="err"&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;Well, that looks fine for now. It's better than the initial code snippet. Maybe, in the feature, we'll need to improve it, but I consider it "good enough."&lt;/p&gt;

&lt;h2&gt;
  
  
  Brief Overview of The Applied Principles
&lt;/h2&gt;

&lt;p&gt;So it took us 20 or 30 minutes more to transform a bad first draft into something that will make our life easier in the future.&lt;/p&gt;

&lt;p&gt;Why?&lt;/p&gt;

&lt;p&gt;Because we have got a couple of ready-for-reuse components, meaning we will write less code to achieve similar results. And all of them allow easier further improvements.&lt;br&gt;
We put into use three general principles:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Separation of Concerns - We split the big component into several others of three types: Container, Presentation, and Higher-Order Components.&lt;/li&gt;
&lt;li&gt;From Specific to Abstract - We climbed one or two steps up on the ladder of Abstraction, meaning we took some ultra-specific components (PostSnippetTitle, FeaturedPostsSection) and made them more abstract (SnippetTitle, Section), that way we can use them with different content entities (Posts, Pages, Products, Services)&lt;/li&gt;
&lt;li&gt;Flatten Props - We chose to pass data through stand-alone properties and not as plain objects, that way, you know at first glance what data the component needs, and it's more convenient.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I hope you liked this tutorial. Please don't hesitate to ask in the comment section below if you have any questions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Want to Connect?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you enjoyed this article, there is some chance to enjoy the other free stuff I write &lt;a href="https://buhalbu.com/" rel="noopener noreferrer"&gt;on advanced JavaScript topics for my newsletter&lt;/a&gt;, too.&lt;/p&gt;

&lt;p&gt;Check it out :)&lt;/p&gt;

</description>
      <category>gratitude</category>
      <category>integrations</category>
    </item>
    <item>
      <title>What If “Burning Out” Is Our Soul Crying For Adventure?</title>
      <dc:creator>Sashe V.</dc:creator>
      <pubDate>Sat, 07 Jan 2023 11:19:38 +0000</pubDate>
      <link>https://dev.to/sashevuchkov/what-if-burning-out-is-our-soul-crying-for-adventure-1ll</link>
      <guid>https://dev.to/sashevuchkov/what-if-burning-out-is-our-soul-crying-for-adventure-1ll</guid>
      <description>&lt;p&gt;Dear Javascript Aficionado,&lt;/p&gt;

&lt;p&gt;Do you feel bored sometimes when you follow your daily routine?&lt;/p&gt;

&lt;p&gt;Work — Party — Sleep… Work -Party — Sleep…&lt;/p&gt;

&lt;p&gt;That’s one hell of a cycle!&lt;/p&gt;

&lt;p&gt;And if you’re a family guy or hard-core introvert, then probably the middle of this cycle is missing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;So it becomes even more monotonous…&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;There is no surprise that so many of us fall victim to this nasty condition, “burnout.” And it’s no joke… I’m “lucky” to experience its gray nuances and depressing feelings somewhat more frequently than average, so I know it’s no joke.&lt;/p&gt;

&lt;p&gt;In the past, it made me do things I still regret, like quitting a fantastic job or leaving behind a profession just before it starts paying off big.&lt;/p&gt;

&lt;p&gt;So I had to find a way to counter this condition. And counter it before the slightest sign of its symptoms.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;And I found many!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I found a plethora of ways to keep myself on track. They help me finish big projects, persist in my long-term goals, and live a hundred times more exciting life than before.&lt;/p&gt;

&lt;p&gt;We’re not talking about extreme sports, screwing around, or substance abuse, though (in my opinion, constantly drinking beer or whisky is not a productive way to save yourself from burnout).&lt;/p&gt;

&lt;p&gt;Anyway…&lt;/p&gt;

&lt;p&gt;I mention one of my latest “remedies” in my newsletter article &lt;a href="https://buhalbu.com/stream/roadmap-to-success-3-lessons-i-learned-from-61-of-the-most-influential-javascript-developers" rel="noopener noreferrer"&gt;“Roadmap to Success: 3 lessons I learned from 61 of the most influential JavaScript developers”&lt;/a&gt;. Almost all 61 developers practice it (83.6% of the researched ones). And even the thought of it can shake your whole body.&lt;/p&gt;

&lt;p&gt;Imagine how intense it can be when it happens for real.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;And that’s not the only benefit…&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It offers traveling to exotic destinations (sometimes for free), meeting lots of interesting, smart, sexy people, and true challenges that the crowd may talk about for years.&lt;/p&gt;

&lt;p&gt;What’s best — all this involves web development.&lt;/p&gt;

&lt;p&gt;I have yet to experience this kind of adventure on a big scale. It’s not something you can do when you decide to do it. You need to prepare yourself. You need time and many additional skills. But that’s precisely why it is so exciting.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It’s part of the game…&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;What game?&lt;/p&gt;

&lt;p&gt;The public speaking and presenting on JS events &amp;amp; conferences game, of course ;)&lt;/p&gt;

&lt;p&gt;It really can be that fun!&lt;/p&gt;

&lt;p&gt;What do you think? Can this reignite once again the passion for JavaScript development?&lt;/p&gt;

&lt;p&gt;Be Happy,&lt;br&gt;
Sashe&lt;/p&gt;

</description>
      <category>watercooler</category>
    </item>
    <item>
      <title>Should You Focus on JavaScript or WordPress?</title>
      <dc:creator>Sashe V.</dc:creator>
      <pubDate>Sun, 23 Oct 2022 18:09:02 +0000</pubDate>
      <link>https://dev.to/sashevuchkov/should-you-focus-on-javascript-or-wordpress-397b</link>
      <guid>https://dev.to/sashevuchkov/should-you-focus-on-javascript-or-wordpress-397b</guid>
      <description>&lt;p&gt;It depends on your preference...&lt;/p&gt;

&lt;p&gt;I have been focusing on JavaScript for the past 2 years, and I'm totally satisfied with my decision to switch from PHP/WordPress to JavaScript/React.Js/Next.Js.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Don't get me wrong!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I really love PHP and WordPress... I built many awesome projects with these technologies. Still, before I switched, I was constantly worrying about PHP losing ground as a preferred backend choice.&lt;br&gt;
This programming language is strongly specialized for server-side scripting.&lt;/p&gt;

&lt;p&gt;And it constantly gets improved...&lt;/p&gt;

&lt;p&gt;The thing is, many other languages like (Node.js/Python/Golang) have entered the competition in that area and are stealing market share. If you check PHP in Google Trends, you will notice it's losing popularity.&lt;/p&gt;

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

&lt;p&gt;On the other hand, some people say WordPress powers nearly 40% of all websites. So there are many opportunities here: from making and optimizing websites to distributing themes and plugins.&lt;/p&gt;

&lt;p&gt;You will never be hungry if you become a decent WordPress developer.&lt;/p&gt;

&lt;p&gt;Moreover, as more and more people hop on the JavaScript and Python "bandwagons," there will be increased demand for PHP developers, and the salaries will start growing.&lt;/p&gt;

&lt;p&gt;But bear in mind that not many cool projects use those technologies. You will handle a lot of legacy code, and the "wp style" of coding is uber quirky. It still needs to catch up with the PHP Standard Recommendations (PSR), any proper OOP concepts, etc.&lt;/p&gt;

&lt;p&gt;So if you want to write modern, clean code for a rising startup... using a programming language on the crest of the wave...&lt;/p&gt;

&lt;p&gt;Then WordPress shouldn't be your primary focus.&lt;/p&gt;

&lt;p&gt;You should focus on JavaScript…&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>beginners</category>
      <category>wordpress</category>
    </item>
    <item>
      <title>Next.Js Security: Ooh, You Aren’t Supposed To Access That</title>
      <dc:creator>Sashe V.</dc:creator>
      <pubDate>Fri, 14 Oct 2022 05:43:57 +0000</pubDate>
      <link>https://dev.to/sashevuchkov/nextjs-security-ooh-you-arent-supposed-to-access-that-1fl4</link>
      <guid>https://dev.to/sashevuchkov/nextjs-security-ooh-you-arent-supposed-to-access-that-1fl4</guid>
      <description>&lt;p&gt;Dear Next.js Afficionado,&lt;/p&gt;

&lt;p&gt;Are you aware that there are bad people who make money by getting access to expensive stuff like online courses, software, etc., and later reselling them for peanuts?&lt;/p&gt;

&lt;p&gt;What shm**ks, right?&lt;/p&gt;

&lt;p&gt;So if you have valuable files that you want to give away to subscribers or customers only, then you need to protect those files.&lt;/p&gt;

&lt;p&gt;For example, let’s say your employer creates a detailed guide that helps the customers solve a specific problem. They want to put this guide on the website and collect emails in exchange for it.&lt;/p&gt;

&lt;p&gt;So how do you stop the bad actors from getting its URL and putting it on social media, blogs, forums, and other public online places?&lt;/p&gt;

&lt;p&gt;That’s the topic of my newsletter this week…&lt;/p&gt;

&lt;p&gt;I wrote for a similar use case where I needed to restrict access to &lt;a href="https://buhalbu.com/nextjs/templates/nextjs-portfolio-template"&gt;a free template&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;So if you are interested, &lt;a href="https://buhalbu.com/nextjs/issues/nextjs-download-file"&gt;click here and discover&lt;/a&gt; the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Three feasible ways to protect a file&lt;/li&gt;
&lt;li&gt;How to choose the proper protection&lt;/li&gt;
&lt;li&gt;Lots of code snippets&lt;/li&gt;
&lt;li&gt;Why you should never put valuable files in Next.Js’ public folder&lt;/li&gt;
&lt;li&gt;What’s a “signed URL,” and when it’s useful&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This newsletter issue almost hits the 1000-word mark, so if you’re not in the mood for heavy reading… don’t have time… or opened this email on your smartphone, then you can bookmark it for later.&lt;/p&gt;

&lt;p&gt;It’s not super urgent. Just the &lt;a href="https://buhalbu.com/nextjs/issues/nextjs-download-file"&gt;typical stuff&lt;/a&gt; every geek likes to read about.&lt;/p&gt;

&lt;p&gt;Be happy,&lt;br&gt;
Sashe Vuchkov&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>javascript</category>
      <category>typescript</category>
      <category>security</category>
    </item>
    <item>
      <title>Next.Js Crowd: See Who Talks About The React Framework</title>
      <dc:creator>Sashe V.</dc:creator>
      <pubDate>Fri, 26 Aug 2022 12:50:00 +0000</pubDate>
      <link>https://dev.to/sashevuchkov/nextjs-crowd-see-who-talks-about-the-react-framework-5dpi</link>
      <guid>https://dev.to/sashevuchkov/nextjs-crowd-see-who-talks-about-the-react-framework-5dpi</guid>
      <description>&lt;h3&gt;
  
  
  Overview of Next.Js Crowd
&lt;/h3&gt;

&lt;p&gt;It's an app that monitors Twitter for users who mention the react framework Next.js. It constantly collects tweets and user data, creates curious stats and then rank them by a "Score".&lt;/p&gt;

&lt;p&gt;Every elligible tweet, user or stat JSON document is recorded in a Redis database. Later, when a visitor opens the app, it fetches those documents to show them. &lt;/p&gt;

&lt;p&gt;You can find &lt;a href="https://github.com/SasheVuchkov/nextjs-crowd"&gt;the repo here&lt;/a&gt;...&lt;/p&gt;

&lt;p&gt;You can find a working demo of the app here:&lt;br&gt;
&lt;a href="https://nextjs.buhalbu.com"&gt;https://nextjs.buhalbu.com&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  What technologies did we use to build it?
&lt;/h3&gt;

&lt;p&gt;We used TypeScript, Next.Js, and Redis, as well as HTML and CSS for the front-end part. &lt;/p&gt;

&lt;p&gt;Here's a diagram of the architecture:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--treVggzy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jwm833ij698yyscn0ots.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--treVggzy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jwm833ij698yyscn0ots.jpg" alt="Diagram" width="880" height="815"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So the app works in two primary modes. We have a scheduled job that emits messages every two minutes. Our app listens for those messages, and on every message, it "asks" Twitter whether there are new tweets with the desired keyword next.js.&lt;/p&gt;

&lt;p&gt;If there aren't any new tweets, then everything is cool, and that's the end of the story.&lt;/p&gt;

&lt;p&gt;If there are new tweets, the app processes them by mapping their data to our internal data types, and it calculates their "scores" that it later uses to rank them by popularity.&lt;/p&gt;

&lt;p&gt;In the next step, the new data is saved in a Redis Database as documents. We use the awesome RedisJSON module.&lt;/p&gt;

&lt;p&gt;Then the app gets a JSON document from Redis with the current day's general stats. It updates those stats and saves them.&lt;/p&gt;

&lt;p&gt;That's the final step.&lt;/p&gt;

&lt;p&gt;In the second mode, the app is accessible on the web. When a web visitor opens it with their browser, it fetches data from our Redis database, generates the response, and then sends it back to the browser.&lt;/p&gt;

&lt;p&gt;Now the web visitor can see either a list of ranked Twitter users or a list of ranked tweets.&lt;/p&gt;
&lt;h3&gt;
  
  
  Submission Category:
&lt;/h3&gt;

&lt;p&gt;MEAN/MERN Mavericks&lt;/p&gt;
&lt;h3&gt;
  
  
  App Video Overvew
&lt;/h3&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/QDa-ZEHurxA"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h3&gt;
  
  
  Language Used
&lt;/h3&gt;

&lt;p&gt;JS/TS/Node.js&lt;/p&gt;

&lt;h3&gt;
  
  
  Link to Code
&lt;/h3&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--566lAguM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/SasheVuchkov"&gt;
        SasheVuchkov
      &lt;/a&gt; / &lt;a href="https://github.com/SasheVuchkov/nextjs-crowd"&gt;
        nextjs-crowd
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      NextJs Crowd monitors Twitter for users that mention the react framework Next.js and it shows some daily stats like "top users", "top tweets", etc
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;h1&gt;
Next.Js Crowd - Who's Talking About Next.Js?&lt;/h1&gt;
&lt;p&gt;It's a simple app that monitors Twitter and detects users that mention the react framework Next.js. The point is to collect all their tweets, process their public metrics like the number of likes, retweets, and replies, and finally, rank the discovered users by a score.&lt;/p&gt;
&lt;p&gt;&lt;a rel="noopener noreferrer" href="https://camo.githubusercontent.com/645bf47d7a385081d35b6b1ca59a9f2a99eb1ab02b84ade4662c625036c23c00/68747470733a2f2f6e6578746a732e627568616c62752e636f6d2f696d616765732f6e6578746a732d63726f77642d73637265656e73686f74312e6a7067"&gt;&lt;img src="https://camo.githubusercontent.com/645bf47d7a385081d35b6b1ca59a9f2a99eb1ab02b84ade4662c625036c23c00/68747470733a2f2f6e6578746a732e627568616c62752e636f6d2f696d616765732f6e6578746a732d63726f77642d73637265656e73686f74312e6a7067" alt="App's Top Users Screen"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a rel="noopener noreferrer" href="https://camo.githubusercontent.com/a673b0bacd2996eae82d715b77bf0c0d90c72339be5b92271cd00b2eb757368b/68747470733a2f2f6e6578746a732e627568616c62752e636f6d2f696d616765732f6e6578746a732d63726f77642d73637265656e73686f74322e6a7067"&gt;&lt;img src="https://camo.githubusercontent.com/a673b0bacd2996eae82d715b77bf0c0d90c72339be5b92271cd00b2eb757368b/68747470733a2f2f6e6578746a732e627568616c62752e636f6d2f696d616765732f6e6578746a732d63726f77642d73637265656e73686f74322e6a7067" alt="App's Top Tweets Screen"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a rel="noopener noreferrer" href="https://camo.githubusercontent.com/16b6025f6f13ccab07227a8108d350bc38861e169345ae44b49ff43fee7f7c09/68747470733a2f2f6e6578746a732e627568616c62752e636f6d2f696d616765732f6e6578746a732d63726f77642d73637265656e73686f74332e6a7067"&gt;&lt;img src="https://camo.githubusercontent.com/16b6025f6f13ccab07227a8108d350bc38861e169345ae44b49ff43fee7f7c09/68747470733a2f2f6e6578746a732e627568616c62752e636f6d2f696d616765732f6e6578746a732d63726f77642d73637265656e73686f74332e6a7067" alt="App's About Screen"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;
Overview video (Optional)&lt;/h1&gt;
&lt;p&gt;Here's a short video that explains the project and how it uses Redis:&lt;/p&gt;
&lt;p&gt;[Insert your own video here, and remove the one below]&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=QDa-ZEHurxA" rel="nofollow"&gt;&lt;img src="https://camo.githubusercontent.com/c1fd7eda9ba8fda59ace13c0c46300dff9017fa7d02d2687033db52fd20d9407/68747470733a2f2f692e7974696d672e636f6d2f76692f5144612d5a4548757278412f6d617872657364656661756c742e6a7067" alt="Embed your YouTube video"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
How it works&lt;/h2&gt;
&lt;p&gt;So the app works in two primary modes. We have a scheduled job that emits messages every two minutes. Our app listens for those messages, and on every message, it "asks" Twitter whether there are new tweets with the desired keyword next.js.&lt;/p&gt;
&lt;p&gt;If there aren't any new tweets, then everything is cool, and that's the end of the story.&lt;/p&gt;
&lt;p&gt;If there are new tweets, the app processes them by…&lt;/p&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/SasheVuchkov/nextjs-crowd"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;h3&gt;
  
  
  Additional Resources / Info
&lt;/h3&gt;

&lt;p&gt;TypeScript - JavaScript with syntax for types.&lt;br&gt;
&lt;a href="https://www.typescriptlang.org/"&gt;https://www.typescriptlang.org/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next.Js - The React Framework&lt;br&gt;
&lt;a href="https://github.com/vercel/next.js/"&gt;https://github.com/vercel/next.js/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;React.Js - A declarative, efficient, and flexible JavaScript library for building user interfaces.&lt;br&gt;
&lt;a href="https://github.com/facebook/react"&gt;https://github.com/facebook/react&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Bootstrap5 - world’s most popular framework for building responsive, mobile-first sites, with jsDelivr and a template starter page.&lt;br&gt;
&lt;a href="https://getbootstrap.com/"&gt;https://getbootstrap.com/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;twitter-api-sdk - A TypeScript SDK for the Twitter API&lt;br&gt;
&lt;a href="https://github.com/twitterdev/twitter-api-typescript-sdk"&gt;https://github.com/twitterdev/twitter-api-typescript-sdk&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Redis Om for Node - Object mapping, and more, for Redis and Node.js. Written in TypeScript.&lt;br&gt;
&lt;a href="https://github.com/redis/redis-om-node"&gt;https://github.com/redis/redis-om-node&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Feather – Simply beautiful open source icons&lt;br&gt;
&lt;a href="https://feathericons.com/"&gt;https://feathericons.com/&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  App Screenshots
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--J6xfJ5Q4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://nextjs.buhalbu.com/images/nextjs-crowd-screenshot1.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--J6xfJ5Q4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://nextjs.buhalbu.com/images/nextjs-crowd-screenshot1.jpg" alt="App's Top Users Screen" width="880" height="473"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--GELxdL_H--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://nextjs.buhalbu.com/images/nextjs-crowd-screenshot2.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GELxdL_H--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://nextjs.buhalbu.com/images/nextjs-crowd-screenshot2.jpg" alt="App's Top Tweets Screen" width="880" height="471"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5uc31Ahv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://nextjs.buhalbu.com/images/nextjs-crowd-screenshot3.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5uc31Ahv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://nextjs.buhalbu.com/images/nextjs-crowd-screenshot3.jpg" alt="App's About Screen" width="880" height="471"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Collaborators
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://dev.to/chinwendu20"&gt;Maureen Ononiwu&lt;/a&gt;, backend developer&lt;br&gt;
&lt;a href="https://dev.to/chinwendu20"&gt;https://dev.to/chinwendu20&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/sashevuchkov"&gt;Sashe Vuchkov&lt;/a&gt;, full-stack developer&lt;br&gt;
&lt;a href="https://dev.to/sashevuchkov"&gt;https://dev.to/sashevuchkov&lt;/a&gt;&lt;/p&gt;




&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Check out &lt;a href="https://redis.io/docs/stack/get-started/clients/#high-level-client-libraries"&gt;Redis OM&lt;/a&gt;, client libraries for working with Redis as a multi-model database.&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Use &lt;a href="https://redis.info/redisinsight"&gt;RedisInsight&lt;/a&gt; to visualize your data in Redis.&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Sign up for a &lt;a href="https://redis.info/try-free-dev-to"&gt;free Redis database&lt;/a&gt;.&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>redishackathon</category>
      <category>nextjs</category>
      <category>typescript</category>
      <category>react</category>
    </item>
    <item>
      <title>Introducing Next.Js Crowd</title>
      <dc:creator>Sashe V.</dc:creator>
      <pubDate>Wed, 10 Aug 2022 15:35:00 +0000</pubDate>
      <link>https://dev.to/sashevuchkov/introducing-nextjs-crowd-j5a</link>
      <guid>https://dev.to/sashevuchkov/introducing-nextjs-crowd-j5a</guid>
      <description>&lt;p&gt;Hi :)&lt;/p&gt;

&lt;p&gt;"Next.Js Crowd" is our (Maureen Ononiwu &amp;amp; Sashe Vuchkov) hackathon app we're building for RedisHackathon. &lt;/p&gt;

&lt;p&gt;It monitors Twitter for users that mention the react framework Next.js and shows some daily stats like "top users," "top tweets," etc.&lt;/p&gt;

&lt;p&gt;Here's a small demo of the interface:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=dgFq72X7mio"&gt;https://www.youtube.com/watch?v=dgFq72X7mio&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/dgFq72X7mio"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;You can follow the making of the app by watching this GitHub repo:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/SasheVuchkov/nextjs-crowd"&gt;https://github.com/SasheVuchkov/nextjs-crowd&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Cheers,&lt;br&gt;
Sashe Vuchkov&lt;/p&gt;

</description>
      <category>redishackathon</category>
      <category>redis</category>
      <category>node</category>
      <category>nextjs</category>
    </item>
    <item>
      <title>Setting Up a Next.Js Project The Proper Way</title>
      <dc:creator>Sashe V.</dc:creator>
      <pubDate>Mon, 01 Aug 2022 15:31:00 +0000</pubDate>
      <link>https://dev.to/sashevuchkov/setting-up-a-nextjs-project-the-proper-way-49lb</link>
      <guid>https://dev.to/sashevuchkov/setting-up-a-nextjs-project-the-proper-way-49lb</guid>
      <description>&lt;p&gt;//Note: &lt;a href="https://youtu.be/QeHuj0Twn7E"&gt;Watch the video here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Dear Next.Js Aficionado,&lt;/p&gt;

&lt;p&gt;Until now, we’ve talked about what your portfolio website should look like and that web developers aren’t web designers, so they need ready-to-use templates if they want to create something beautiful.&lt;/p&gt;

&lt;p&gt;We analyzed some examples of good portfolio websites and chose an HTML template or UI kit.&lt;/p&gt;

&lt;p&gt;Now, it’s time to set up our project.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing Next.Js Fast &amp;amp; Easily
&lt;/h2&gt;

&lt;p&gt;Hopefully, the guys behind this framework have made it super easy for us to install it and get going.&lt;/p&gt;

&lt;p&gt;We just open a new terminal, navigate to the parent folder where we would like to create our project, and we run the following command:&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npx create-next-app@latest&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ABxAZsU9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8iykzcvsmpj882nl1dng.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ABxAZsU9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8iykzcvsmpj882nl1dng.jpg" alt="Screenshot of installed Next.js" width="880" height="495"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ok, let’s open the project in our favorite code editor.&lt;/p&gt;

&lt;p&gt;As you can see, we have several files and folders in the project folder.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;I’m going to review them briefly…&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;First, we have a &lt;code&gt;node_modules&lt;/code&gt; folder. It’s the home of all the third-party libraries we will install in the future. Every time you install something – let’s say caching library for optimizing the number of requests your app makes to external API – the library files will be downloaded and saved in their folder under &lt;code&gt;node_modules&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--izfa8Nkw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bad657599ji7gaxizj5n.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--izfa8Nkw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bad657599ji7gaxizj5n.jpg" alt="Next.js project structure" width="880" height="494"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, there’s a folder named &lt;code&gt;public&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;It’s the preferred place for all the files we want to be freely accessible.&lt;/p&gt;

&lt;p&gt;For security reasons, we want most of our project files not to be freely accessible. But some static ones like images, SVG graphics, fonts, and others are meant to be public, so their proper place is in this folder.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;We also have a folder named &lt;code&gt;styles&lt;/code&gt;…&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here is the home for all of our CSS files. There’s a globals.css in there. Here we put styles that apply to many components and the app. And, of course, we can create a CSS file for every component we make.&lt;/p&gt;

&lt;p&gt;And finally, we have the &lt;code&gt;pages&lt;/code&gt; folder…&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vDx40BhH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/psp5bzdgthhlesmpbrtt.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vDx40BhH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/psp5bzdgthhlesmpbrtt.jpg" alt="The contents of next.js pages folder" width="880" height="497"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here we put all files that represent individual pages of our website. So our website’s index page is this one. If we open it, we’ll discover a standard react component named Home. &lt;/p&gt;

&lt;p&gt;If we want to make an “about me” page, we can do it by creating a new javascript file named &lt;code&gt;about-me.js&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Now, if we run the application for testing purposes with npm run dev…&lt;/p&gt;

&lt;p&gt;We can open that page in our browser.&lt;/p&gt;

&lt;p&gt;In a later video, we will talk more about how routing happens in Next.js, but it’s simple as that. You create files that represent pages, and they just start working in your browser.&lt;/p&gt;

&lt;h2&gt;
  
  
  Short Review Of The Project’s Files
&lt;/h2&gt;

&lt;p&gt;Ok, we’ve talked about the available folders. Let’s review the available files for a minute.&lt;/p&gt;

&lt;p&gt;We have a &lt;code&gt;yarn.lock&lt;/code&gt; file. It’s generated by the javascript package manager Yarn — obviously, this package manager is the preferred choice of the guys behind Next.js.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5f-r2W7i--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/83cnqrxhxjosxyq0qao8.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5f-r2W7i--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/83cnqrxhxjosxyq0qao8.jpg" alt="The contents of next.js yarn.lock file" width="880" height="496"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let’s install it and start using it instead of npm.&lt;/p&gt;

&lt;p&gt;We run the command: &lt;code&gt;npm install -g yarn&lt;/code&gt;. I already have it installed, so nothing changed on my side. But if you didn’t have it on your computer, now it’s available.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;We’ll use yarn from now on.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;So the yarn.lock file is a special file that we never edit. It’s managed by the package manager, and it holds information about the third-party libraries we’ve installed, their dependencies, and their exact versions.&lt;/p&gt;

&lt;p&gt;The idea is that if we want to run our app on a machine different than ours, let’s say on a server; then we’ll copy all app’s files and folders except &lt;code&gt;node_modules&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Often this folder is huge. It is huge in size and the number of files, so if every project on a platform like GitHub has it around, it will need more storage space.&lt;/p&gt;

&lt;p&gt;Because the files there don’t change from project to project, they don’t get uploaded.&lt;/p&gt;

&lt;p&gt;Instead, every time we install our app on a new machine, they get downloaded anew.&lt;/p&gt;

&lt;p&gt;To download the exact same files, we need a list of them; thus, we have a &lt;code&gt;yarn.lock&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Besides it, we have a &lt;code&gt;packge.json&lt;/code&gt; file. It’s something like a human-readable register of all project dependencies. Here we define the project’s name, version, and custom scripts, etc…&lt;/p&gt;

&lt;h2&gt;
  
  
  Let’s talk about them for a moment…
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--G1UyiGmu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c2eowdpz1s6g5y9dzb9q.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--G1UyiGmu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c2eowdpz1s6g5y9dzb9q.jpg" alt="The contents of next.js package.json file" width="880" height="497"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If our app is ready to go online, we need to build it, so we run the command:&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;yarn build&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;It starts to bundle the files, minify them, and do its other magic that makes Next.Js such a good React framework.&lt;/p&gt;

&lt;p&gt;When it’s finished building, we can start the app just like it will be started in a production environment by running the command:&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;yarn start&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;But while we’re developing our app, we’ll not build it if we want it running.&lt;/p&gt;

&lt;p&gt;We’ll use the command:&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;yarn dev&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Now we can make changes, create new files and apply new CSS styles, and everything we do will be visible in the browser right away, thanks to the so-called “hot-reload” feature of Next.js.&lt;/p&gt;

&lt;h2&gt;
  
  
  And what about the script named “lint”?
&lt;/h2&gt;

&lt;p&gt;It’s a really useful one. But what is it?&lt;/p&gt;

&lt;p&gt;“Linting” your code is the automated process of analyzing it for obvious errors that can be detected without running it. Some errors happen only on run time, so no machine can notice them beforehand, but others can be caught just by mechanically applying the language’s rules.&lt;/p&gt;

&lt;p&gt;So when you run the command &lt;code&gt;yarn lint&lt;/code&gt;, your code gets analyzed for warnings and errors. Let’s see what happens if there is an error…&lt;/p&gt;

&lt;p&gt;I will add an anchor, but I will miss on purpose to properly close the tag.&lt;/p&gt;

&lt;p&gt;Then I will run the command…&lt;/p&gt;

&lt;p&gt;As you can see, it successfully detected the missing closing tag.&lt;/p&gt;

&lt;p&gt;If you’re curious about the rules, you can find them all &lt;a href="https://nextjs.org/docs/basic-features/eslint"&gt;on this documentation page&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Ok, enough discussing the &lt;code&gt;package.json&lt;/code&gt; file.&lt;/p&gt;

&lt;h2&gt;
  
  
  What about next.config.js?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ozBd-mQH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/diuljhqoswkefpde46i5.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ozBd-mQH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/diuljhqoswkefpde46i5.jpg" alt="The contents of next.config.js" width="880" height="497"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It’s a js file that holds configs related to Next.js.&lt;/p&gt;

&lt;p&gt;I not gonna tell you what you can put here because you won’t remember it. I don’t remember myself.&lt;/p&gt;

&lt;p&gt;Basically, if you need to configure the framework in some specific way, you read the official documentation.&lt;/p&gt;

&lt;p&gt;Right now, we don’t need to change anything, so we’ll leave this file unchanged.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;.eslintrc.json&lt;/code&gt; file is the place to configure ESLint. For example, let’s say you want a style tag in your component. A rule states you can’t put it there, but you can turn it off by adding it right here with a value of “off.”&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0mekbbDA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yxql78hy6iok39m3f9dt.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0mekbbDA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yxql78hy6iok39m3f9dt.jpg" alt="The contents of next.js .eslintrc.json" width="880" height="495"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And finally, we have a &lt;code&gt;README.md&lt;/code&gt;. It’s self explementary what we use it for, so I won’t waste time talking about it. If your repository is not public, perhaps you don’t need such a file.&lt;/p&gt;

&lt;p&gt;Ok, that’s it…&lt;/p&gt;

&lt;p&gt;It turns out it’s pretty easy to install Next.js and start coding. That’s why I love it and use it for almost every project. In the following video, we will finally begin coding. We’ll take the HTML template we chose earlier and turn it into a Next.Js template.&lt;/p&gt;

&lt;p&gt;Let’s wrap up this section:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;We installed Next.Js and the package manager yarn&lt;/li&gt;
&lt;li&gt;We reviewed the project structure – its folders and files&lt;/li&gt;
&lt;li&gt;And we talked about the available scripts in package.json&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Cheers,&lt;br&gt;
Sashe Vuchkov&lt;/p&gt;

&lt;p&gt;PS. This tutorial was originally published on &lt;a href="https://buhalbu.com/stream/next-js-project"&gt;buhalbu.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>react</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>A Shortcut To A Superb Portfolio Website With Next.Js</title>
      <dc:creator>Sashe V.</dc:creator>
      <pubDate>Tue, 26 Jul 2022 12:59:00 +0000</pubDate>
      <link>https://dev.to/sashevuchkov/a-shortcut-to-a-superb-portfolio-website-with-nextjs-1753</link>
      <guid>https://dev.to/sashevuchkov/a-shortcut-to-a-superb-portfolio-website-with-nextjs-1753</guid>
      <description>&lt;p&gt;//Note: &lt;a href="https://www.youtube.com/watch?v=Och4u8N_qb0"&gt;Get the video version of this section&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Dear Next.Js Aficionado,&lt;/p&gt;

&lt;p&gt;I know you can’t wait to start coding. In the end, we’re web developers, and we love doing it.&lt;/p&gt;

&lt;p&gt;And yet, here we are…&lt;/p&gt;

&lt;p&gt;This tutorial is the third installment of my series for building a superb portfolio website, and I still don’t have an intention to make you open your favorite code editor.&lt;/p&gt;

&lt;h2&gt;
  
  
  We’ll do that the next time…
&lt;/h2&gt;

&lt;p&gt;When we’ll set up our Next.Js project for success.&lt;/p&gt;

&lt;p&gt;But now I want to talk with you about one common big mistake. It’s so widespread that even sessional professionals fall victim to it no matter their high achievements or years of experience.&lt;/p&gt;

&lt;p&gt;Once they go for their own website, often they create something ultra-functional and well-coded, but something with…&lt;/p&gt;

&lt;h2&gt;
  
  
  ZERO marketing or design value
&lt;/h2&gt;

&lt;p&gt;That happens because we like to think of ourselves as extraordinary guys who can handle every possible challenge related to web development.&lt;/p&gt;

&lt;p&gt;But that’s far from the truth…&lt;/p&gt;

&lt;p&gt;We’re web developers, but we aren’t DevOps engineers, web designers, UX experts, SEO specialists, etc.&lt;/p&gt;

&lt;p&gt;So by trying to be one of these, too – web designers, for example, we’re making a big mistake that leads to a not-so-visual-appealing website. Not that the world has never seen a specialist who is both a web developer and a web designer, but most often, that’s not the case.&lt;/p&gt;

&lt;p&gt;That’s not the case when we’re talking about me…&lt;/p&gt;

&lt;p&gt;And if that’s not the case when we’re talking about YOU, then we must approach the design challenge more strategically…&lt;/p&gt;

&lt;h2&gt;
  
  
  How To Approach The Design Challenge More Strategically
&lt;/h2&gt;

&lt;p&gt;We’ll use a template!&lt;/p&gt;

&lt;p&gt;Now, there is a fad to search for a template that matches your choice of technology. For example, “react templates,” “nextjs templates,” and so on.&lt;/p&gt;

&lt;p&gt;You should know that a template advertised like created for Next.Js can often have a low code quality. It’s beautiful, but it’s not appropriately sliced into components and pages, so you will need to do a lot of refactoring.&lt;/p&gt;

&lt;p&gt;It’s better to get an “HTML template” or “UI Kit”…&lt;/p&gt;

&lt;p&gt;If you have some dollars to spend, I advise you to do it. The Internet is full of free templates, and you can definitely find something worthy (after a lot of browsing), but you’ll have a way bigger choice if you go the paid route.&lt;/p&gt;

&lt;h2&gt;
  
  
  Anyway…
&lt;/h2&gt;

&lt;p&gt;I will use a free HTML template.&lt;/p&gt;

&lt;p&gt;I liked the one named “Ollie” on &lt;a href="https://www.free-css.com/free-css-templates?start=24"&gt;page 3 of free-css.com&lt;/a&gt;. It’s not quite what I need as a website structure, but I like it as a visual appeal.&lt;/p&gt;

&lt;p&gt;So I’ll use its visual appeal and structure my new website like &lt;a href="https://sashevuhckov.com"&gt;sashevuchkov.com&lt;/a&gt; and/or &lt;a href="https://robinwieruch.de"&gt;robinwieruch.de&lt;/a&gt;. That means I will still need to develop custom components and sections that are not part of the template, but it will be easier than creating everything from scratch.&lt;/p&gt;

&lt;p&gt;In the following tutorial, we’ll set up a Next.JS project the proper way, and in the tutorial after it, we will start planning our components and pages.&lt;/p&gt;

&lt;p&gt;So stay tuned.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Let’s wrap up what we talked about:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;One big mistake that leads to many plain ugly websites&lt;/li&gt;
&lt;li&gt;The right way to approach the web design challenge before us if we’re not web designers&lt;/li&gt;
&lt;li&gt;And how to find a good HTML template or UI kit&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Cheers,&lt;br&gt;
Sashe Vuchkov&lt;/p&gt;

&lt;p&gt;PS. This tutorial was originally published &lt;a href="https://buhalbu.com/stream/nextjs-tutorial-the-full-stack-story-of-building-your-superb-portfolio-website"&gt;on this page&lt;/a&gt;...&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>react</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>What Should Your Superb Portfolio Website Look Like For The Best Results?</title>
      <dc:creator>Sashe V.</dc:creator>
      <pubDate>Mon, 25 Jul 2022 09:27:00 +0000</pubDate>
      <link>https://dev.to/sashevuchkov/what-should-your-superb-portfolio-website-look-like-for-the-best-results-2cp3</link>
      <guid>https://dev.to/sashevuchkov/what-should-your-superb-portfolio-website-look-like-for-the-best-results-2cp3</guid>
      <description>&lt;p&gt;&lt;em&gt;//Note: &lt;a href="https://www.youtube.com/watch?v=ac21CXPzprk"&gt;Watch The Video Version Here&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Dear Next.Js Aficionado,&lt;/p&gt;

&lt;p&gt;There are fabulous portfolio websites, and there are some plain ugly ones. There are "arty" ones. Minimalistic ones. And so on, and on.&lt;/p&gt;

&lt;p&gt;Web developers are especially keen on building "out of the ordinary" projects. Sometimes they do it on purpose. More often, it just happens that way because the developer didn't prepare well. &lt;/p&gt;

&lt;h2&gt;
  
  
  Didn't write their homework...
&lt;/h2&gt;

&lt;p&gt;As I mentioned &lt;a href="https://dev.to/sashevuchkov/nextjs-tutorial-the-full-stack-story-of-building-your-superb-portfolio-website-2bo3"&gt;the last time&lt;/a&gt;, we are about to build a SUPERB portfolio website for you that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Helps you get the best job offerings&lt;/li&gt;
&lt;li&gt;It makes you look cool in other people's eyes&lt;/li&gt;
&lt;li&gt;And that works for you 24/7. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But first…&lt;/p&gt;

&lt;h2&gt;
  
  
  What do I mean when I'm saying "SUPERB"?
&lt;/h2&gt;

&lt;p&gt;That's the question I answer with this short tutorial.&lt;/p&gt;

&lt;p&gt;I will start answering by showing you a couple of good examples. I won't show you bad ones because I want to imprint in your mind the proper "end result," and I don't wish to pick on someone and make them angry. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example 01: The Website Of Josh Comeau&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let's talk for a minute about &lt;a href="https://www.joshwcomeau.com"&gt;joshwcomeau.com&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I like this one a lot because it's arty and full of content. Right away, you can tell that its owner knows what they're doing well. Although it's not a "portfolio," it's one of the best personal websites I've ever visited.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--y-uB3hJB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e7qxef58x81dhhvq9p7q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--y-uB3hJB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e7qxef58x81dhhvq9p7q.png" alt="Examle 01 Homepage" width="880" height="613"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The homepage is a simple one. It shows the latest blog posts, which help the author build some authority in the eyes of the visitors. &lt;/p&gt;

&lt;p&gt;By reading a few of the latest entries, the reader concludes that Josh Comeau is not a skillful web developer only, but they are a really knowledgeable and good communicator. &lt;/p&gt;

&lt;p&gt;The last one is important if you want to get ahead quickly in your career.&lt;/p&gt;

&lt;p&gt;Often the wild success isn't a matter of technical skills but a personal brand and soft skills. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--w2YN4TGe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4i12nk34zgnhtkjf72hw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--w2YN4TGe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4i12nk34zgnhtkjf72hw.png" alt="Example 01 Blog Post Page" width="880" height="613"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example 02: The Website of Robin Wieruch&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The next one comes from Germany. It's a good primer for a "marketing machine" that helps its owner achieve career and business success. &lt;/p&gt;

&lt;p&gt;The website has a complex homepage...&lt;/p&gt;

&lt;p&gt;It welcomes the user with a beautiful picture of a desert, plus the web developer's name. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--IeRH1qAp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jpyvqfu9zjcjkeob42ip.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--IeRH1qAp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jpyvqfu9zjcjkeob42ip.png" alt="Example 02 Homepage" width="880" height="613"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Right below it, we find a picture of Robin, their short bio, social media profiles, and a call to action "GET TO KNOW ME BEFORE YOU DIVE INTO MY CONTENT."&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NjxtfXj7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u5vcurljm4um9ka0n68z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NjxtfXj7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u5vcurljm4um9ka0n68z.png" alt="Exampe 02 About Section" width="880" height="613"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The next page section is titled "What I Offer." &lt;/p&gt;

&lt;p&gt;Not every portfolio website needs to talk about "offers." We can replace that section with a "My Skills" or "My Philosophy" Section and put the same cool-looking snippets with icons that briefly mention more information about us.&lt;/p&gt;

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

&lt;p&gt;Below "What I Offer," we find a "Portfolio " section. Robin Wieruch is really productive, so they list here not individual projects but CATEGORIES of projects.&lt;/p&gt;

&lt;p&gt;We can start with individual projects and later transition to listing categories.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4ok0-irb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zo3xrdbmmytjdds5lxyu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4ok0-irb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zo3xrdbmmytjdds5lxyu.png" alt="Example 02 Portfolio Section" width="880" height="613"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And the last important section of the homepage is titled "Vita." It's a sleek vertical timeline that lists some major life events of the site's owner. I consider it to be "the cherry on the cake." &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example 03: My Portfolio Website&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;My portfolio website is something I created recently without much thinking about it. I used WordPress, and I didn't optimize it for better performance. &lt;/p&gt;

&lt;p&gt;It took me 4 hours (blog posts not included). I needed something quick to "mark my place on the internet."&lt;/p&gt;

&lt;p&gt;In the past, I had several freelance websites under different domains, which were way more sophisticated, but they aren't online anymore.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Anyway…&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I'm showing you &lt;a href="https://sashevuchkov.com"&gt;sashevuchkov.com&lt;/a&gt;, not because of the used technology.&lt;/p&gt;

&lt;p&gt;WordPress, not Next.Js, powers it.&lt;/p&gt;

&lt;p&gt;I'm showing it to you because of the website structure and the content.&lt;/p&gt;

&lt;p&gt;It has a complex homepage that welcomes the user with a playful message:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--V4ZkDt58--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/07hwj048gd1bk6zg94r3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--V4ZkDt58--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/07hwj048gd1bk6zg94r3.png" alt="Example 03 Homepage" width="880" height="613"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then it introduces me:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--g7wub_KY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ohtfh9q03ugwb1dgatyz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--g7wub_KY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ohtfh9q03ugwb1dgatyz.png" alt="Example 03 Introduction" width="880" height="613"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then it talks a little bit about my country of origin: &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"I live in Sofia, the capital of Bulgaria – a crossroad where Western Pragmatism meets Eastern Wisdom.&lt;br&gt;&lt;br&gt;
So we are always on the fence…&lt;br&gt;
Drinking wine and listening to melancholy songs in a desperate attempt to forget about the inevitable and painful fall that constantly threatens us but actually never happens."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Just below, it mentions my core skills:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NAgkfxtr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hx1k23onyhawmvcbxf06.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NAgkfxtr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hx1k23onyhawmvcbxf06.png" alt="Example 03 Skills Section" width="880" height="613"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then it talks about my working process and finally, it lists some links to my blog posts&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--FlIrLeAu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cw59wy5t0cx2kmymv39v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--FlIrLeAu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cw59wy5t0cx2kmymv39v.png" alt="Example 03 Process Section" width="880" height="613"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Cool right?&lt;/p&gt;

&lt;h2&gt;
  
  
  How should your superb portfolio website be structured?
&lt;/h2&gt;

&lt;p&gt;You will notice some commonalities if you analyze Robin Wieruch's website and mine. Both have complex homepages about the web developer - their skills, projects, blog posts, etc.  &lt;/p&gt;

&lt;p&gt;Both have dedicated blog archive pages, and both of them showcase some past or current projects. &lt;/p&gt;

&lt;p&gt;That's how your portfolio should be structured and look.&lt;/p&gt;

&lt;h2&gt;
  
  
  And one more thing...
&lt;/h2&gt;

&lt;p&gt;No matter your next project - never start from a "clean slate." Use the strategy I've just demonstrated to you in this article. &lt;/p&gt;

&lt;p&gt;Find some good examples. MODEL, but not COPY, the best part of them… and you will never again struggle to produce something above average. &lt;/p&gt;

&lt;p&gt;In the following video, I will share a shortcut to a website of equal or better quality. It will look fast and sleek. High-grade, professional asset.&lt;/p&gt;

&lt;p&gt;So stay tuned…  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What did we talk about in this tutorial?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Three good examples to learn from&lt;/li&gt;
&lt;li&gt;Why do I consider them good examples&lt;/li&gt;
&lt;li&gt;A strategy that will help you always produce above-average stuff&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Cheers,&lt;br&gt;
Sashe Vuchkov &lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>react</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>NextJs Tutorial: The Full-Stack Story Of Building Your Superb Portfolio Website</title>
      <dc:creator>Sashe V.</dc:creator>
      <pubDate>Mon, 25 Jul 2022 02:04:00 +0000</pubDate>
      <link>https://dev.to/sashevuchkov/nextjs-tutorial-the-full-stack-story-of-building-your-superb-portfolio-website-2bo3</link>
      <guid>https://dev.to/sashevuchkov/nextjs-tutorial-the-full-stack-story-of-building-your-superb-portfolio-website-2bo3</guid>
      <description>&lt;p&gt;&lt;em&gt;//Note: &lt;a href="https://www.youtube.com/watch?v=ac21CXPzprk"&gt;Watch the video version here&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Dear Next.Js Aficionado&lt;/p&gt;

&lt;p&gt;If you want to build an amazing portfolio website that’s beautiful and looks professional…&lt;/p&gt;

&lt;p&gt;A website that helps you get the best job offerings and makes your friends a little envious of your high skills to create such valuable “assets” from start to finish, then the following few paragraphs will be the most important thing you’ll discover today.&lt;/p&gt;

&lt;p&gt;I’m starting a tutorial series to share all my knowledge on creating websites and making them work for you 24/7.&lt;/p&gt;

&lt;p&gt;My most recent CV tells the story of a web developer with three years of professional experience, but I’ve been building sites since 2006.&lt;/p&gt;

&lt;h2&gt;
  
  
  Mainly for personal needs…
&lt;/h2&gt;

&lt;p&gt;And now I’ve decided to talk about the ups and downs, the easy stuff, and the hard stuff. The pitfalls, the omissions, the errors, the failures, and, of course, the success I’ve experienced.&lt;/p&gt;

&lt;p&gt;What can you expect from this tutorial series?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;We will make a plan that will lead us to the best portfolio website&lt;/li&gt;
&lt;li&gt;We will learn how to set up our Next.JS project for success&lt;/li&gt;
&lt;li&gt;We will use a lot of React.Js to create reusable components and pages&lt;/li&gt;
&lt;li&gt;We will integrate Firebase as a home for the content of our website&lt;/li&gt;
&lt;li&gt;We will learn about Markdown and how to use it to publish well-formatted articles&lt;/li&gt;
&lt;li&gt;We will use Firebase to implement some basic user authentication&lt;/li&gt;
&lt;li&gt;And finally, we’ll deploy our website on Vercel, so it’s accessible to all&lt;/li&gt;
&lt;li&gt;We will create a truly amazing portfolio website, and we have a lot of work to do, so let’s get our hands dirty…&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  First, it’s important to define our stack
&lt;/h2&gt;

&lt;p&gt;This exhaustive tutorial focuses on demonstrating how to use Next.Js properly. But Next.Js can’t be used in isolation. There are some prerequisites that you need to have before you accept the challenge.&lt;/p&gt;

&lt;p&gt;It would help if you had a clear understanding of HTML, CSS, and JavaScript. These are non-negotiable. Everything we will do is built on top of these technologies, and if you’re a total novice, I strongly advise you to put this tutorial for later.&lt;/p&gt;

&lt;p&gt;Learn the basics and then come back.&lt;/p&gt;

&lt;p&gt;The purpose of your portfolio website is to help you get the best job offerings, but no matter how good is it, you will fail to get hired if you don’t know the basics.&lt;/p&gt;

&lt;p&gt;So first things, first.&lt;/p&gt;

&lt;h2&gt;
  
  
  Next, we will use React.js
&lt;/h2&gt;

&lt;p&gt;You can definitely learn this JavaScript library while creating your portfolio. Next.Js is a react framework, so there’s no reason to delay using it. You can master them both at the same time.&lt;/p&gt;

&lt;p&gt;And finally, there is a right and wrong way to set up your project. There is a right and wrong way to approach the creation of a website. There’s much stuff that only a pro with years of experience can know about.&lt;/p&gt;

&lt;p&gt;I have created many websites with a plethora of technologies. I have been playing this game for years, so I clearly understand what the “end result” should be and will gladly share everything I know with you.&lt;/p&gt;

&lt;p&gt;In the following video, we’ll apply some “project management.”&lt;/p&gt;

&lt;p&gt;I’ll reveal a strategy to help you discover what your website should look like. We’ll plan its structure, sections, navigation, and DB document types. And I will explain why we’re doing what we’re doing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ok. Let’s wrap it…&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;We talked about what you can expect from this tutorial series on building your portfolio website&lt;/li&gt;
&lt;li&gt;We talked about the stack and prerequisites you need to complete the project successfully&lt;/li&gt;
&lt;li&gt;And we talked about some of my experience that allows me to share with you “insider stuff.”&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Cheers,&lt;br&gt;
Sashe Vuchkov&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>react</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Super Easy &amp; Profitable “Pro Hack” For Amazing Websites With NextJs</title>
      <dc:creator>Sashe V.</dc:creator>
      <pubDate>Thu, 21 Jul 2022 21:52:00 +0000</pubDate>
      <link>https://dev.to/sashevuchkov/super-easy-profitable-pro-hack-for-amazing-websites-with-nextjs-pf5</link>
      <guid>https://dev.to/sashevuchkov/super-easy-profitable-pro-hack-for-amazing-websites-with-nextjs-pf5</guid>
      <description>&lt;p&gt;Dear Next.Js Aficionado,&lt;/p&gt;

&lt;p&gt;So you wanna build a beautiful website, right?&lt;/p&gt;

&lt;p&gt;A website that shows your high level of web development skills and one that helps you get the best job offers or freelance gigs, or that attracts users for your cool app.&lt;/p&gt;

&lt;p&gt;Nice, we all want that!&lt;/p&gt;

&lt;p&gt;But often we don’t get it because we make a common big mistake.&lt;/p&gt;

&lt;p&gt;It’s so widespread that even sessional professionals fall victim to it. No matter their high achievements or their years of experience. Once they go for their own website, many times they create something ultra-functional. Something well-coded.&lt;/p&gt;

&lt;p&gt;But something with... &lt;/p&gt;

&lt;h2&gt;
  
  
  ZERO marketing or design value
&lt;/h2&gt;

&lt;p&gt;It’s just plain ugly.&lt;/p&gt;

&lt;p&gt;No offense, but we – all web developers, must learn that we’re not some extraordinary guys who can handle every possible challenge in the world.&lt;/p&gt;

&lt;p&gt;We’re not superhumans!&lt;/p&gt;

&lt;p&gt;Anyway.&lt;/p&gt;

&lt;p&gt;The point is – we’re not web designers. We’re not UX experts either.&lt;/p&gt;

&lt;p&gt;So we shall not try to be one!&lt;/p&gt;

&lt;p&gt;The “super easy and profitable pro hack” is to start working with web designers or at least – use professional templates. You will see a drastic improvement in your ability to put online fast whatever projects you want that make you look BIG POTATO in the industry.&lt;/p&gt;

&lt;p&gt;It’s not criminal to be a small potato, though…&lt;/p&gt;

&lt;p&gt;But why be one when you have all the opportunities you need to look larger than life?&lt;/p&gt;

&lt;h2&gt;
  
  
  And the best part?
&lt;/h2&gt;

&lt;p&gt;You can get wonderful free HTML templates right now! The internet is full of them.&lt;/p&gt;

&lt;p&gt;Just pick something beautiful and turn it into a piece of Next.Js art.&lt;/p&gt;

&lt;p&gt;Cheers,&lt;br&gt;
Sashe Vuchkov&lt;/p&gt;

&lt;p&gt;PS. I offer &lt;a href="https://buhalbu.com/stream/next-js-free-blog-template"&gt;a free template&lt;/a&gt;, too. It’s nothing fancy, but I put in it all of my marketing knowledge. The knowledge that inundates me with job and partnership offers to this day.&lt;/p&gt;

&lt;p&gt;If you’re curious about how I structure my own portfolio websites for maximum success, you can download it on Gumroad in exchange for your email.&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>beginners</category>
      <category>javascript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Next.Js Adventures: How a Couple Of Embedded YouTube Videos Screwed My Performance Scores</title>
      <dc:creator>Sashe V.</dc:creator>
      <pubDate>Thu, 14 Jul 2022 18:29:16 +0000</pubDate>
      <link>https://dev.to/sashevuchkov/nextjs-adventures-how-a-couple-of-embedded-youtube-videos-screwed-my-performance-scores-1ldb</link>
      <guid>https://dev.to/sashevuchkov/nextjs-adventures-how-a-couple-of-embedded-youtube-videos-screwed-my-performance-scores-1ldb</guid>
      <description>&lt;p&gt;Dear Next.Js Aficionado,&lt;/p&gt;

&lt;p&gt;Recently I’ve been working hard to prepare my humble startup for a ProductHunt launch.&lt;/p&gt;

&lt;p&gt;So the other day, I decided that the homepage needs a couple of videos that show the app in action. I don’t have a budget for fancy stuff, so I made three screencasts, synced them with cool music, and uploaded them on YouTube.&lt;/p&gt;

&lt;p&gt;Later, I embedded the videos on the page.&lt;/p&gt;

&lt;p&gt;Obviously, some old lessons I had learned years ago were forgotten.&lt;/p&gt;

&lt;p&gt;The next day I was preparing another screencast when I was surprised by this “nice view”:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VJQ2UwdY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b7tunudrvh0t7k8y36o4.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VJQ2UwdY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b7tunudrvh0t7k8y36o4.jpg" alt="BuhalBu Homepage's Bad Scores" width="880" height="471"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I was stunned…&lt;/p&gt;

&lt;p&gt;It was not how I left the page. The last time I checked, everything besides PWA was colored in green.&lt;/p&gt;

&lt;p&gt;So I started debugging, and right away, I noticed the cause for those bad scores was the embedded YouTube videos.&lt;/p&gt;

&lt;h2&gt;
  
  
  What an embarrassment!
&lt;/h2&gt;

&lt;p&gt;I was claiming I knew something about Technical SEO and how to achieve better website performance, and I failed to foresee the awful impact those videos would have on my webpage.&lt;/p&gt;

&lt;p&gt;Anyway…&lt;/p&gt;

&lt;p&gt;After some research (a.k.a googling) and some creative pondering, I’ve come up with the following react 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;useRef&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="nx"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;Props&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;video&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;thumbnailQuality&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;default&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;hqdefault&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;mqdefault&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sddefault&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;YouTubeFrame&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="nx"&gt;video&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;height&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;thumbnailQuality&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;divRef&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useRef&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;HTMLDivElement&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;null&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;onClick&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;iframe&lt;/span&gt; &lt;span class="o"&gt;=&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;createElement&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;iframe&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nx"&gt;iframe&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;setAttribute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;frameborder&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;0&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nx"&gt;iframe&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;setAttribute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;allowfullscreen&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;1&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nx"&gt;iframe&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;setAttribute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;allow&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nx"&gt;iframe&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;style&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;width&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nx"&gt;iframe&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;style&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;height&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;height&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nx"&gt;iframe&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;setAttribute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;src&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;`https://www.youtube.com/embed/&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;video&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;?rel=0&amp;amp;showinfo=1&amp;amp;autoplay=1`&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;divRef&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nx"&gt;divRef&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;innerHTML&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="nx"&gt;divRef&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;appendChild&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;iframe&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;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;ref&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;divRef&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;youtube-frame position-relative&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;span&lt;/span&gt; &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;ti-control-play position-absolute display-1 text-white&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;Image&lt;/span&gt; &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="nx"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;`https://img.youtube.com/vi/&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;video&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;thumbnailQuality&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;.jpg`&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="nx"&gt;alt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;YouTube Video Thumbnail&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="nx"&gt;height&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;height&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;shadow&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;/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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see, the component accepts the video slug, the preferred thumbnail size, and the desired dimensions as parameters. Instead of embedding the video right away, I’m putting a placeholder (its thumbnail), so the video’s iframe is appended only after a click on that placeholder.&lt;/p&gt;

&lt;p&gt;It’s nothing genius, but it did restore the balance in the universe…&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--h4rPgRj2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yaol7351mml1ks0r2hps.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--h4rPgRj2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yaol7351mml1ks0r2hps.jpg" alt="BuhalBu's Home Page Better Scores" width="880" height="432"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This case study is evidence that Next.Js is an “SEO-friendly” framework but not “SEO-ready.”&lt;/p&gt;

&lt;p&gt;We, as web developers, have plenty of room to screw things, so we must be careful. We must measure the performance of our website every time we’re about to make substantial changes. And we must measure it after the changes.&lt;/p&gt;

&lt;p&gt;This additional monitoring is the only way to know the real impact of our work.&lt;/p&gt;

&lt;p&gt;Cheers,&lt;br&gt;
Sashe Vuchkov&lt;/p&gt;

&lt;p&gt;P.S. If you want to view the screencasts I made, just visit &lt;a href="https://buhalbu.com"&gt;BuhalBu’s homepage&lt;/a&gt;…&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>webdev</category>
      <category>performance</category>
      <category>seo</category>
    </item>
  </channel>
</rss>
