<?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: Will Holmes</title>
    <description>The latest articles on DEV Community by Will Holmes (@willholmes).</description>
    <link>https://dev.to/willholmes</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%2F539842%2Fcd0a3b2a-7787-4dc9-8842-3a4781a8369b.jpg</url>
      <title>DEV Community: Will Holmes</title>
      <link>https://dev.to/willholmes</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/willholmes"/>
    <language>en</language>
    <item>
      <title>Migrating to NextJs 13</title>
      <dc:creator>Will Holmes</dc:creator>
      <pubDate>Tue, 08 Nov 2022 12:42:26 +0000</pubDate>
      <link>https://dev.to/willholmes/migrating-to-nextjs-13-3l6d</link>
      <guid>https://dev.to/willholmes/migrating-to-nextjs-13-3l6d</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;With all the buzz around NextJS 13 recently, I decided to take the opportunity to upgrade my personal website from 12 to 13.&lt;/p&gt;

&lt;p&gt;The current setup is that I have a NextJS 12 app which serves a single page. It makes use of &lt;code&gt;getServerSideProps&lt;/code&gt; to fetch data relating to my latest blog posts and my latest packages that I have published. It's pretty simple really and does the job for what I need right now.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Migration Process
&lt;/h2&gt;

&lt;p&gt;As part of this upgrade I wanted to give a shot at moving to the new app directory structure.&lt;/p&gt;

&lt;p&gt;Firstly you have to run some updates to your package versions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm i next@latest react@latest react-dom@latest eslint-config-next@latest
&lt;span class="c"&gt;# or&lt;/span&gt;
yarn upgrade next react react-dom eslint-config-next &lt;span class="nt"&gt;--latest&lt;/span&gt;
&lt;span class="c"&gt;# or&lt;/span&gt;
pnpm up next react react-dom eslint-config-next &lt;span class="nt"&gt;--latest&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;The above is taken from &lt;a href="https://nextjs.org/docs/upgrading"&gt;Vercel's upgrade page&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Secondly you need to adjust your &lt;code&gt;next.config.js&lt;/code&gt; to include the following code block to enable app structure routing:&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;nextConfig&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;experimental&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;appDir&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once this has been done you then need to start migrating the different parts affected by the major bump. &lt;a href="https://beta.nextjs.org/docs/upgrade-guide"&gt;You can view them here at Vercel's hidden beta upgrade page&lt;/a&gt; which is frustratingly hard to find.&lt;/p&gt;

&lt;p&gt;The most major parts to the upgrade that I found were:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Components are now react-server-components by default unless you specify &lt;code&gt;use client&lt;/code&gt; at the top of your file. This can cause breakages in existing code. Previous hooks such as &lt;code&gt;useRouter()&lt;/code&gt; have been replaced and the new ones are only available in client components.&lt;/li&gt;
&lt;li&gt;The folder structure for routing. See a comparison below.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  NextJS 12
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;project
│   
└───/pages
   │   index.tsx
   │   projects.tsx
   └───/api
       │   hello-world.ts

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

&lt;/div&gt;



&lt;h3&gt;
  
  
  vs
&lt;/h3&gt;

&lt;h3&gt;
  
  
  NextJS 13
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;project
│   
└───/app
    │   page.tsx (represents '/' route)
    └───/projects
        │   page.tsx (represents '/projects' route)
└───/pages
   └───/api (api routes are still in a pages folder)
       │   hello-world.ts

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Layouts have changed. You can share layouts between routes really easily or just have your normal layout at root. Layouts now just take a children prop typed as &lt;code&gt;React.ReactNode&lt;/code&gt;. No typings of component and page props.&lt;/li&gt;
&lt;li&gt;You do not need a &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt; section inside of your layout. This is done via a &lt;code&gt;head.tsx&lt;/code&gt; file which contains all the declarations of your head tags etc.&lt;/li&gt;
&lt;li&gt;Caching requests with fetch inside of pages is so easy and code looks a lot cleaner than the old &lt;code&gt;getServerSideProps()&lt;/code&gt;.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;next&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;revalidate&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt; &lt;span class="c1"&gt;// 60 second cache&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;If you run into unhelpful errors then you will most likely struggle to find answers to your issues via Google. But that's due to the nature of new technology!&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;Image /&amp;gt;&lt;/code&gt; tag has been upgraded - but you can revert to the old version by changing your import to something like this &lt;code&gt;import Image from 'next/legacy/image';&lt;/code&gt;. I had to due to some errors that I ran into during my upgrade.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;Link /&amp;gt;&lt;/code&gt; tag now renders an &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; tag by default. So you no longer need to wrap an a tag inside of a Link tag.&lt;/li&gt;
&lt;li&gt;No changes to api routes. They stay inside of the pages directory. Which I was surprised at, I hope this changes soon!&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Deploying to Netlify
&lt;/h2&gt;

&lt;p&gt;This was... painful to say the least.&lt;/p&gt;

&lt;p&gt;Documentation isn't well presented and easily accessible. If you wish to use the new NextJS app structure, it is currently part of an extended version of their plugin to enable it for deployments.&lt;/p&gt;

&lt;p&gt;Ensure you upgrade &lt;code&gt;@netlify/plugin-nextjs&lt;/code&gt; to this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"@netlify/plugin-nextjs"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"^4.28.4-appdir.0"&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your existing .toml setup should be fine as it is.&lt;/p&gt;

&lt;p&gt;I also found that running the build locally and then serving it and testing the build was absolutely fine. But when deployed to netlify I got a 500. Turns out the issue was because there was an import of &lt;code&gt;next/head&lt;/code&gt; which isn't used anymore and doesn't play nicely when running inside of netlify.&lt;/p&gt;

&lt;p&gt;To help others with this in the future, below is a link of references that I found helpful when migrating my app:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;a href="https://nextjs.org/docs/upgrading"&gt;https://nextjs.org/docs/upgrading&lt;/a&gt; - Vercels snapshot update of upgrading.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://beta.nextjs.org/docs/upgrade-guide"&gt;https://beta.nextjs.org/docs/upgrade-guide&lt;/a&gt; - Vercels in-depth (kinda) guide upgrading.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.netlify.com/blog/deploy-nextjs-13/"&gt;https://www.netlify.com/blog/deploy-nextjs-13/&lt;/a&gt; - Netlify's blog post around migrating to NextJS 13.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Overall
&lt;/h2&gt;

&lt;p&gt;I spent a great deal of time migrating due to little gotcha's  here and there. I'm happy it's done and I can test the new features it provides. But if my experience is anything to go by, I would allow a fair amount of time to do this with due care and attention. But maybe it was my late night coding brain that caused me to be so slow at upgrading.&lt;/p&gt;

&lt;p&gt;Thanks for reading!👋 &lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>typescript</category>
      <category>javascript</category>
      <category>react</category>
    </item>
    <item>
      <title>Multi Nested Dynamic Routes in NextJs</title>
      <dc:creator>Will Holmes</dc:creator>
      <pubDate>Wed, 20 Jul 2022 20:40:27 +0000</pubDate>
      <link>https://dev.to/willholmes/multi-nested-dynamic-routes-in-nextjs-30f7</link>
      <guid>https://dev.to/willholmes/multi-nested-dynamic-routes-in-nextjs-30f7</guid>
      <description>&lt;p&gt;Recently i've been working on a web app that im building in NextJs along side a lot of other technologies (via &lt;a href="https://create.t3.gg/"&gt;create-t3-app&lt;/a&gt;). However, I came across a problem that I could not easily solve with some googling in the space of 15/20 minutes. So I thought that I would share my problem and solution, which will hopefully help others not go through the endless browsing of stackoverflow results as I did.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem:
&lt;/h2&gt;

&lt;p&gt;I want to have multiple nested dynamic routes in my NextJs app.&lt;br&gt;
So that I can build routes like:&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;'/product-catalog/123/product/1'&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Now before I carry on with my solution, i'd like to add that basic dynamic routing is so easy.&lt;/p&gt;

&lt;p&gt;All you have to do is have a folder structure like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- pages/
-- product-catalog/
--- [productcatalogid].tsx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This would produce the route:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/product-catalog/123
(123 being the productcatalogid parameter)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;However, moving to multiple nested routes isn't available using the same principle. I.e. a folder structure like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- pages/
-- product-catalog/
--- [productcatalogid].tsx
---- product/
----- [productid].tsx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above will simply result in a 404 everytime you go to request the page.&lt;/p&gt;

&lt;h2&gt;
  
  
  The solution:
&lt;/h2&gt;

&lt;p&gt;Simply implementing a folder structure like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- pages/
-- product-catalog/
--- index.tsx
---- product/
----- [productid].tsx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Seems to do the job nicely when dealing with multiple dynamic routes.&lt;/p&gt;

&lt;p&gt;I hope this helped! For more information see the video that I found the solution on: &lt;a href="https://www.youtube.com/watch?v=nfAxNTmme64"&gt;https://www.youtube.com/watch?v=nfAxNTmme64&lt;/a&gt;&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>javascript</category>
      <category>tutorial</category>
      <category>react</category>
    </item>
    <item>
      <title>A UseDarkMode react hook for everyone!</title>
      <dc:creator>Will Holmes</dc:creator>
      <pubDate>Mon, 23 May 2022 09:13:26 +0000</pubDate>
      <link>https://dev.to/willholmes/a-usedarkmode-react-hook-for-everyone-2nka</link>
      <guid>https://dev.to/willholmes/a-usedarkmode-react-hook-for-everyone-2nka</guid>
      <description>&lt;p&gt;So a while ago I came across an issue whilst developing.&lt;/p&gt;

&lt;p&gt;I was creating a solution in nextjs with typescript and using tailwind to help with my css.&lt;/p&gt;

&lt;p&gt;Tailwind out of the box provides dark mode support for different styling really easily by doing the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;'bg-white dark:bg-black'&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Hello World &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;However, I needed to know when the user was in dark mode within my react application to change other parts to the system. So I began looking through npm for another solution, but with little luck I decided to take how tailwind looks for dark mode and put it into a react hook.&lt;/p&gt;

&lt;p&gt;This is where &lt;a href="https://www.npmjs.com/package/use-dark-mode-ts"&gt;useDarkMode&lt;/a&gt; comes into play. Initially I created this inside of the repository that I was working on at the time but after proving that it works, I realized it would soon be something that could help a lot of other developers.&lt;/p&gt;

&lt;p&gt;The package also comes with types so for those using typescript you can ensure type safety and, those who aren't well... that's fine too!&lt;/p&gt;

&lt;p&gt;So I created a new repository and published it to npm: &lt;a href="https://www.npmjs.com/package/use-dark-mode-ts"&gt;https://www.npmjs.com/package/use-dark-mode-ts&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;It's really easy and simple to use, below is a code snippet:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&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;useDarkMode&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;use-dark-mode-ts&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;ExampleComponent&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;isDarkMode&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useDarkMode&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="p"&gt;&amp;lt;&amp;gt;&lt;/span&gt;
            &lt;span class="si"&gt;{&lt;/span&gt;
                &lt;span class="nx"&gt;isDarkMode&lt;/span&gt;
                &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="p"&gt;(&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;I am in dark mode &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;)&lt;/span&gt;
                &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;I am not in dark mode &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;)&lt;/span&gt;
            &lt;span class="si"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;/&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;Now by no means is it perfect and those with more experience in this area might be able to help contribute to make it even slicker. But for now, this is where I have got to and at the time of writing it has exploded with 4.2k weekly downloads.&lt;/p&gt;

&lt;p&gt;I hope it helps as many of you as possible!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>nextjs</category>
      <category>react</category>
    </item>
    <item>
      <title>Feature Flags in Next.JS</title>
      <dc:creator>Will Holmes</dc:creator>
      <pubDate>Fri, 25 Mar 2022 12:57:51 +0000</pubDate>
      <link>https://dev.to/willholmes/feature-flags-in-nextjs-1432</link>
      <guid>https://dev.to/willholmes/feature-flags-in-nextjs-1432</guid>
      <description>&lt;p&gt;Feature flags are great, they are also even better when the developer experience of integrating and using them is easy.&lt;/p&gt;

&lt;p&gt;With lots of choice available today on the market I wanted to find a solution that worked well for developers who build projects on the side and specifically in Next.JS.&lt;/p&gt;

&lt;p&gt;So that lead me to search for a tool which ticked the following boxes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It has a gracious free tier&lt;/li&gt;
&lt;li&gt;Easy integration into my project&lt;/li&gt;
&lt;li&gt;Is small in size (don't want to be bloating projects).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is where I discovered a tool which ticked all of them.&lt;/p&gt;

&lt;h2&gt;
  
  
  Introducing... HappyKit
&lt;/h2&gt;

&lt;p&gt;I did some research on this tool and implemented it into my main pet project that I am working on right now and I have been blown away.&lt;/p&gt;

&lt;h3&gt;
  
  
  Firstly, it's &lt;a href="https://www.npmjs.com/package/@happykit/flags"&gt;npm package&lt;/a&gt; is both easy to use and small in size.
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;Less than 5kb in size&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;How to integrate&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm i @happykit/flags

OR

yarn add @happykit/flags
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then create a &lt;code&gt;flags.config.ts&lt;/code&gt; file at root with the following contents:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { configure } from "@happykit/flags/config";

configure({
  envKey: process.env.NEXT_PUBLIC_FLAGS_ENVIRONMENT_KEY
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then import this into your &lt;code&gt;_app.tsx&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import '../flags.config'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Lastly, add the following to your &lt;code&gt;.env.local&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;To find the value for your environment variable:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Go to the portal happykit.dev&lt;/li&gt;
&lt;li&gt;Go to settings&lt;/li&gt;
&lt;li&gt;Go to keys and pick which environment you want to target (i'd advise development in local building).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;They also support a preview environment and a production environment out of the box. Which is a nice feature for free.&lt;/p&gt;

&lt;p&gt;The library fully supports SSR and I can demonstrate this with the below code snippet:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import type { NextPage, NextPageContext } from "next";
import { useFlags } from "@happykit/flags/client";
import { getFlags } from "@happykit/flags/server";
import {
  ErrorInitialFlagState,
  Flags,
  SuccessInitialFlagState,
} from "@happykit/flags/dist/declarations/src/types";

export const getServerSideProps = async (context: NextPageContext) =&amp;gt; {
  const { initialFlagState } = await getFlags({ context });
  return { props: { initialFlagState } };
};

interface IHomePageProps {
  initialFlagState: SuccessInitialFlagState&amp;lt;Flags&amp;gt; | ErrorInitialFlagState;
}

const Home: NextPage&amp;lt;IHomePageProps&amp;gt; = (props) =&amp;gt; {
  const { flags } = useFlags({ initialState: props.initialFlagState });

return (
   &amp;lt;div&amp;gt;Hello {flags.exampleFlag ? 'World' : 'Not turned on'}&amp;lt;/div&amp;gt;
  );
};

export default Home;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above is really neat because this now means that we get the initial flag values on the server when a client requests the page and we pass it to them. Rather than having the client make that extra initial call to get the values for our flags.&lt;/p&gt;

&lt;h3&gt;
  
  
  Secondly, the portal is very easy to use.
&lt;/h3&gt;

&lt;p&gt;It guides you through creating feature flags and is full of code samples on how to get started. It's very intuitive to use and i've had absolutely no problem with navigating my way through it which is always a reassuring sign when picking a tool to aid your development of projects.&lt;/p&gt;

&lt;h3&gt;
  
  
  Thirdly, the free tier is good.
&lt;/h3&gt;

&lt;p&gt;When developing pet projects we want the world for nothing. HappyKit gives you a free tier consisting of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AB testing of feature flags&lt;/li&gt;
&lt;li&gt;Up to 100,000 requests a month&lt;/li&gt;
&lt;li&gt;5 feature flags on the go at once.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is good, but I leave it at good. There are other competitors that offer more feature flags in their free tier and I would hope that this changes in the future for HappyKit. But given the fact that it offers all the other things mentioned so far in this article. It's still a winner for me.&lt;/p&gt;

&lt;h3&gt;
  
  
  Closing thoughts
&lt;/h3&gt;

&lt;p&gt;Feature flags are an important tool in todays development ecosystem. Testing features before releasing to the masses, and not being dependent on stale feature branches from master is an important thing to avoid. Therefore finding a good tool for the job is high on the priority list. I personally like how HappyKit is laid out and I intend to keep using it. A key theme for me has been Developer Experience and how that affects my decision making when using tools. Which is why I like this tool in particular. Just like the reason for why I love using tailwind for my UI's. It's DX is amazing.&lt;/p&gt;

&lt;p&gt;Let me know in the comments below what tools you use to manage feature flags in Next.JS 👇&lt;/p&gt;

&lt;h4&gt;
  
  
  Links:
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://happykit.dev"&gt;HappyKit&lt;/a&gt;&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>javascript</category>
      <category>react</category>
      <category>webdev</category>
    </item>
    <item>
      <title>You don't need to know it all</title>
      <dc:creator>Will Holmes</dc:creator>
      <pubDate>Wed, 09 Feb 2022 12:17:22 +0000</pubDate>
      <link>https://dev.to/willholmes/you-dont-need-to-know-it-all-4lhc</link>
      <guid>https://dev.to/willholmes/you-dont-need-to-know-it-all-4lhc</guid>
      <description>&lt;p&gt;As I continue to keep developing and building in different, new technologies this realization of not needing to know it all as a developer has become quite an important part to fighting off imposter syndrome for me.&lt;/p&gt;

&lt;p&gt;Being a fullstack developer, it can be &lt;strong&gt;so&lt;/strong&gt; overwhelming to try and be on top of every new dotnet version, node version, react version etc etc. &lt;em&gt;You get the message...&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;But something that I have come to the realization in myself whilst working on new builds recently is that:&lt;/p&gt;

&lt;h2&gt;
  
  
  It's okay not to know everything.
&lt;/h2&gt;

&lt;p&gt;You will come across specialists in areas that know the complex, and make it simple. That's fine! They have chosen to be an absolute master at that specific area of development. Don't compare yourself, you'll never win. Trust me.&lt;/p&gt;

&lt;p&gt;But what can you do to make sure that you keep up to date whilst not falling behind?&lt;/p&gt;

&lt;h2&gt;
  
  
  Build in your own time with new technologies.
&lt;/h2&gt;

&lt;p&gt;This to me has been so beneficial throughout my career as a developer so far. Never stop building. I find that when I want to use a new technology, I will build a new app with it. Specifically a copy of an existing application that you can use to experiment with technologies and integrations. &lt;/p&gt;

&lt;p&gt;For example: &lt;/p&gt;

&lt;p&gt;&lt;em&gt;I want to play with react native and brush up on my styling as I feel I am so behind on the trends.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Brilliant! Go build a copy of Instagram in react native, this will cover building in a new technology and experimenting with styles.&lt;/p&gt;

&lt;h2&gt;
  
  
  Take exams from technology providers.
&lt;/h2&gt;

&lt;p&gt;This has been a great way for me to learn new things and squash that feeling of being an imposter. This is because the gratification of being certified by a provider allows you to know that the hard work you put in is recognized officially. Rather than relying upon yourself to validate this.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;I want to learn more about Azure as a developer so that I don't feel I am behind with the trend when developing in their cloud.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Brilliant! Go take an exam such as Azure Developer Associate to learn more and validate your knowledge.&lt;/p&gt;

&lt;p&gt;These are two great things that you can do to bolster your knowledge and have helped me. They may or may not work for you but take the personal time to figure this out. I understand life can be difficult and things get in the way and that's fine. As GaryVee well says:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Macro patience, micro speed.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Aim for the long term, becoming the best developer you possibly can be. Unrealistic timelines and expectations are going to set you up for disappointment. But make sure you push yourself :)&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>webdev</category>
      <category>career</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Why I think Jest is better than Mocha &amp; Chai</title>
      <dc:creator>Will Holmes</dc:creator>
      <pubDate>Wed, 20 Jan 2021 00:07:25 +0000</pubDate>
      <link>https://dev.to/willholmes/why-i-think-jest-is-better-than-mocha-chai-78l</link>
      <guid>https://dev.to/willholmes/why-i-think-jest-is-better-than-mocha-chai-78l</guid>
      <description>&lt;p&gt;So recently i've been working on building services in NodeJS with Typescript, and one of the big challenges i've had is picking a test framework that suits my purpose.&lt;/p&gt;

&lt;p&gt;Coming from a .NET Developer backend world and stepping into the NodeJS/Typescript backend world, has been on a journey on its own, and one that I will look to document soon in an upcoming blog post.&lt;/p&gt;

&lt;p&gt;However, with my experience on the frontend and using jest to test components and logic, etc. I naturally drifted towards it, but I thought instead I would give Mocha &amp;amp; Chai a shot instead.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Jest or Mocha!?
&lt;/h2&gt;

&lt;p&gt;Jest and Mocha are both examples of testing frameworks that have their pros and cons, but in essence, do the same thing. Just one simpler than the other... 🙄&lt;/p&gt;

&lt;p&gt;"&lt;em&gt;Jest is a JavaScript testing framework maintained by Facebook, Inc. designed and built by Christoph Nakazawa with a focus on simplicity and support for large web applications. It works with projects using Babel, TypeScript, Node.js, React, Angular, Vue.js and Svelte"&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;"&lt;em&gt;Mocha is a JavaScript test framework for Node.js programs, featuring browser support, asynchronous testing, test coverage reports, and use of any assertion library."&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why would I want to use either of these?
&lt;/h2&gt;

&lt;p&gt;When building applications using modern javascript libraries or frameworks such as Node or React, you need to be able to test your codebase. Both of these tools enable you to do that, but exposing different API's in order to execute your tests. &lt;/p&gt;

&lt;p&gt;Typically Mocha pairs with Chai:&lt;/p&gt;

&lt;p&gt;"&lt;em&gt;Chai is a BDD / TDD assertion library for node and the browser that can be delightfully paired with any javascript testing framework."&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;However, when using Jest you will not need to rely explicitly on a third-party assertion library. Let's see some live examples so we can see how the underlying API's differ between the two.&lt;/p&gt;

&lt;h2&gt;
  
  
  Implementation Comparisons
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Scenario 1:
&lt;/h3&gt;

&lt;p&gt;I want to unit test my login service on the action of checking the user has a valid userId.&lt;/p&gt;

&lt;h3&gt;
  
  
  Mocha
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&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;expect&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;should&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;chai&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;loginService&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;./loginService&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nx"&gt;describe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;loginService&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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;it&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;should return true if valid user id&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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;loginService&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;isValidUserId&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;abc123&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)).&lt;/span&gt;&lt;span class="nx"&gt;to&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;be&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Jest
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;loginService&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;./loginService&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nx"&gt;describe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;loginService&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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;it&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;should return true if valid user id&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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;loginService&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;isValidUserId&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;abc123&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)).&lt;/span&gt;&lt;span class="nx"&gt;toBeTruthy&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see from the basic scenario that has been given there isn't a whole lot of difference in the approaches here. It's more a question of personal preference on their assertion APIs in my opinion.&lt;/p&gt;

&lt;h3&gt;
  
  
  Scenario 2:
&lt;/h3&gt;

&lt;p&gt;I want to unit test my user service on the action of getting their profile.&lt;/p&gt;

&lt;h3&gt;
  
  
  Mocha
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;Side note: For us to be able to mock out external modules in Mocha, we are going to need to install another package called 'sinon'. This will allow us to set spies on certain functions and also replace functions with mock ones.&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&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;expect&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;should&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;chai&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;sinon&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;sinon&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;loginService&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;./loginService&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;userRepository&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;../repositories/user&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nx"&gt;describe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;loginService&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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;it&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;should fetch a user profile given a user id&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="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;expectedReturnObject&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;abc123&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="na"&gt;username&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;joebloggs97&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;getStub&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;sinon&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;stub&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;userRepository&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;get&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nx"&gt;getStub&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;returns&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;expectedReturnObject&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;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;loginService&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getUserProfile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;expectedReturnObject&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nx"&gt;expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;to&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;equal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;expectedReturnObject&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nx"&gt;expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;getStub&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;calledOnce&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;to&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;be&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Jest
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;loginService&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;./loginService&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;userRepository&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;../repositories/user&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;mockGet&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;jest&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;fn&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="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;abc123&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="na"&gt;username&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;joebloggs97&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="nx"&gt;jest&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;mock&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;../repositories/user&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="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="na"&gt;get&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;mockGet&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="nx"&gt;describe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;loginService&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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;it&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;should fetch a user profile given a user id&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="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;expectedReturnObject&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;abc123&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="na"&gt;username&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;joebloggs97&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;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;loginService&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getUserProfile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;expectedReturnObject&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nx"&gt;expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;toEqual&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;expectedReturnObject&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nx"&gt;expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;mockGet&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;toHaveBeenCalledOnce&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see here in the first example with mocha we are fairly reliant on 3 libraries to achieve what Jest can do itself. Also, I feel the APIs of Sinon combined with chai really do make for much more difficult reading as opposed to jest. From a quick glance, it's obvious what Jest is asserting, whereas in the Mocha sample. To me, it takes a lot more from a glance to understand what assertions are taking place.&lt;/p&gt;

&lt;h3&gt;
  
  
  So now we know what the options are, how they are used, what is their documentation like?
&lt;/h3&gt;

&lt;p&gt;Well quite honestly having used both Jest was a lot easier to navigate and find answers to. Just like their API's, everything is fluent and a breeze working with Jest. It seems like as well the community is a lot larger and a lot more problems have been solved around the web. Making it easier to google issues. Compared to the 3 different libraries with their own documentation in the Mocha implementation. It can be a bit tricky to know which one to look at and how to use google with them.&lt;/p&gt;

&lt;h2&gt;
  
  
  Closing Thoughts
&lt;/h2&gt;

&lt;p&gt;Overall both of these solutions achieve the same goal, just they approach the problem differently. Personally, I have used Jest a lot longer than the Mocha alternative and for me, the simplicity of setting up and implementing Jest is a lot easier than Mocha.&lt;/p&gt;

&lt;h3&gt;
  
  
  Helpful Links:
&lt;/h3&gt;

&lt;p&gt;Jest: &lt;a href="https://jestjs.io/en/"&gt;https://jestjs.io/en/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Mocha: &lt;a href="https://mochajs.org/"&gt;https://mochajs.org/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Chai: &lt;a href="https://www.chaijs.com/"&gt;https://www.chaijs.com/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;SinonJs: &lt;a href="https://sinonjs.org/"&gt;https://sinonjs.org/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let me know in the comments below your thoughts and experiences! 👇&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>testing</category>
      <category>beginners</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>Why Netlify has mastered CI/CD</title>
      <dc:creator>Will Holmes</dc:creator>
      <pubDate>Mon, 11 Jan 2021 22:29:56 +0000</pubDate>
      <link>https://dev.to/willholmes/why-netlify-has-mastered-ci-cd-4dhn</link>
      <guid>https://dev.to/willholmes/why-netlify-has-mastered-ci-cd-4dhn</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;In a world where we want access to everything 24/7 and want it instantly. Technology has to progress with it. Even though I am only just coming up to 6 years of experience as a developer. I feel the landscape of CI/CD has changed &lt;strong&gt;MASSIVELY&lt;/strong&gt;. Since I set out on my journey.&lt;/p&gt;

&lt;p&gt;I remember that years ago I was deploying .NET solutions via either a dedicated server or a virtual machine, simply by publishing the output then using FileZilla take that output and put it on the server. That was what worked (kind-of). .NET back then was in its framework ages, .NET Core was not much more than a glimmer.&lt;/p&gt;

&lt;p&gt;Fast forward to today, you can literally get a free CI/CD pipeline based on your git commits integrated into your repository. In a few clicks. With hosting so freely / widely accessible, it's truly amazing how easy it is these days to get world-class CI/CD without an expense being paid on your behalf.&lt;/p&gt;

&lt;h1&gt;
  
  
  What is Netlify?
&lt;/h1&gt;

&lt;p&gt;Netlify is a web development platform that will allow you to link up to your git repositories and have a domain, environment, ci/cd pipeline all setup and configured from its UI (As well as a ton of other stuff). It essentially encapsulates all the things that typically you would need to be an expert in DevOps to do, but made simple. &lt;/p&gt;

&lt;p&gt;Netlify essentially takes the process of deploying a web application (react, angular, vue, etc) and makes it so simple. You can take advantage of their CLI or opt for their intuitive UI. Their UI takes 4 clicks in total to get a git repository and deploy it on their servers with a subdomain. It's that simple. You can view your builds in progress with logs, trigger new builds, and more.&lt;/p&gt;

&lt;p&gt;It has solved a problem that is so needed given how much is required of developers to know to get a web app, service, website out onto the internet. It's hard enough keeping up to date with the latest Javascript framework for example!&lt;/p&gt;

&lt;h2&gt;
  
  
  What would I use Netlify for?
&lt;/h2&gt;

&lt;p&gt;If you want:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Continuous Integration&lt;/li&gt;
&lt;li&gt;Continuous Deployment&lt;/li&gt;
&lt;li&gt;A new environment created with a domain for each pull request&lt;/li&gt;
&lt;li&gt;Domain management&lt;/li&gt;
&lt;li&gt;Analytics&lt;/li&gt;
&lt;li&gt;A/B Testing on branches&lt;/li&gt;
&lt;li&gt;Environment specific behavior&lt;/li&gt;
&lt;li&gt;Custom config files for your environments&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For free, then you should definitely look into Netlify 😉&lt;/p&gt;

&lt;p&gt;Honestly, you get all of that for free. Meaning you do not need to even start with picking a cloud provider and figuring out what resources to provision. You just use their service through a few buttons and you're up and running.&lt;/p&gt;

&lt;h2&gt;
  
  
  But that is only for frontend projects...?
&lt;/h2&gt;

&lt;p&gt;True, but that is where other providers such as Heroku come into play. Heroku for example has near-exact functionality that Netlify does (CI/CD) but can support your NodeJs services and many more types of languages. This means that regardless of what your need is for hosting (backend service, frontend app) there is a provider that can suit your needs. I currently use both, Netlify for my frontend solutions and Heroku for my backend solutions.&lt;/p&gt;

&lt;h2&gt;
  
  
  But what about Github pages?
&lt;/h2&gt;

&lt;p&gt;Again, that is a good point because as Github becomes even more enhanced in it's CI/CD actions it might be simpler for you to plug into Github pages. But again this is where it depends on your requirements. You won't get out the box monitoring and analytics from Github, however, for a small fee you can get things like Analytics from Netlify seamlessly. I also think the domain management is outstanding from Netlify. I've managed to manage my domains with ease and set up email domains etc all from the panel. Something that as a PAAS offering Netlify offers, whereas Github won't. Again, it all depends on your requirements.&lt;/p&gt;

&lt;h2&gt;
  
  
  My Netlify workflow
&lt;/h2&gt;

&lt;p&gt;So with my Netlify site all hooked up to my Github repository as soon as I commit to my &lt;em&gt;main&lt;/em&gt; branch, it will go and deploy to production. However, if I open a pull request it behaves a little differently. See below 👇&lt;/p&gt;

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

&lt;p&gt;As you can see above it outlines the process of my main branch at the top and my pull requests below it. It's really sophisticated and I'm actually really grateful that I have access to this type of infrastructure, free and easy to access.&lt;/p&gt;

&lt;h2&gt;
  
  
  Closing thoughts...
&lt;/h2&gt;

&lt;p&gt;My opinion on Netlify as an offering is that it has really mastered and spotted the gap in the market for developers to build apps without worrying how they would host it, integrate it, monitor it and most of all maintain it. Like I mentioned earlier it's hard enough to keep up with the latest Javascript framework let alone cloud-based DevOps. If you want to dig a bit deeper on Netlify I will leave some links below.&lt;/p&gt;

&lt;h3&gt;
  
  
  Useful resources
&lt;/h3&gt;

&lt;p&gt;Netlify Docs: &lt;a href="https://docs.netlify.com/" rel="noopener noreferrer"&gt;https://docs.netlify.com/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Heroku Docs: &lt;a href="https://devcenter.heroku.com/start" rel="noopener noreferrer"&gt;https://devcenter.heroku.com/start&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What are your thoughts on the likes of Netlify and Heroku? What do you use yourself? Let me know in the comments below! 👇&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>webdev</category>
      <category>netlify</category>
      <category>javascript</category>
    </item>
    <item>
      <title>TailwindCSS vs Styled-Components in ReactJs</title>
      <dc:creator>Will Holmes</dc:creator>
      <pubDate>Sun, 10 Jan 2021 17:01:58 +0000</pubDate>
      <link>https://dev.to/willholmes/tailwindcss-vs-styled-components-in-reactjs-188j</link>
      <guid>https://dev.to/willholmes/tailwindcss-vs-styled-components-in-reactjs-188j</guid>
      <description>&lt;p&gt;A few days ago I posted a new blog post in which I detailed my experience with styled-components, and how it was a nice way of incorporating dynamic styling into the js domain staying away from CSS files. I later found out about yet another way to incorporate styling into your applications... that was TailwindCSS.&lt;/p&gt;

&lt;p&gt;I had seen some conversation around this before as well as a lot of videos and posts mentioning TailwindCSS but thought nothing more of it. So seeing as I had been told of it again and also wanted to try it out so I could compare my experiences. I decided to build a website utilizing Tailwind for styling.&lt;/p&gt;

&lt;h1&gt;
  
  
  What should I know as basics?
&lt;/h1&gt;

&lt;p&gt;To get you started and to understand this read it's important to know that:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;TailwindCSS is a package full of pre-built classes to style your components however, they are so flexible that you can do anything with them!&lt;/li&gt;
&lt;li&gt;You do not need to know CSS to use TailwindCSS.&lt;/li&gt;
&lt;li&gt;TailwindCSS uses a lot of abbreviations i.e. (pb is padding-bottom), so it's important that you read the documentation and use its search function if you are ever unsure.&lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  Tailwind... more like bootstrap!?
&lt;/h1&gt;

&lt;p&gt;I have to say my initial impressions of Tailwind are positive. It takes a lot of the semantics of bootstrap and has almost extended them so much that you never have to use media queries in direct CSS to toggle differences in styling. Instead, you would do something like the below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt; &lt;span class="nt"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;"pb-10 sm:pb-12 md:pb-8 lg:pb-4"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;Hello&lt;/span&gt; &lt;span class="nt"&gt;world&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To those who have used styling frameworks before such as Material UI, Bootstrap, etc. You will understand the usages of these different media breakpoints (&lt;em&gt;sm, md, lg, etc.&lt;/em&gt;). These are essentially saying '&lt;em&gt;When my device size is lower than small apply a padding-bottom of 10. When my device size is small (sm) or greater apply a padding-bottom of 12. When my device size is medium (md) or greater apply a padding-bottom of 8. When my device size is large (lg) or greater apply a padding-bottom of 4&lt;/em&gt;'. I must say, it took me a while to really understand the technique of saying there is no 'xs' breakpoint which is what you would typically find in bootstrap for example. Simply that any device which is lower than sm inherits tailwind classes without a media breakpoint like the above 'pb-10'.&lt;/p&gt;

&lt;h1&gt;
  
  
  But hang on... that looks like a lot of classes?
&lt;/h1&gt;

&lt;p&gt;That's true and it's something that did put a bit of a dampener on my view of the framework. With having so many utility classes being added on to each element it's very easy to end up with huge class property values. This can easily cause things like useless classes remaining on elements that aren't necessarily needed etc. A good package to use is the &lt;a href="https://www.npmjs.com/package/classnames"&gt;classNames&lt;/a&gt; package that will combine class names together. Allowing you to format your elements a little cleaner.&lt;/p&gt;

&lt;h1&gt;
  
  
  How does TailwindCSS compare to styled-components?
&lt;/h1&gt;

&lt;p&gt;Something I really liked about &lt;strong&gt;styled-components&lt;/strong&gt;, was how simple it made your components look. Being able to create a styled div and reference it like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Wrapper&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;styled&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="s2"&gt;`
padding-bottom: 10px;
@media (min-width: 768px) {
    padding-bottom: 20px;
}
`&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;TestComponent&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="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Wrapper&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        Hello world!
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Wrapper&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This to me, keeps component code so clean and concise allowing the components to focus on logic and not looks. You could even go one step further, and abstract your stylings out to a separate js file within your component domain. However, let's see what this looks like in &lt;strong&gt;TailwindCSS&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;TestComponent&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="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"pb-10 md:pb-20"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        Hello World!
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;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 here, TailwindCSS actually reduces the number of lines of code we have to write to achieve the same goal. This is its whole intention with the utility class approach. It really does simplify writing styled elements. However, this is all well and good for our elements with only a few styles. Let's take a look at the comparisons of more heavily styled components:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;styled-components&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Button&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;styled&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt;&lt;span class="s2"&gt;`
    font-size: 1rem;
    margin: 1rem;
    padding: 1rem 1rem;
    @media (min-width: 768px) {
        padding: 2rem 2rem;
    }
    border-radius: 0.25rem;
    border: 2px solid blue;
    background-color: blue;
    color: white;
`&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;TestComponent&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="p"&gt;&amp;lt;&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Button&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
            Hello world!
        &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Button&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;TailwindCSS&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;TestComponent&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="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"text-base mg-1 pt-1 pr-1 md:pt-2 md:pr-2 rounded border-solid border-2 border-light-blue-500 bg-blue-500 text-white-500"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        Hello World!
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;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 from the above comparisons, styled-components really does take the lead now as our component has grown in styling rules. Tailwind's implementation is so verbose in classNames and without using a package like &lt;a href="https://www.npmjs.com/package/classnames"&gt;classNames&lt;/a&gt; it really makes our lines a lot longer than they should be. This is one of the biggest downfalls for Tailwind in my opinion. &lt;/p&gt;

&lt;p&gt;Especially if you are working on a project with multiple developers, the styled-components approach allows you to easily read what stylings the Button component has. In comparison to the Tailwind approach, you would most likely have to lookup in the docs some of those util classes to understand precise values.&lt;/p&gt;

&lt;p&gt;Compare this example to the first example. Tailwind just screamed simplicity. This follow up example just consists of complexity and a high risk of spaghetti code. It only takes multiple developers to be working on a few components at the same time for styles to be easily ruined/disrupted and then spending time removing certain util classes to find out the root cause. In comparison to the styled-components way of doing things where we still rely on our raw CSS changes it is a lot easier to manage change in my opinion.&lt;/p&gt;

&lt;h1&gt;
  
  
  So, who takes home the trophy?
&lt;/h1&gt;

&lt;p&gt;Well... to be honest, I wouldn't say either of these two trumps each other. Both have their benefits and disadvantages which have been demonstrated in this article. I'd say if you are looking for a quick way to style a website or single pager with not much complexity; then TailwindCSS might be best for you. Mainly due to the amount of utility you get out of the box to style your classes. However, if you are looking for a longer-term project that can be more easily maintained. I would advise styled-components due to their more 'robust' feel to it when maintaining styles in my opinion. However, I am not an expert in either of them, I have simply just been building in both of these technologies and these are my initial thoughts.&lt;/p&gt;

&lt;h1&gt;
  
  
  Useful Resources:
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;TailwindCSS:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://tailwindcss.com/"&gt;https://tailwindcss.com/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.tailwindtoolbox.com/"&gt;https://www.tailwindtoolbox.com/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://tailwindcomponents.com/"&gt;https://tailwindcomponents.com/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Styled-Components&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://styled-components.com/"&gt;https://styled-components.com/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thank you for reading, let me know in the comments below if you have used either of these or maybe both and how you found using them! 👇&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>css</category>
      <category>javascript</category>
      <category>react</category>
    </item>
    <item>
      <title>Material UI Theme for JetBrains Rider</title>
      <dc:creator>Will Holmes</dc:creator>
      <pubDate>Tue, 05 Jan 2021 18:41:29 +0000</pubDate>
      <link>https://dev.to/willholmes/material-ui-theme-for-jetbrains-rider-2ddp</link>
      <guid>https://dev.to/willholmes/material-ui-theme-for-jetbrains-rider-2ddp</guid>
      <description>&lt;p&gt;From the evolution of the dark theme, developers now have a wide choice of color themes in most modern development IDE's that go beyond &lt;em&gt;Light&lt;/em&gt; and &lt;em&gt;Dark&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Ever since the release of Visual Studio Code, I have become a sucker for a nice color theme in my IDE's. To a point where I change my mind every other day. When using other IDE's such as Visual Studio 2020 you don't have to use it long to realize that the ecosystem of themes is pretty outdated.&lt;/p&gt;

&lt;p&gt;However, I have been using JetBrains Rider for some time and have accepted their default themes as ones that are nice to develop in. But I've been wondering recently as to whether there are more advanced and customized themes out there.&lt;/p&gt;

&lt;h2&gt;
  
  
  Custom theming discovered...
&lt;/h2&gt;

&lt;p&gt;After doing some digging around I realized that there is actually a huge ecosystem of themes out there for JetBrains Rider. With it being in parity to JetBrains IntelliJ a lot of similarities persist which has enabled theme building.&lt;/p&gt;

&lt;h2&gt;
  
  
  Material UI Theme
&lt;/h2&gt;

&lt;p&gt;Having used Material UI in other IDE's such as Visual Studio Code I was amazed that we also have a port of this for JetBrains Rider. Meaning that my development in C# can be done in an IDE that now looks even more visually pleasing! You can download and install it via the plugins menu in Rider or read more here: &lt;a href="https://www.material-theme.com/"&gt;https://www.material-theme.com/&lt;/a&gt; .&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--desFclnL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/mcej537sk3u7byo3otgp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--desFclnL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/mcej537sk3u7byo3otgp.png" alt="Screenshot"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Above you can see what this theme looks like in practice. It's a beautiful implementation of the Material theme into the Rider IDE. Syntax highlighting isn't off and the icon pack is really minimalistic.&lt;/p&gt;

&lt;p&gt;Just like for many developers, a setup that consists of a &lt;strong&gt;&lt;em&gt;mechanical keyboard&lt;/em&gt;&lt;/strong&gt; that suits them is very important. Selecting the right theme for your &lt;strong&gt;&lt;em&gt;development IDE&lt;/em&gt;&lt;/strong&gt; that you will go to &lt;strong&gt;&lt;em&gt;battle&lt;/em&gt;&lt;/strong&gt; with &lt;strong&gt;&lt;em&gt;every day&lt;/em&gt;&lt;/strong&gt; is just as &lt;strong&gt;&lt;em&gt;important&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Thanks for reading, let me know in the comments below which theme's you like to use in your IDE 👇&lt;/p&gt;

</description>
      <category>csharp</category>
      <category>tooling</category>
      <category>dotnet</category>
      <category>webdev</category>
    </item>
    <item>
      <title>An intro to styled components in your react project</title>
      <dc:creator>Will Holmes</dc:creator>
      <pubDate>Sun, 03 Jan 2021 20:51:37 +0000</pubDate>
      <link>https://dev.to/willholmes/an-intro-to-styled-components-in-your-react-project-2ooc</link>
      <guid>https://dev.to/willholmes/an-intro-to-styled-components-in-your-react-project-2ooc</guid>
      <description>&lt;p&gt;CSS as a means of styling your web apps / websites is confusing, complex and can soon spiral out of control if you do not enforce a strict way of styling throughout your project.&lt;/p&gt;

&lt;p&gt;This is mostly down to the fact that the semantics of it are odd and can be quite restrictive. For example, no for loops or functions. However, you do get the luxury of targeting elementIds, classes and others. &lt;/p&gt;

&lt;h2&gt;
  
  
  Tried but didn't achieve greatness...
&lt;/h2&gt;

&lt;p&gt;There have been attempts to try and solve these problems with the likes of CSS pre-processors. These allow you to create styles in their own format which get transpiled down to CSS some popular examples might be SASS, LESS, SCSS etc. However, these come with their own problems. Such as they all can end up with the same issue of overcrowding of stylesheets like in CSS.&lt;/p&gt;

&lt;h2&gt;
  
  
  So what are styled components?
&lt;/h2&gt;

&lt;p&gt;We are starting to live in a world whereby a large proportion of web apps are being developed in react. With this in mind styled components has been developed to be used alongside react when developing your websites / web apps. It takes the fundamentals of CSS and applies them to be closely integrated with our components. The main point is that we are no longer styling elements based on their type, elementId or className. We are now styling them as their own 'components' that are 'styled'. &lt;/p&gt;

&lt;p&gt;Let's break this down in an example:&lt;/p&gt;

&lt;h2&gt;
  
  
  React + CSS
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;hello.css&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.helloWorld&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;blue&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;&lt;strong&gt;hello.js&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;HelloWorld&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="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"helloWorld"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Hello World!&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;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 above demonstrates the way we are used to with a HTML / CSS world. This allows us to have a file to determine how elements should look and feel &lt;strong&gt;(hello.css)&lt;/strong&gt;. Alongside a file that allows us to construct our elements in a way that creates an experience &lt;strong&gt;(hello.js)&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  React + Styled Components
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;hello.js&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;styled&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;styled-components&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;HelloHeader&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;styled&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="s2"&gt;`
color: blue;
`&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;HelloWorld&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="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;HelloHeader&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Hello World!&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;HelloHeader&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now from a glance this may look like a trivial change that has simply moved the CSS away from the individual file, into the component file. However, that is exactly the point. The styles now sit within the component where they are being used. This means that we are no longer relying on CSS classes or elementIds to style our components.&lt;/p&gt;

&lt;p&gt;One of the main goals of styled-components is that it &lt;em&gt;'wants to remove the mapping between styles and components'.&lt;/em&gt; By incorporating our styles into our react code as 'components' we are now bridging that gap and allowing for more readable code from the outset. Gone are the days where a div has been styled by a stylesheet sitting tens of folders deep within a big codebase.&lt;/p&gt;

&lt;h1&gt;
  
  
  My thoughts?
&lt;/h1&gt;

&lt;p&gt;Whilst styled-components is still a fairly new kid on the block it's definitley something I am going to keep playing with and seeing its potential. Since working on my personal website I have discovered it's benefits and how it fits into a project. I'm sure there are some points it falls behind on but with every new piece of disruptive tech, that's to be expected. As i progress further with styled-components I will be sure to blog again with my more advanced thoughts.&lt;/p&gt;

&lt;h3&gt;
  
  
  Helpful Links:
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Styled Components&lt;/strong&gt;: &lt;a href="https://styled-components.com/"&gt;https://styled-components.com/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let me know below in the comments if you have used styled-components in your react projects. If so, how did you find it? 👇&lt;/p&gt;

</description>
      <category>react</category>
      <category>webdev</category>
      <category>css</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Building a portfolio site in GatsbyJS</title>
      <dc:creator>Will Holmes</dc:creator>
      <pubDate>Fri, 01 Jan 2021 16:40:10 +0000</pubDate>
      <link>https://dev.to/willholmes/building-a-portfolio-site-in-gatsbyjs-12i5</link>
      <guid>https://dev.to/willholmes/building-a-portfolio-site-in-gatsbyjs-12i5</guid>
      <description>&lt;h1&gt;
  
  
  Why do I want a portfolio site?
&lt;/h1&gt;

&lt;p&gt;I wanted to build a portfolio site so that I can experiment with new technologies and also showcase what I have been working on recently. In addition to this, it also allows me to keep refining my skills and testing out new ways of building things without the fear of breaking changes with brand new tech.&lt;/p&gt;

&lt;h1&gt;
  
  
  What Is Gatsby?
&lt;/h1&gt;

&lt;p&gt;I'd heard a lot of buzz about Gatsby but never fully understood what it was. Turns out it's pretty powerful and really simple to use. If you've ever had the pleasure of working with NextJS then it's a fairly similar concept.&lt;/p&gt;

&lt;p&gt;Gatsby is a static site generator that allows you to build websites and progressive web apps using modern javascript tools / utils / frameworks such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;ReactJS&lt;/li&gt;
&lt;li&gt;Webpack&lt;/li&gt;
&lt;li&gt;GraphQL&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Why Gatsby?
&lt;/h1&gt;

&lt;p&gt;As I wanted to build a portfolio &lt;strong&gt;website&lt;/strong&gt; I want to optimise load times for my users. So having a traditional React web app to serve this up didn't make sense. But I also wanted the benefits of developing in the React ecosystem which meant a traditional html / css / js route wasn't favorable. With Gatsby compiling our React app into static assets it also means that load times will be a lot faster than without using it. A key selling factor for me.&lt;/p&gt;

&lt;h1&gt;
  
  
  So how did it go?
&lt;/h1&gt;

&lt;p&gt;After reading a few articles and the documentation for Gatsby it was pretty clear to see how neat it is. I love how dev friendly the CLI is for Gatsby. To get started you need to run the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="nx"&gt;npm&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;g&lt;/span&gt; &lt;span class="nx"&gt;gatsby&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nx"&gt;save&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once you have installed Gatsby you can then run the following to get started with a brand new project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="nx"&gt;gatsby&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;my&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;brand&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;website&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then once it's finished installing and configuring you can run the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="nx"&gt;cd&lt;/span&gt; &lt;span class="nx"&gt;my&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;brand&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;website&lt;/span&gt;
&lt;span class="nx"&gt;npm&lt;/span&gt; &lt;span class="nx"&gt;run&lt;/span&gt; &lt;span class="nx"&gt;develop&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then you should be greeted to a template website that has been created for you with navigation all setup and examples of how to build in Gatsby, setting you up for success!&lt;/p&gt;

&lt;p&gt;What stood out to me was how nice the functionality they provide out the box is. An SEO component is created for you which you simply implement into all of your pages and is very extensible. This sort of helping hand when onboarding developers onto your framework is what sets aside the competition.&lt;/p&gt;

&lt;p&gt;Plugins are what Gatsby's ecosystem really relies on. There is pretty much a plugin to do anything needed for your website in the Gatsby world. For example, I wanted to optimise how I load content into my website. So I wanted to be able to add markdown files as part of my 'content' folder and read them in my components without having my content sitting hard coded in my components or pages. To do this all I had to do was install a plugin called &lt;strong&gt;gatsby-transformer-remark&lt;/strong&gt;. Then add a little configuration to my Gatsby setup:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="nx"&gt;plugins&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="na"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`gatsby-transformer-remark`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;options&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="c1"&gt;// CommonMark mode (default: true)&lt;/span&gt;
      &lt;span class="na"&gt;commonmark&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="c1"&gt;// Footnotes mode (default: true)&lt;/span&gt;
      &lt;span class="na"&gt;footnotes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="c1"&gt;// Pedantic mode (default: true)&lt;/span&gt;
      &lt;span class="na"&gt;pedantic&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="c1"&gt;// GitHub Flavored Markdown mode (default: true)&lt;/span&gt;
      &lt;span class="na"&gt;gfm&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="c1"&gt;// Plugins configs&lt;/span&gt;
      &lt;span class="na"&gt;plugins&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="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;Now I can call my markdown files from GraphQL queries inside my components or pages meaning the content sits in a content directory and my components and pages are in their own worlds too.&lt;/p&gt;

&lt;p&gt;Once I understood this concept of doing things, I realised the power of Gatsby.&lt;/p&gt;

&lt;h1&gt;
  
  
  Closing thoughts...
&lt;/h1&gt;

&lt;p&gt;Overall I really enjoyed using Gatsby to build my portfolio site. I will definitely be upgrading and getting more involved with it overtime as it is a fun and powerful tool to use. I didn't experience anything that put me off of using it. So for me it's full steam ahead!&lt;/p&gt;

&lt;p&gt;Have you used Gatsby before? If so how did you find using it?&lt;/p&gt;

&lt;p&gt;Let me know in the comments below! 👇&lt;/p&gt;

</description>
      <category>gatsby</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Docker 101 - For Beginners</title>
      <dc:creator>Will Holmes</dc:creator>
      <pubDate>Sun, 13 Dec 2020 23:34:20 +0000</pubDate>
      <link>https://dev.to/willholmes/docker-101-for-beginners-18fi</link>
      <guid>https://dev.to/willholmes/docker-101-for-beginners-18fi</guid>
      <description>&lt;h2&gt;
  
  
  What is it?
&lt;/h2&gt;

&lt;p&gt;Docker is a containerization platform that bundles your applications and all their dependencies into something called a 'Docker container' so that your application can run agnostic of what environment it is in. This also ensures that your application can run quickly and reliably from each environment.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.docker.com%2Fsites%2Fdefault%2Ffiles%2Fd8%2Fstyles%2Flarge%2Fpublic%2F2018-11%2Fcontainer-what-is-container.png%3Fitok%3Dvle7kjDj" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.docker.com%2Fsites%2Fdefault%2Ffiles%2Fd8%2Fstyles%2Flarge%2Fpublic%2F2018-11%2Fcontainer-what-is-container.png%3Fitok%3Dvle7kjDj" alt="https://www.docker.com/sites/default/files/d8/styles/large/public/2018-11/container-what-is-container.png?itok=vle7kjDj"&gt;&lt;/a&gt;&lt;br&gt;
Credit: &lt;a href="https://www.docker.com/resources/what-container" rel="noopener noreferrer"&gt;https://www.docker.com/resources/what-container&lt;/a&gt; 👆&lt;/p&gt;
&lt;h2&gt;
  
  
  When should I use it?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;When you want to ship your app across multiple environments and get the same expected behavior consistently on them.&lt;/li&gt;
&lt;li&gt;When you want to minimise the risk of '&lt;strong&gt;it works on my machine&lt;/strong&gt;' development.&lt;/li&gt;
&lt;li&gt;When you want to enable CI/CD within your development teams. Using docker containers means that your build pipelines can all use the same set of instructions to validate new code changes to your applications.&lt;/li&gt;
&lt;li&gt;When you want to enable application development for developers who might not all use the same operating system but experience the same application performance.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  When should I not use it?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;If building a backend API could you split the API into a collection of serverless functions (AWS Lambda's, Azure functions, etc...). This would be much more cost-efficient and speedy than Docker. Due to it's set up but also because Docker will need to run on a dedicated piece of computing power all the time. Whereas serverless only uses compute power when it is needed.&lt;/li&gt;
&lt;li&gt;If you require persistent volumes for data storage, this can be challenging to maintain with Docker.&lt;/li&gt;
&lt;li&gt;An added layer of complexity to host your applications will mean that you need to put more pressure on your hosting machine.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  How is it used?
&lt;/h2&gt;

&lt;p&gt;Firstly for your application, you are going to need to write a 'Dockerfile' at the root of your project. This will contain a set of instructions to tell the Docker agent how to build your container. &lt;/p&gt;

&lt;p&gt;See the example below:&lt;/p&gt;

&lt;p&gt;We pull &lt;strong&gt;from&lt;/strong&gt; '&lt;strong&gt;alpine&lt;/strong&gt;' which is a lightweight linux image to base our container from.&lt;/p&gt;

&lt;p&gt;Then we run a bash command to echo the words 'Hello world!'&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="nx"&gt;FROM&lt;/span&gt; &lt;span class="nx"&gt;alpine&lt;/span&gt;
&lt;span class="nx"&gt;CMD&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;echo&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;Hello world!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Save the above file as 'Dockerfile'&lt;/p&gt;

&lt;p&gt;Then run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="nx"&gt;docker&lt;/span&gt; &lt;span class="nx"&gt;build&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;t&lt;/span&gt; &lt;span class="nx"&gt;hello&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;
&lt;span class="nx"&gt;docker&lt;/span&gt; &lt;span class="nx"&gt;run&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nx"&gt;rm&lt;/span&gt; &lt;span class="nx"&gt;hello&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will build the Docker image firstly and give it a tag name of 'hello' and scope the Dockerfile to the root of the directory as we specified the &lt;strong&gt;'.'&lt;/strong&gt; character.&lt;/p&gt;

&lt;p&gt;Then it will run the container and kill it after.&lt;/p&gt;

&lt;p&gt;Which should output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="nx"&gt;Hello&lt;/span&gt; &lt;span class="nx"&gt;world&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;🎉 &lt;strong&gt;Congratulations!&lt;/strong&gt; 🎉 You've just built your first Docker container.&lt;/p&gt;

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

&lt;p&gt;To summarise, Docker is a great way of bundling your applications up for development across multiple environments and enabling multiple developers to work on active app development. It will enable a lot more sophistication in your CI/CD process going forward but, at the cost of a more heavyweight solution (compute required and time spent getting setup). It's important to think about serverless and if it can fit your needs as opposed to containerization. But hopefully this has given you a brief enough insight into Docker that you can start making informed decisions going forward.&lt;/p&gt;

&lt;p&gt;Download and Install Docker from here: &lt;a href="https://docs.docker.com/get-docker/" rel="noopener noreferrer"&gt;https://docs.docker.com/get-docker/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Documentation: &lt;a href="https://docs.docker.com/engine/reference/commandline/docker/" rel="noopener noreferrer"&gt;https://docs.docker.com/engine/reference/commandline/docker/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>docker</category>
      <category>serverless</category>
      <category>webdev</category>
      <category>codenewbie</category>
    </item>
  </channel>
</rss>
