<?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: Aivan Monceller</title>
    <description>The latest articles on DEV Community by Aivan Monceller (@geocine).</description>
    <link>https://dev.to/geocine</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%2F122729%2Fa5476c2a-b00b-4cb3-8b75-ea0a11213d30.png</url>
      <title>DEV Community: Aivan Monceller</title>
      <link>https://dev.to/geocine</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/geocine"/>
    <language>en</language>
    <item>
      <title>Creating Your Own Personalized Avatars with AI</title>
      <dc:creator>Aivan Monceller</dc:creator>
      <pubDate>Mon, 02 Jan 2023 08:03:40 +0000</pubDate>
      <link>https://dev.to/geocine/creating-your-own-personalized-avatars-with-ai-30c6</link>
      <guid>https://dev.to/geocine/creating-your-own-personalized-avatars-with-ai-30c6</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmyo05zfsl6utq8w11hx4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmyo05zfsl6utq8w11hx4.png" alt="Stable Diffusion generated Avatars" width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Have you ever wanted to create your own personalized avatars from photos, but found the process to be difficult or expensive? With the advent of artificial intelligence, it has become easier than ever to create unique and striking images using your own photos as a reference.&lt;/p&gt;

&lt;p&gt;I have created a Google Colab tool that allows you to do just that, and it's completely free to use with just a Google account. This tool is based on the latest AI technology and allows you to train an AI text-to-image generator called Stable Diffusion.&lt;/p&gt;

&lt;p&gt;To get started, simply upload your photos and follow the prompts to begin training the model. You can adjust the settings to fine-tune the model's performance and improve the accuracy of the generated images. Once you are satisfied with the results, you can save the model to your Google Drive and use it to generate images anytime.&lt;/p&gt;

&lt;p&gt;This is a great opportunity to explore the capabilities of AI and see how it can be used to create novel and striking images. Give it a try and see what you can create!&lt;/p&gt;

&lt;p&gt;Link to Google Colab below 👇🏼&lt;/p&gt;

&lt;p&gt;&lt;a href="https://colab.research.google.com/github/geocine/sd-easy-mode/blob/main/EasyMode_Stable_Diffusion.ipynb" rel="noopener noreferrer"&gt;https://colab.research.google.com/github/geocine/sd-easy-mode/blob/main/EasyMode_Stable_Diffusion.ipynb&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>machinelearning</category>
      <category>tutorial</category>
      <category>deeplearning</category>
    </item>
    <item>
      <title>3 Common Misconceptions about JSX</title>
      <dc:creator>Aivan Monceller</dc:creator>
      <pubDate>Fri, 05 Jun 2020 14:09:09 +0000</pubDate>
      <link>https://dev.to/geocine/3-common-misconceptions-about-jsx-3di7</link>
      <guid>https://dev.to/geocine/3-common-misconceptions-about-jsx-3di7</guid>
      <description>&lt;p&gt;I have personally held the distaste of seeing JSX being used in React. For years, I had very strong opinions against using it until I had no other choice but to learn it.&lt;/p&gt;

&lt;p&gt;I want to share 3 misconceptions I had and how I realized that these things were not entirely true when you look at it from a certain point of view. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;You're going to find that many of the truths we cling to depend greatly on our own point of view - Obiwan Kenobi&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I will not try to preach that JSX has without any flaws. As with other tools, a tool is only as good as how you would use it. &lt;/p&gt;

&lt;p&gt;&lt;a href="http://facebook.github.io/jsx/" rel="noopener noreferrer"&gt;JSX&lt;/a&gt; is now being used even outside of &lt;a href="https://reactjs.org/" rel="noopener noreferrer"&gt;React&lt;/a&gt;, on projects like &lt;a href="https://github.com/mdx-js/mdx" rel="noopener noreferrer"&gt;MDX&lt;/a&gt;, &lt;a href="https://vuejs.org/v2/guide/render-function.html#JSX" rel="noopener noreferrer"&gt;VueJS&lt;/a&gt;, &lt;a href="https://stenciljs.com/docs/my-first-component" rel="noopener noreferrer"&gt;StencilJS&lt;/a&gt;, &lt;a href="https://github.com/ryansolid/solid" rel="noopener noreferrer"&gt;SolidJS&lt;/a&gt;, &lt;a href="https://github.com/BuilderIO/mitosis" rel="noopener noreferrer"&gt;Mitosis&lt;/a&gt;, &lt;a href="https://github.com/atomicojs/atomico" rel="noopener noreferrer"&gt;AtomicoJS&lt;/a&gt; and &lt;a href="https://github.com/preactjs/preact" rel="noopener noreferrer"&gt;Preact&lt;/a&gt;. In this blog, I will be focusing on the context of React to explain my thoughts regarding JSX.&lt;/p&gt;

&lt;h1&gt;
  
  
  No Separation of Concerns
&lt;/h1&gt;

&lt;p&gt;JSX forces us to mix JavaScript and HTML together. This means that it is trying to force us to go against the mantra of Separation of Concerns due to the mixing of layout &amp;amp; logic.&lt;/p&gt;

&lt;p&gt;Here’s the thing, using JSX to write your presentation code doesn’t necessarily mean giving up these principles. Let us look at this very simple component in React&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="nx"&gt;name&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;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`Hello &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="s2"&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;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;h1&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;There’s no reason why that separation can’t occur in the context of JavaScript. In this example the layout &amp;amp; logic is separated like this:&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="nx"&gt;name&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="c1"&gt;// component logic is confined above the JSX block&lt;/span&gt;
   &lt;span class="c1"&gt;// some logic to form message&lt;/span&gt;
   &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`Hello &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="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

   &lt;span class="c1"&gt;// JSX is confined to this return block&lt;/span&gt;
   &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;h1&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;blockquote&gt;
&lt;p&gt;One important thing to note is that separation of concerns is not equal to separation of file types. In modern UI development, we have found that instead of dividing the codebase into three huge layers that interweave with one another, it makes much more sense to divide them into loosely-coupled components and compose them. Inside a component, its template, logic and styles are inherently coupled, and collocating them actually makes the component more cohesive and maintainable. - &lt;a href="https://vuejs.org/v2/guide/single-file-components.html#What-About-Separation-of-Concerns" rel="noopener noreferrer"&gt;VueJS Documentation&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;To better understand this, let us now try converting this component into an &lt;a href="https://angular.io" rel="noopener noreferrer"&gt;Angular&lt;/a&gt; component.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;Component&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;selector&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;hello-world&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="c1"&gt;// template is confined in this property&lt;/span&gt;
  &lt;span class="na"&gt;template&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`&amp;lt;h1&amp;gt;{{message}}&amp;lt;/h1&amp;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;class&lt;/span&gt; &lt;span class="nc"&gt;HelloWorldComponent&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// component logic is confined in this class&lt;/span&gt;
  &lt;span class="nl"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;Input&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
  &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;set&lt;/span&gt; &lt;span class="nf"&gt;name&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="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// some logic to form message&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`Hello {name}`&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;On Angular, you can separate the template using files.  I will be using MVVM/MVC terms to properly explain what is going on here.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Component &lt;code&gt;Controller&lt;/code&gt;&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;Component&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;selector&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;hello-world&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;templateUrl&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./hello-world.html&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="p"&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Component &lt;code&gt;View&lt;/code&gt;&lt;/em&gt;&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;h1&amp;gt;&lt;/span&gt;{{message}}&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You may say that the template/layout example above is so simple so it doesn't really show the dark side of JSX. We could switch it up a bit by throwing it in a condition.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;JSX&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="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;render&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Angular Template&lt;/em&gt;&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;h1&lt;/span&gt; &lt;span class="na"&gt;*ngIf=&lt;/span&gt;&lt;span class="s"&gt;"render"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;{{message}}&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see above they are just about the same, JSX using JavaScript &amp;amp; HTML, while Angular introducing &lt;code&gt;*ngIf&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;In this case, the conditional logic is actually mixed with the layout on both examples. Be it separated by JavaScript context in React, or separated by files in Angular. &lt;/p&gt;

&lt;p&gt;In React, the layout is in the same file as the component. This gives you a clear idea about the component context and what is available at your disposal. However, you will likely have a very long file as time goes by even in &lt;a href="https://vuejs.org/v2/guide/single-file-components.html" rel="noopener noreferrer"&gt;Vue SFCs&lt;/a&gt;. Luckily, editors nowadays have a way to split the window so that you can work on different sections of the same file.&lt;/p&gt;

&lt;p&gt;Even though I have stated here that you can confine JSX to the &lt;code&gt;return&lt;/code&gt; part of the component. There is definitely no one stopping you from doing this.&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="nx"&gt;name&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;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;`Hello &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="s2"&gt;`&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;;&lt;/span&gt;

   &lt;span class="k"&gt;return&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you have to declare multiple JSX pieces across your component, think of a better way to achieve this using multiple components. &lt;/p&gt;

&lt;h1&gt;
  
  
  Another Templating Syntax
&lt;/h1&gt;

&lt;p&gt;While JSX is claiming that it's easy to learn it because you can write HTML on JavaScript, we can think that it is actually an abomination of what we have been trying to achieve separating HTML and JavaScript. &lt;/p&gt;

&lt;p&gt;On common frontend libraries/frameworks we have actually come up with different solutions to keep the separation between HTML from JavaScript while making HTML dynamic: &lt;a href="https://angular.io/guide/template-syntax" rel="noopener noreferrer"&gt;Angular Template Syntax&lt;/a&gt;, &lt;a href="https://vuejs.org/v2/guide/syntax.html" rel="noopener noreferrer"&gt;VueJS Template Syntax&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Did you notice that there is no such thing as a &lt;em&gt;JSX Template Syntax&lt;/em&gt; or a &lt;em&gt;React Template Syntax&lt;/em&gt;? &lt;a href="https://reactjs.org/docs/introducing-jsx.html" rel="noopener noreferrer"&gt;This&lt;/a&gt; is probably the only page which explains JSX and it's just a very short documentation. Though it looks like it, JSX isn’t a templating engine, in the sense that &lt;a href="https://handlebarsjs.com/guide/" rel="noopener noreferrer"&gt;Handlebars&lt;/a&gt; is a templating engine, similar to what I have linked above. &lt;/p&gt;

&lt;p&gt;JSX is actually more than that, it is a syntax extension for JavaScript. Basically, it extends JavaScript so that HTML/XML like structures can be used with JavaScript.&lt;/p&gt;

&lt;p&gt;If you actually looked at the documentation I linked above, there is a lot to learn to get started with these templating engines as compared to JSX. In JSX, at the bare minimum, you only need to know JavaScript and HTML and a few extra exceptions. Below is an example of rendering items using a loop in JSX.&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="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="nx"&gt;names&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;name&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;li&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;li&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
 &lt;span class="p"&gt;))&lt;/span&gt;&lt;span class="si"&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;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Looking at this you only need to know what the JavaScript &lt;code&gt;.map&lt;/code&gt; does, HTML &lt;code&gt;div&lt;/code&gt; and &lt;code&gt;li&lt;/code&gt; and the extra &lt;code&gt;{}&lt;/code&gt; for evaluating JavaScript code. I know, this does not look clean at first, it looks like an ugly soup of JS mashed with HTML. But, let me walk you through what is happening here.&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="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;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In JSX, HTML and JS is considered a valid JSX. However, to slap JS within an HTML you need to make use of &lt;code&gt;{}&lt;/code&gt;. Now let us look inside the &lt;code&gt;{}&lt;/code&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="nx"&gt;names&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;name&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;li&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;li&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is JavaScript returning a collection of &lt;code&gt;&amp;lt;li/&amp;gt;&lt;/code&gt; which is an HTML but is also considered valid JavaScript in JSX.&lt;/p&gt;

&lt;p&gt;While we can think that React and JSX go against how templates are done in MVVM/MVC frameworks, that is not entirely true. Here are some templating engines on popular backend frameworks that would look very familiar to you.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Blade Templates (PHP)&lt;/em&gt;&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&amp;gt;&lt;/span&gt;
@foreach ($name as $names)
   &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&lt;/span&gt;{{ $name }}&lt;span class="nt"&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
@endforeach
&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;&lt;em&gt;Razor Templates (C#)&lt;/em&gt;&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&amp;gt;&lt;/span&gt;
@foreach (var name in names)
{
  &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&lt;/span&gt;@name&lt;span class="nt"&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
}
&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;&lt;em&gt;Jinja Templates (Python)&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jinja"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&amp;gt;&lt;/span&gt;
&lt;span class="cp"&gt;{%&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="nv"&gt;name&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nv"&gt;names&lt;/span&gt; &lt;span class="cp"&gt;%}&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&lt;/span&gt;&lt;span class="cp"&gt;{{&lt;/span&gt;&lt;span class="nv"&gt;name&lt;/span&gt;&lt;span class="cp"&gt;}}&lt;/span&gt;&lt;span class="nt"&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
&lt;span class="cp"&gt;{%&lt;/span&gt; &lt;span class="k"&gt;endfor&lt;/span&gt; &lt;span class="cp"&gt;%}&lt;/span&gt;
&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;As you can see this is about the same concept in PHP, C#, Python templating engines. You just have to know the language and some extras to actually remember it. &lt;/p&gt;

&lt;p&gt;Now let us go back to the frontend. Let us look at the template engine of Handlebars, VueJS, Angular, and see how looping is implemented.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Handlebars&lt;/em&gt;&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&amp;gt;&lt;/span&gt;
{{#each names}}
   &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&lt;/span&gt;{{this}}&lt;span class="nt"&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
{{/each}}
&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;&lt;em&gt;VueJS&lt;/em&gt;&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&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;li&lt;/span&gt; &lt;span class="na"&gt;v-for=&lt;/span&gt;&lt;span class="s"&gt;"name in names"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;{{name}}&lt;span class="nt"&gt;&amp;lt;li&amp;gt;&lt;/span&gt;
&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;&lt;em&gt;Angular&lt;/em&gt;&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&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;li&lt;/span&gt; &lt;span class="na"&gt;*ngFor=&lt;/span&gt;&lt;span class="s"&gt;"let name of names"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;{{ hero }}&lt;span class="nt"&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
&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;I must admit, these look cleaner in my opinion. But, I think once the props or the attributes get into a certain number, it will be harder to identify the scope and context of control structures. You also have to remember a lot of custom attributes. Other than that, it just takes getting used to. &lt;/p&gt;

&lt;p&gt;To drive my point home, JSX is not a templating engine but it allows us to do what another templating engine has been doing for years. On top of that, it looks very familiar since you are dealing with JavaScript and HTML.&lt;/p&gt;

&lt;p&gt;There are more uses to JSX other than conjuring templates, you can visit the list of links I mentioned in the introduction of this article. If you don't like React, you could still consider using JSX from those projects.&lt;/p&gt;

&lt;p&gt;Personally, it was not React that got me started to like JSX. It was &lt;a href="https://stenciljs.com/docs/my-first-component" rel="noopener noreferrer"&gt;StencilJS&lt;/a&gt;. When I finally got the hang of it, I finally considered giving React a second chance.&lt;/p&gt;

&lt;h1&gt;
  
  
  Too Flexible
&lt;/h1&gt;

&lt;p&gt;I agree that this could be a valid rant. As with things that are too flexible, it could easily be abused. On JSX its not only  JavaScript and HTML that you should look out for. It can also be used with React components which would make it confusing for someone who doesn't know React.&lt;/p&gt;

&lt;p&gt;A React element in JSX is also a function. Hence, JSX can be used to create cryptic code such as this&lt;/p&gt;

&lt;p&gt;&lt;iframe class="tweet-embed" id="tweet-991748861910835200-767" src="https://platform.twitter.com/embed/Tweet.html?id=991748861910835200"&gt;
&lt;/iframe&gt;

  // Detect dark theme
  var iframe = document.getElementById('tweet-991748861910835200-767');
  if (document.body.className.includes('dark-theme')) {
    iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=991748861910835200&amp;amp;theme=dark"
  }



&lt;/p&gt;

&lt;p&gt;You wouldn't probably be doing this although there could be some use cases for this. While I don't have the actual implementation of this code, this could be using React &lt;code&gt;Context&lt;/code&gt; and &lt;code&gt;Render Props&lt;/code&gt; under the hood which is specifically what React provides.&lt;/p&gt;

&lt;p&gt;If you are looking into JSX, it's highly likely you are exploring React and wonder what &lt;code&gt;Render Props&lt;/code&gt; are. I don't want to turn this into a React course but would just try to make a point by showing how &lt;code&gt;Render Props&lt;/code&gt; work.&lt;/p&gt;

&lt;p&gt;I want to create a generic &lt;code&gt;Mouse&lt;/code&gt; component that outputs the x and y coordinates of the mouse within the component. I can then display the x and y coordinate in whatever way I like. So this is how we do it in React using &lt;code&gt;Render Props&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Mouse Component (React)&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Mouse&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;onMouseMove&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;coords&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setCoords&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="na"&gt;x&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="na"&gt;y&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;0&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;onMouseMove&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;setCoords&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="na"&gt;x&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;clientX&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;y&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;clientY&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;(&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt; &lt;span class="na"&gt;onMouseMove&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;onMouseMove&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
     children(&lt;span class="si"&gt;{&lt;/span&gt;
       &lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;coords&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
       &lt;span class="nx"&gt;y&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;coords&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;y&lt;/span&gt;
     &lt;span class="si"&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;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Use Mouse Component (React)&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="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Mouse&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  (&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;y&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;) =&amp;gt; &lt;span class="si"&gt;{&lt;/span&gt;
     &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;The mouse position is (&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;, &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;y&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;)&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;h1&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;/&lt;/span&gt;&lt;span class="nc"&gt;Mouse&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, we can see that the &lt;code&gt;Mouse&lt;/code&gt; component accepts a function and it invokes that function on its JSX block. The function which is passed also returns a JSX. &lt;/p&gt;

&lt;p&gt;This is somewhat similar to how high order functions work in JavaScript. A higher-order function is a function that takes a function as an argument or returns a function&lt;/p&gt;

&lt;p&gt;Let us now try to do this in Angular. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;Mouse Component (Angular)&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;Component&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;selector&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;mouse&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;template&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`
  &amp;lt;div (mousemove)="handleMouseMove($event)"&amp;gt;
    &amp;lt;ng-container *ngTemplateOutlet="template; context: coords" &amp;gt;&amp;lt;/ng-container&amp;gt;
  &amp;lt;/div&amp;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;export&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Mouse&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;ContentChild&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;TemplateRef&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nx"&gt;template&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nx"&gt;coords&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;x&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;y&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nf"&gt;handleMouseMove&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;coords&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;x&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;clientX&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;y&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;clientY&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;&lt;em&gt;Use Mouse Component (Angular)&lt;/em&gt;&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;mouse&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;ng-template&lt;/span&gt; &lt;span class="na"&gt;let-x=&lt;/span&gt;&lt;span class="s"&gt;"x"&lt;/span&gt; &lt;span class="na"&gt;let-y=&lt;/span&gt;&lt;span class="s"&gt;"y"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
     &lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;The mouse position is ({{x}}, {{y}})&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/ng-template&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/mouse&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I can actually say that this is much harder to understand if I don't know what &lt;code&gt;ng-template&lt;/code&gt;, &lt;code&gt;ng-container&lt;/code&gt;, and &lt;code&gt;TempalateRef&lt;/code&gt;are and how they actually work. With JSX, we were able to achieve what we like with shorter succinct code. &lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;There is actually nothing compelling about what I’ve done here — several technologies have been using some sort of templating engine for quite some time. I still like working with templates even though I have been working with JSX nowadays. &lt;/p&gt;

&lt;p&gt;Maybe we should start using something for a considerable amount of time before actually hating it. The use of templates vs JSX, highly depends on what application you are building, your team’s preferences, experience, or perhaps whether or not you have code-capable designers on your team.&lt;/p&gt;

&lt;p&gt;What do you like or don't like about JSX? Please share your thoughts.&lt;/p&gt;

</description>
      <category>jsx</category>
      <category>react</category>
      <category>javascript</category>
      <category>html</category>
    </item>
    <item>
      <title>A Beginner's Guide on Creating a Portfolio Website with Github and Gatsby</title>
      <dc:creator>Aivan Monceller</dc:creator>
      <pubDate>Sat, 24 Aug 2019 09:38:46 +0000</pubDate>
      <link>https://dev.to/geocine/a-beginner-s-guide-on-creating-a-portfolio-website-with-github-and-gatsby-lmc</link>
      <guid>https://dev.to/geocine/a-beginner-s-guide-on-creating-a-portfolio-website-with-github-and-gatsby-lmc</guid>
      <description>&lt;p&gt;As someone who is trying to build a presence online, having a website should be on top of your priority list. It is also a fun learning experience which will help you explore your inner creative child.&lt;/p&gt;

&lt;p&gt;This guide will help you build a portfolio website and host it online for everyone to see. To be able to follow through, you must at least have some working knowledge about HTML, CSS, and JavaScript. &lt;/p&gt;

&lt;h2&gt;
  
  
  Setting up your Computer
&lt;/h2&gt;

&lt;p&gt;We will be setting up our JavaScript development environment. The following software needs to be installed and setup on your computer.&lt;/p&gt;

&lt;h3&gt;
  
  
  NodeJS
&lt;/h3&gt;

&lt;p&gt;NodeJS will be used to build the source code of our website and download packages that we need. Note that &lt;strong&gt;npm&lt;/strong&gt; will be installed with &lt;strong&gt;NodeJS&lt;/strong&gt;.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Download &lt;a href="https://nodejs.org/en/" rel="noopener noreferrer"&gt;NodeJS&lt;/a&gt;. At the time of writing, this is the latest version. If you are using Windows, this page will show Windows downloads.
&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa7l9y4tv7448kk0wcbbw.png" alt="NodeJS" width="" height=""&gt;
&lt;/li&gt;
&lt;li&gt;Once you have downloaded the installer, go ahead follow the prompts to install it to your computer.&lt;/li&gt;
&lt;li&gt;If you have successfully installed NodeJS you should be able to verify it by opening your Terminal/Command Prompt and type the following commands.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;node &lt;span class="nt"&gt;-v&lt;/span&gt;     &lt;span class="c"&gt;# will show currently installed version of NodeJS&lt;/span&gt;
npm &lt;span class="nt"&gt;-v&lt;/span&gt;      &lt;span class="c"&gt;# will show currently installed version of npm&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  VS Code
&lt;/h3&gt;

&lt;p&gt;VS Code is a source-code editor. It includes support for embedded Git control and GitHub.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Download &lt;a href="https://code.visualstudio.com/" rel="noopener noreferrer"&gt;VS Code&lt;/a&gt;. If you are using Windows, this page will show Windows downloads.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--JdXYmqDK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/yqkob0dlw0jp8iw6d1no.png" alt="VS Code" width="800" height="523"&gt;
&lt;/li&gt;
&lt;li&gt;Once you have downloaded the installer, go ahead follow the prompts to install it to your computer.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;
  
  
  Git and Github
&lt;/h3&gt;

&lt;p&gt;Git will help us save versions of our source code to GitHub. You must create a &lt;a href="https://github.com" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt; account and setup Git after by following the instructions below:&lt;/p&gt;
&lt;h4&gt;
  
  
  Creating a Github Account
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;Go to &lt;a href="https://github.com" rel="noopener noreferrer"&gt;https://github.com&lt;/a&gt;. Enter a &lt;strong&gt;username&lt;/strong&gt;, &lt;strong&gt;email&lt;/strong&gt; and &lt;strong&gt;password&lt;/strong&gt;.
&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb5t7zj55klmf6zv1408m.png" alt="Github1" width="" height=""&gt;
&lt;/li&gt;
&lt;li&gt;There will be three (3) steps until you reach this page.
&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2nx1nnknoqythsegcm4v.png" alt="Github2" width="" height=""&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h4&gt;
  
  
  Creating the Repository
&lt;/h4&gt;

&lt;p&gt;Once you have verified your email, you will be redirected to this page. Here we will create a repository named &lt;strong&gt;username.github.io&lt;/strong&gt; so example in my case it would be &lt;strong&gt;geocine.github.io&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5e0324eow0q0huyid117.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5e0324eow0q0huyid117.png" alt="Github3" width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Setting up your SSH Key
&lt;/h3&gt;

&lt;p&gt;To be able to upload the files from our computer to GitHub, we need to create an SSH key and set it up on GitHub.&lt;/p&gt;
&lt;h4&gt;
  
  
  Generating a new SSH Key
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;Open your Terminal/Git Bash&lt;/li&gt;
&lt;li&gt;Enter the text below, substitute the email with your email
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;/li&gt;

&lt;li&gt;When you're prompted to "Enter a file in which to save the key," press Enter. This accepts the default file location.

&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;/li&gt;

&lt;li&gt;At the prompt, type a secure passphrase. Note that nothing will show while you are typing.

&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;/li&gt;

&lt;/ol&gt;

&lt;h4&gt;
  
  
  Adding a new SSH key to your GitHub account
&lt;/h4&gt;

&lt;p&gt;If you have properly followed the instructions above, a file will be generated on your &lt;strong&gt;~/.ssh&lt;/strong&gt; folder:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Go to your &lt;strong&gt;~/.ssh&lt;/strong&gt; folder on Mac or &lt;strong&gt;C:/Users/YOUR_USER_NAME/.ssh&lt;/strong&gt; on Windows. You will see a file named &lt;strong&gt;id_rsa.pub&lt;/strong&gt;. Open it and copy its contents.&lt;/li&gt;
&lt;li&gt;Go to the settings page of your GitHub account.
&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F17ec5319fdo9uoxzk3p2.png" alt="GitHub4" width="" height=""&gt;
&lt;/li&gt;
&lt;li&gt;Click on &lt;strong&gt;SSH and GPG Keys&lt;/strong&gt; &amp;gt; &lt;strong&gt;New SSH Key&lt;/strong&gt;
&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2odrv86ufasu7umhq3cd.png" alt="GitHub5" width="" height=""&gt;
&lt;/li&gt;
&lt;li&gt;Add your &lt;strong&gt;SSH Key&lt;/strong&gt; from &lt;strong&gt;Step 1&lt;/strong&gt; then press &lt;strong&gt;Add SSH Key&lt;/strong&gt;
&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flbzvo55bpcinrppv6s6h.png" alt="GitHub6" width="" height=""&gt;
&lt;/li&gt;
&lt;li&gt;If prompted, confirm your GitHub password.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Choosing a Template
&lt;/h2&gt;

&lt;p&gt;Let us open the &lt;a href="https://www.gatsbyjs.org/starters/?v=2" rel="noopener noreferrer"&gt;Gatsby Starters&lt;/a&gt; page and choose a template. You'll be able to see something like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6vb3oz6gwfgkp7463pxf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6vb3oz6gwfgkp7463pxf.png" alt="Gatsby Starters" width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I'll be using the &lt;a href="https://www.gatsbyjs.org/starters/LekovicMilos/gatsby-starter-portfolio/" rel="noopener noreferrer"&gt;gatsby-starter-portfolio&lt;/a&gt; create by &lt;a href="https://github.com/LekovicMilos" rel="noopener noreferrer"&gt;LekovicMilos&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkwf844xtwrpatgr1cjpj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkwf844xtwrpatgr1cjpj.png" width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting up your Git Repository
&lt;/h2&gt;

&lt;p&gt;We will be using our GitHub account to create a website, we shall be hosting it on &lt;strong&gt;username.github.io&lt;/strong&gt; so example in my case it would be &lt;strong&gt;geocine.github.io&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a folder on your computer, use your GitHub username. In my case, I will create &lt;strong&gt;geocine.github.io&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Go to the template of your choice, scroll down. Click on the &lt;strong&gt;Source&lt;/strong&gt; link.
&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg4iglaed2hu1umwff35n.png" alt="Gatsby Template" width="" height=""&gt;
&lt;/li&gt;
&lt;li&gt;Copy the link as shown on the screenshot below:
&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz9gib2vzw95azbvwuquu.png" alt="Github Link" width="" height=""&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Go inside your folder, in my case it's &lt;strong&gt;geocine.github.io&lt;/strong&gt;. Clone the starter&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone git@github.com:LekovicMilos/gatsby-starter-portfolio.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Once the cloning process is done. Your folder structure should look like this&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flzgvod9cn0c8ozbnp956.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flzgvod9cn0c8ozbnp956.png" alt="FolderStructure1" width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;We will rename &lt;strong&gt;gatsby-starter-portfolio&lt;/strong&gt; to &lt;strong&gt;gatsby&lt;/strong&gt;. Now your directory structure should look like this&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv6lnsco0xehedsftr7h3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv6lnsco0xehedsftr7h3.png" alt="FolderStructure2" width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Create a &lt;strong&gt;.gitignore&lt;/strong&gt; file on your root directory and paste the following:&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;

&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0veqo6xmdlav98wapbnk.png" alt="FolderStructure13" width="" height=""&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;While you are root folder, let us initialize git&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git init
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Now go inside the &lt;strong&gt;gatsby&lt;/strong&gt; folder and delete the &lt;strong&gt;.git&lt;/strong&gt; folder&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-rf&lt;/span&gt; .git
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;While you are inside the &lt;strong&gt;gatsby&lt;/strong&gt; folder, let us install the dependencies.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Open the package.json file and edit the &lt;strong&gt;scripts&lt;/strong&gt; portion. Add a &lt;strong&gt;clean&lt;/strong&gt; property and edit the &lt;strong&gt;build&lt;/strong&gt; property:&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Go back to the root folder. Open the GitHub repository you have created a while ago from &lt;strong&gt;Creating the Repository&lt;/strong&gt; and copy the command highlighted. &lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzdyk82dqkjvaxrz6xcve.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzdyk82dqkjvaxrz6xcve.png" alt="Github7" width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;While on the root folder, execute the command from &lt;strong&gt;Step 12&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git remote add origin git@github.com:geocine/geocine.github.io.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Go back to the &lt;strong&gt;gatsby&lt;/strong&gt; folder. Let us build the project&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm run build
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Go back to the root folder. Now let us commit our code and push it.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now you should be able to see your site at &lt;strong&gt;username.github.io&lt;/strong&gt;. Mine should be at &lt;strong&gt;geocine.github.io&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;Note that we pushed the build files on the &lt;strong&gt;master&lt;/strong&gt; branch and saved &lt;strong&gt;gatsby&lt;/strong&gt; on a subdirectory because &lt;strong&gt;username.github.io&lt;/strong&gt; only serves from the &lt;strong&gt;master&lt;/strong&gt; branch. &lt;a href="https://github.community/t5/GitHub-Pages/Is-there-a-way-to-publish-from-a-different-branch-on-a-username/m-p/29731/" rel="noopener noreferrer"&gt;See more details here&lt;/a&gt; &lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Development Workflow
&lt;/h2&gt;

&lt;p&gt;Now that your site is up and running. I will describe the development workflow&lt;/p&gt;

&lt;h3&gt;
  
  
  Editing/Development
&lt;/h3&gt;

&lt;p&gt;You must be inside the &lt;strong&gt;gatsby&lt;/strong&gt; folder when you are developing. To further know what can be configured on the template you downloaded. Just visit the repository and follow the &lt;strong&gt;README&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;I will not be able to give you specific instructions on how to use a starter. Starter authors have different ways of configuring the starters they have created.&lt;/p&gt;

&lt;h4&gt;
  
  
  Editing
&lt;/h4&gt;

&lt;p&gt;Open the &lt;strong&gt;gatsby&lt;/strong&gt; folder in &lt;strong&gt;VS Code&lt;/strong&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Development
&lt;/h4&gt;

&lt;p&gt;To run &lt;strong&gt;gatsby&lt;/strong&gt; in development mode. While you are inside the &lt;strong&gt;gatsby&lt;/strong&gt; folder, open your Terminal/Command Prompt and run this command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm run develop
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Deployment
&lt;/h3&gt;

&lt;p&gt;Once you are finished with editing things on the starter template, you need to deploy it to GitHub.&lt;/p&gt;

&lt;h4&gt;
  
  
  Build
&lt;/h4&gt;

&lt;p&gt;First, you need to build &lt;strong&gt;gatsby&lt;/strong&gt; so that it will generate all the necessary static files for your website. While you are on the &lt;strong&gt;gatsby&lt;/strong&gt; directory, execute the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm run build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Deployment
&lt;/h4&gt;

&lt;p&gt;You need to be on the &lt;strong&gt;root&lt;/strong&gt; directory which is the &lt;strong&gt;username.github.io&lt;/strong&gt; or &lt;strong&gt;geocine.github.io&lt;/strong&gt; in my case to push things to Github. Execute the following commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git add .
git commit -m "your message"
git push -u origin master
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you have any questions regarding the setup or need any help with yours, please leave a comment.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>gatsby</category>
      <category>github</category>
      <category>react</category>
    </item>
    <item>
      <title>What dev thing haven't you done that you feel like you should have by now?</title>
      <dc:creator>Aivan Monceller</dc:creator>
      <pubDate>Tue, 13 Aug 2019 15:25:27 +0000</pubDate>
      <link>https://dev.to/geocine/what-dev-thing-haven-t-you-done-that-you-feel-like-you-should-have-by-now-356g</link>
      <guid>https://dev.to/geocine/what-dev-thing-haven-t-you-done-that-you-feel-like-you-should-have-by-now-356g</guid>
      <description>&lt;p&gt;I wanted to share this question posted by &lt;em&gt;Chris Sevilleja&lt;/em&gt; on Twitter. &lt;/p&gt;

&lt;p&gt;&lt;iframe class="tweet-embed" id="tweet-1160228432732512256-385" src="https://platform.twitter.com/embed/Tweet.html?id=1160228432732512256"&gt;
&lt;/iframe&gt;

  // Detect dark theme
  var iframe = document.getElementById('tweet-1160228432732512256-385');
  if (document.body.className.includes('dark-theme')) {
    iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=1160228432732512256&amp;amp;theme=dark"
  }



&lt;/p&gt;

&lt;p&gt;I answered his tweet and he has recommended resources to pursue what I have listed. &lt;/p&gt;

&lt;p&gt;&lt;iframe class="tweet-embed" id="tweet-1160591185670356994-727" src="https://platform.twitter.com/embed/Tweet.html?id=1160591185670356994"&gt;
&lt;/iframe&gt;

  // Detect dark theme
  var iframe = document.getElementById('tweet-1160591185670356994-727');
  if (document.body.className.includes('dark-theme')) {
    iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=1160591185670356994&amp;amp;theme=dark"
  }



&lt;/p&gt;

&lt;p&gt;&lt;iframe class="tweet-embed" id="tweet-1160616581090594816-607" src="https://platform.twitter.com/embed/Tweet.html?id=1160616581090594816"&gt;
&lt;/iframe&gt;

  // Detect dark theme
  var iframe = document.getElementById('tweet-1160616581090594816-607');
  if (document.body.className.includes('dark-theme')) {
    iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=1160616581090594816&amp;amp;theme=dark"
  }



&lt;/p&gt;

&lt;p&gt;This post is a long-form version of what I have shared on Twitter. I only listed three (3) on Twitter to fit the short-form content. &lt;/p&gt;

&lt;h2&gt;
  
  
  Create a self-compiling compiler
&lt;/h2&gt;

&lt;p&gt;A self-compiling compiler is a compiler that can compile its own source code. The process involved in accomplishing this kind of thing is not new. This technique is called &lt;a href="https://en.wikipedia.org/wiki/Bootstrapping_(compilers)" rel="noopener noreferrer"&gt;boostrapping&lt;/a&gt;, something that has been used even before the '80s. A few examples of modern programming languages that have a self-compiling compiler are the following: Go, Rust, TypeScript, etc.&lt;/p&gt;

&lt;p&gt;When creating a new programming language, you need to create a compiler. The initial version of the compiler will be written in a different (existing) programming language. Once you have a compiler you can use it to rewrite the compiler into the intended language and compile subsequent versions of that compiler.&lt;/p&gt;

&lt;p&gt;If there is such a thing, I am trying to hit multiple birds with one stone. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Learn Go towards having advanced knowledge of its constructs&lt;/li&gt;
&lt;li&gt;Write an interpreter and a compiler to understand how the code we write gets transformed so that the computer will be able to execute it&lt;/li&gt;
&lt;li&gt;Learn programming paradigms that I have never encountered before and implement it. This will pave the way in opening new neural pathways in my mind.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To achieve this I am following books written by &lt;em&gt;Thorsten Ball&lt;/em&gt;: &lt;a href="https://interpreterbook.com/" rel="noopener noreferrer"&gt;Writing an Interpreter in Go&lt;/a&gt; and &lt;a href="https://compilerbook.com/" rel="noopener noreferrer"&gt;Writing a Compiler in Go&lt;/a&gt;. In my opinion, these books are very concise, clear and short. It explains complex concepts without being too academic. The author doesn't use any third-party libraries or frameworks, just the standard Go library. Thus, you may follow this book in any programming language you are comfortable with. It also progresses step-by-step in a test-driven manner of implementing the pieces of the interpreter/compiler.&lt;/p&gt;

&lt;h2&gt;
  
  
  Website Development Workflow
&lt;/h2&gt;

&lt;p&gt;Do you know the feeling of being professionally competent at something but unable to offer your expertise to friends or other people due to reasons? &lt;/p&gt;

&lt;p&gt;I have been developing websites my entire career but I cannot compete against a web development studio's speed in delivering something of value to a client. &lt;/p&gt;

&lt;p&gt;This doesn't mean that I just can't. The stuff I do at work is not about spinning company websites all day. I am also distracted what to use when it comes to building a website for someone.  I do not have a clear workflow on how to spin up a website from zero to production.&lt;/p&gt;

&lt;p&gt;When you are building a content-based website, you have to think of three (3) people: the developer, the content creator, and the audience. &lt;/p&gt;

&lt;p&gt;You need to have good developer experience so that you could easily hand over the website to another developer.  You should also make it simple for the content creator to use. The content creator should never need the developer to create content or any kind of reasonable customization.&lt;/p&gt;

&lt;p&gt;Thinking of your audience, you should consider that people should be able to view the website on different devices. You need to factor in accessibility and user experience.&lt;/p&gt;

&lt;p&gt;Being part of several non-profit organizations, I have been genuinely wanting to help them create their websites. I also want to help small entrepreneurs to have their businesses online.&lt;/p&gt;

&lt;p&gt;To achieve this, I am currently exploring &lt;a href="https://serverless.css-tricks.com/" rel="noopener noreferrer"&gt;The Power of Serverless for Frontend Developers&lt;/a&gt; and the &lt;a href="https://jamstack.org/" rel="noopener noreferrer"&gt;JAM Stack&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Get Confident with Algorithms
&lt;/h2&gt;

&lt;p&gt;My &lt;a href="https://en.wikipedia.org/wiki/Impostor_syndrome" rel="noopener noreferrer"&gt;Impostor Syndrome&lt;/a&gt; is at its strongest when the topic of algorithms comes into play.  &lt;/p&gt;

&lt;p&gt;I have a Computer Science background and have even joined ACM competitions in the past. Still, I don't see myself acing any algorithm interview any time soon.&lt;/p&gt;

&lt;p&gt;I have somehow convinced my self that learning algorithms is important and I am currently consuming the following resources:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt; &lt;a href="https://www.edx.org/course/algorithmic-design-and-techniques" rel="noopener noreferrer"&gt;Alogrithm Design and Techniques @edX&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.goodreads.com/book/show/41188653-javascript-data-structures-and-algorithms" rel="noopener noreferrer"&gt;JavaScript Data Structures and Algorithms&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.goodreads.com/book/show/22847284-grokking-algorithms-an-illustrated-guide-for-programmers-and-other-curio" rel="noopener noreferrer"&gt;Grokking Algorithms An Illustrated Guide For Programmers And Other Curious People&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bigmachine.io/products/the-imposters-handbook" rel="noopener noreferrer"&gt;The Impostor's Handbook&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.interviewcake.com/" rel="noopener noreferrer"&gt;Interview Cake&lt;/a&gt; - having second thoughts on trying this.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;How about you? What dev thing haven't you done that you feel like you should have by now?&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>career</category>
      <category>dev</category>
    </item>
    <item>
      <title>Developers meet Designers, Designers meet Developers</title>
      <dc:creator>Aivan Monceller</dc:creator>
      <pubDate>Wed, 17 Apr 2019 13:29:55 +0000</pubDate>
      <link>https://dev.to/geocine/developers-meet-designers-designers-meet-developers-1p6a</link>
      <guid>https://dev.to/geocine/developers-meet-designers-designers-meet-developers-1p6a</guid>
      <description>&lt;p&gt;Is there such a community where Developers ⇄ Designers can meet and collaborate? I am a developer who has an eye for design. &lt;/p&gt;

&lt;p&gt;That doesn't mean that I can do what professional designers do, I just know what looks good vs the obvious &lt;code&gt;not&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;I do create my own opensource logos, templates, etc. But most of the time, I find myself copying other's designs or totally give up and head to Fiverr.&lt;/p&gt;

&lt;p&gt;I once had an opportunity to work on a project with a designer who knows UX and HTML/CSS development. It was an awesome experience.&lt;/p&gt;

&lt;p&gt;It was my first time to trust someone with a design which we both agreed. He was not just a designer, we both had enough knowledge to communicate requirements on our sides.&lt;/p&gt;

&lt;p&gt;Now, why am I looking if I already found a person who could work with me? Here is the thing, not all people are like you and me folks.&lt;/p&gt;

&lt;p&gt;We are the ones who have a very long list of TODOs that is piling up very fast but slowly being ticked. We are obsessed with new ideas which most of the time lead to half-baked outputs. &lt;/p&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="/dvddpl" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F132615%2Fc7c6d1d6-2cb8-4d37-9908-3f1393e2e7ff.png" alt="dvddpl"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="/dvddpl/s-o-s-you-might-suffer-from-f-o-m-o-about-fear-of-missing-out-and-shiny-object-syndrome-23j4" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;S.O.S.: you might suffer from F.O.M.O.! ( About Fear of Missing Out and Shiny Object Syndrome)&lt;/h2&gt;
      &lt;h3&gt;Davide de Paolis ・ Apr 8 '19&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#career&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#selfimprovement&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#personaldevelopment&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#productivity&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


&lt;p&gt;We love opensource and definitely find time out of our 9-5 job and our weekends. In fact, we consider this as one of our leisure activities. &lt;/p&gt;

&lt;p&gt;Working for years, I only met a single person who shares the same enthusiasm. And no, he is not a designer, he is an awesome developer just like me.&lt;/p&gt;

&lt;p&gt;So how about, we start establishing an alliance where we can do stuff together. Let us build our portfolios together and work our way towards intentional career building. &lt;/p&gt;

</description>
      <category>discuss</category>
      <category>beginners</category>
      <category>design</category>
      <category>career</category>
    </item>
    <item>
      <title>Creating your Blog using GatsbyJS and Dev.to API</title>
      <dc:creator>Aivan Monceller</dc:creator>
      <pubDate>Sun, 31 Mar 2019 06:36:50 +0000</pubDate>
      <link>https://dev.to/geocine/creating-your-blog-using-gatsbyjs-and-dev-to-api-3jb3</link>
      <guid>https://dev.to/geocine/creating-your-blog-using-gatsbyjs-and-dev-to-api-3jb3</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;TLDR: You can go to &lt;a href="https://gatsby-starter-devto.netlify.com/" rel="noopener noreferrer"&gt;the demo&lt;/a&gt; on what this is all about. Nonetheless, this is really very easy even if you don't know about GatsbyJS.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I have seen a couple of Dev.to API articles here and decided to make something useful with it. &lt;/p&gt;

&lt;p&gt;If you already have a blog, this article is also for you. I have been struggling to create some content on my own domain because I feel no one would even bother visiting my site.&lt;/p&gt;

&lt;p&gt;At &lt;a href="https://dev.to"&gt;Dev.to&lt;/a&gt; though, I just keep coming back to write articles because I know someone would be reading it somehow.&lt;/p&gt;

&lt;p&gt;Instead of cross-posting from my own blog to Dev.to, I thought I could do the other way around. I am introducing this very basic Dev.to Gatsby source that you could use with your Gatsby website.&lt;/p&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--A9-wwsHG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/geocine" rel="noopener noreferrer"&gt;
        geocine
      &lt;/a&gt; / &lt;a href="https://github.com/geocine/gatsby-source-dev" rel="noopener noreferrer"&gt;
        gatsby-source-dev
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Gatsby source plugin that fetches user articles from Dev.to
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;
  &lt;a href="https://github.com/geocine/gatsby-source-dev#readme" rel="noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/128b89a53081c861a12f224f82b0387d49d14e06c35e379028e9fe59ca19b529/68747470733a2f2f692e696d6775722e636f6d2f56456c6459446f2e706e67" alt="header" width="800"&gt;&lt;/a&gt;
  &lt;br&gt;
  gatsby-source-dev
  &lt;br&gt;
&lt;/h1&gt;

&lt;/div&gt;
&lt;p&gt;&lt;a href="https://www.npmjs.com/package/gatsby-source-dev" rel="nofollow noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/b775e4fa04ba645be6722beb9dad68e1a71eeb9b740b97e7cc0b26c1270d6a8a/68747470733a2f2f62616467656e2e6e65742f6e706d2f762f6761747362792d736f757263652d646576" alt="NPM version"&gt;&lt;/a&gt; &lt;a href="https://travis-ci.org/geocine/gatsby-source-dev" rel="nofollow noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/cf9455032211b57cd9eb1ebe37e20b0d31fb9e000fe9529f3092b1b96ea5eb78/68747470733a2f2f7472617669732d63692e6f72672f67656f63696e652f6761747362792d736f757263652d6465762e7376673f6272616e63683d6d6173746572" alt="Build Status"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;A Gatsby plugin that fetches user articles from Dev.to’s &lt;code&gt;/articles?username&lt;/code&gt; combined with &lt;code&gt;/articles/${id}&lt;/code&gt; endpoint.&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Usage&lt;/h2&gt;

&lt;/div&gt;
&lt;p&gt;Install &lt;code&gt;gatsby-source-dev&lt;/code&gt; in your project:&lt;/p&gt;
&lt;div class="snippet-clipboard-content notranslate position-relative overflow-auto"&gt;&lt;pre class="notranslate"&gt;&lt;code&gt;yarn add gatsby-source-dev
npm install gatsby-source-dev
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then add the plugin to your &lt;code&gt;gatsby-config.js&lt;/code&gt; file:&lt;/p&gt;
&lt;div class="highlight highlight-source-js notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;&lt;span class="pl-kos"&gt;{&lt;/span&gt;
  &lt;span class="pl-c1"&gt;resolve&lt;/span&gt;: &lt;span class="pl-s"&gt;"gatsby-source-dev"&lt;/span&gt;&lt;span class="pl-kos"&gt;,&lt;/span&gt;
  &lt;span class="pl-c1"&gt;options&lt;/span&gt;: &lt;span class="pl-kos"&gt;{&lt;/span&gt;
    &lt;span class="pl-c"&gt;// This is your username on Dev.to&lt;/span&gt;
    &lt;span class="pl-c1"&gt;username&lt;/span&gt;: &lt;span class="pl-s"&gt;''&lt;/span&gt;
  &lt;span class="pl-kos"&gt;}&lt;/span&gt;
&lt;span class="pl-kos"&gt;}&lt;/span&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;The plugin will store the Dev.to API response in Gatsby. Here's an example of a query that fetches an articles &lt;code&gt;title&lt;/code&gt;, &lt;code&gt;id&lt;/code&gt;, and &lt;code&gt;description&lt;/code&gt;.&lt;/p&gt;
&lt;div class="highlight highlight-source-js notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;&lt;span class="pl-kos"&gt;{&lt;/span&gt;
  &lt;span class="pl-s1"&gt;allDevArticles&lt;/span&gt; &lt;span class="pl-kos"&gt;{&lt;/span&gt;
    &lt;span class="pl-s1"&gt;edges&lt;/span&gt; &lt;span class="pl-kos"&gt;{&lt;/span&gt;
      &lt;span class="pl-s1"&gt;node&lt;/span&gt; &lt;span class="pl-kos"&gt;{&lt;/span&gt;
        &lt;span class="pl-s1"&gt;article&lt;/span&gt; &lt;span class="pl-kos"&gt;{&lt;/span&gt;
          &lt;span class="pl-s1"&gt;id&lt;/span&gt;
          &lt;span class="pl-s1"&gt;title&lt;/span&gt;
          &lt;span class="pl-s1"&gt;description&lt;/span&gt;
        &lt;span class="pl-kos"&gt;}&lt;/span&gt;
      &lt;span class="pl-kos"&gt;}&lt;/span&gt;
    &lt;span class="pl-kos"&gt;}&lt;/span&gt;
  &lt;span class="pl-kos"&gt;}&lt;/span&gt;
&lt;span class="pl-kos"&gt;}&lt;/span&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;The node contains the entire response from Dev.to’s endpoint.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Pagination is not yet implemented&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;



&lt;/div&gt;
&lt;br&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/geocine/gatsby-source-dev" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;br&gt;


&lt;p&gt;If you do not know what a gatsby source or have never really touched Gatsby, you don't need to worry since I created a starter.&lt;/p&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--A9-wwsHG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/geocine" rel="noopener noreferrer"&gt;
        geocine
      &lt;/a&gt; / &lt;a href="https://github.com/geocine/gatsby-starter-devto" rel="noopener noreferrer"&gt;
        gatsby-starter-devto
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      A GatsbyJS starter template that leverages the Dev.to API
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;Gatsby Starter Dev.to&lt;/h1&gt;

&lt;/div&gt;
&lt;p&gt;This is a demo usage of the &lt;a href="https://github.com/geocine/gatsby-source-dev" rel="noopener noreferrer"&gt;gatsby-source-dev&lt;/a&gt; plugin&lt;/p&gt;
&lt;p&gt;Also using &lt;a href="https://www.npmjs.com/package/html-react-parser" rel="nofollow noopener noreferrer"&gt;html-react-parser&lt;/a&gt; to render html as components as described on my &lt;a href="https://dev.to/geocine/challenges-in-headless-wordpress-with-gatsbyjs-4a0b" rel="nofollow"&gt;blog post&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;



&lt;/div&gt;
&lt;br&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/geocine/gatsby-starter-devto" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;br&gt;


&lt;p&gt;Here are the steps how to create your own blog using this starter:&lt;/p&gt;

&lt;p&gt;1 - Clone the github repository&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;    git clone git@github.com:geocine/gatsby-starter-devto.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;2 - Open &lt;code&gt;gatsby-config.js&lt;/code&gt; and change line 13 with your Dev.to username&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="nx"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;siteMetadata&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Gatsby + Dev.to Starter&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="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="na"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;gatsby-source-dev&lt;/span&gt;&lt;span class="dl"&gt;'&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;// your Dev.to username&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;geocine&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="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;3 - Install and start&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;     yarn
     yarn start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;4 - Navigate to &lt;a href="http://localhost:8000" rel="noopener noreferrer"&gt;http://localhost:8000&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;a href="https://gatsby-starter-devto.netlify.com/" rel="noopener noreferrer"&gt;This&lt;/a&gt; is how it should look like using my username &lt;code&gt;geocine&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This is still a work in progress, I will be adding more features, feel free to create a pull request. I hope you like it. &lt;/p&gt;

&lt;p&gt;If you want to learn more about gatsby, checkout this article below:&lt;/p&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="/geocine" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F122729%2Fa5476c2a-b00b-4cb3-8b75-ea0a11213d30.png" alt="geocine"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="/geocine/a-static-site-generator-doesnt-have-to-be-static-41i" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;GatsbyJS a Dynamic Static Site Generator&lt;/h2&gt;
      &lt;h3&gt;Aivan Monceller ・ Feb 28 '19&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#gatsby&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#graphql&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#react&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#jamstack&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;



</description>
      <category>gatsby</category>
      <category>api</category>
      <category>showdev</category>
      <category>react</category>
    </item>
    <item>
      <title>What are your favorite programming language syntax features?</title>
      <dc:creator>Aivan Monceller</dc:creator>
      <pubDate>Wed, 27 Mar 2019 16:31:17 +0000</pubDate>
      <link>https://dev.to/geocine/what-are-your-favorite-programming-language-syntax-features-1emm</link>
      <guid>https://dev.to/geocine/what-are-your-favorite-programming-language-syntax-features-1emm</guid>
      <description>&lt;p&gt;I have my own non-exhaustive list, and these are purely based on what I have used: &lt;em&gt;JavaScript, TypeScript, C#&lt;/em&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Safe Navigation Operator
&lt;/h1&gt;

&lt;p&gt;This is also known as &lt;em&gt;optional chaining operator&lt;/em&gt;, &lt;em&gt;safe call operator&lt;/em&gt;, &lt;em&gt;null-conditional operator&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Instead of writing multiple nested ifs, we just use usual chaining, but put question mark symbols &lt;code&gt;?&lt;/code&gt; before dots (or other characters used for chaining).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="n"&gt;String&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;articles&lt;/span&gt;&lt;span class="p"&gt;?[&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]?.&lt;/span&gt;&lt;span class="n"&gt;author&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Null Coalescing Operator
&lt;/h1&gt;

&lt;p&gt;This is the shorthand of the ternary conditional if operator &lt;code&gt;x ? x : y&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;pageTitle&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;suppliedTitle&lt;/span&gt; &lt;span class="p"&gt;??&lt;/span&gt; &lt;span class="s"&gt;"Default Title"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In JavaScript the OR operator &lt;code&gt;||&lt;/code&gt; has the same behavior as the above. It returns the first operand if it evaluates to true, otherwise, it returns the second operand. When the left hand side is true, the right hand side is not even evaluated; it is "short-circuited."&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;let&lt;/span&gt; &lt;span class="nx"&gt;pageTitle&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;suppliedTitle&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Default Title&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Lambda
&lt;/h1&gt;

&lt;p&gt;This is also known as anonymous function, function literal, lambda abstraction, or lambda expression.&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;hello&lt;/span&gt; &lt;span class="o"&gt;=&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;gt;&lt;/span&gt; &lt;span class="s2"&gt;`Hello &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="s2"&gt;`&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can do a lot of things with this construct. &lt;a href="https://medium.com/javascript-scene/curry-and-function-composition-2c208d774983" rel="noopener noreferrer"&gt;Currying&lt;/a&gt;, &lt;a href="https://dev.to/yaminmhd/understanding-javascript-closures-1fk7"&gt;closures&lt;/a&gt;, &lt;a href="https://eloquentjavascript.net/05_higher_order.html" rel="noopener noreferrer"&gt;high order functions&lt;/a&gt; etc. &lt;/p&gt;

&lt;h1&gt;
  
  
  Auto Implemented Properties
&lt;/h1&gt;

&lt;p&gt;In C# auto-implemented properties make property-declaration more concise when no additional logic is required in the property accessors.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;Name&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;set&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;In C# 6 and later, you can initialize auto-implemented properties similarly to fields:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;FirstName&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;set&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="s"&gt;"Jane"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can learn more about automatic properties &lt;a href="https://gunnarpeipman.com/csharp/automatic-properties/" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Async/Await
&lt;/h1&gt;

&lt;p&gt;The async/await pattern is a syntactic feature of many programming languages that allows an asynchronous, non-blocking function to be structured in a way similar to an ordinary synchronous function.&lt;/p&gt;

&lt;p&gt;C#&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="n"&gt;Task&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;FindPageSize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Uri&lt;/span&gt; &lt;span class="n"&gt;uri&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;byte&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;WebClient&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;DownloadDataTaskAsync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;uri&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Length&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;JS&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;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;createNewDoc&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;({});&lt;/span&gt; &lt;span class="c1"&gt;// post a new doc&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&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;id&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// find by id&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Intersection / Union Types
&lt;/h1&gt;

&lt;p&gt;In TypeScript, the intersection type combines types, so that you can have all properties and members of both types on your particular object or method.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;Element&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Union types, meanwhile, are an either/or scenario. Instead of combining types to receive all members and properties, we use union types to specify that a method accepts either of several different types.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  JSON Serialize / Deserialize
&lt;/h1&gt;

&lt;p&gt;JavaScript makes it very easy for us to serialize and deserialize JSON.&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;obj&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Aivan&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;obj&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// serialize object to JSON string&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;str&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`{name : "Aivan"}`&lt;/span&gt;
&lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// deserialize string to object &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Template Literals
&lt;/h1&gt;

&lt;p&gt;Template literals are string literals allowing embedded expressions. You can use multi-line strings and string interpolation features with them.&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="s2"&gt;`string text 
   &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;expression&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; 
 string text`&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Destructuring and Spread Operator
&lt;/h1&gt;

&lt;p&gt;The destructuring assignment syntax is a JavaScript expression that makes it possible to unpack values from arrays, or properties from objects, into distinct variables.&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;var&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;b&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;rest&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;[&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;b&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&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;a&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 10&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;b&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 20&lt;/span&gt;

&lt;span class="p"&gt;[&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;b&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;rest&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;40&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&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;a&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 10&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;b&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 20&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;rest&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// [30, 40, 50]&lt;/span&gt;

&lt;span class="p"&gt;({&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;b&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;a&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;b&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt; &lt;span class="p"&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;a&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 10&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;b&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 20&lt;/span&gt;

&lt;span class="p"&gt;({&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;b&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;rest&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="na"&gt;a&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;b&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;c&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;d&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;40&lt;/span&gt;&lt;span class="p"&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;a&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 10&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;b&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 20&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;rest&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// {c: 30, d: 40}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is taken from the &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment" rel="noopener noreferrer"&gt;MDN&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Object Property Value Shorthand
&lt;/h1&gt;

&lt;p&gt;Instead of writing your objects like this:&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;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Aivan&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;obj&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&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="c1"&gt;// { name: 'Aivan'}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can write it like this. This is possible if the name of the key and the variable name of the value is the same.&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;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Aivan&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;obj&lt;/span&gt; &lt;span class="o"&gt;=&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="c1"&gt;// { name: 'Aivan'}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Annotations / Decorators
&lt;/h1&gt;

&lt;p&gt;Decorators provide a very simple syntax for calling higher-order function. It also allows for a cleaner syntax for applying wrappers around your code, resulting in something that detracts less from the actual intention of what you’re writing.&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="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;Wove&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;DataMapper&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// ...&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;You can learn more about decorators &lt;a href="https://blog.mgechev.com/2018/01/29/javascript-decorators-aop-autobind-memoization/" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h1&gt;
  
  
  Default Parameters
&lt;/h1&gt;

&lt;p&gt;Default parameters allow named parameters to be initialized with default values if no value or undefined is passed.&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;function&lt;/span&gt; &lt;span class="nf"&gt;multiply&lt;/span&gt;&lt;span class="p"&gt;(&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;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&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="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// you can call it like this&lt;/span&gt;
&lt;span class="nf"&gt;multiply&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// 1&lt;/span&gt;
&lt;span class="nf"&gt;multiply&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// 4&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>discuss</category>
      <category>programming</category>
      <category>beginners</category>
      <category>software</category>
    </item>
    <item>
      <title>GatsbyJS a Dynamic Static Site Generator</title>
      <dc:creator>Aivan Monceller</dc:creator>
      <pubDate>Thu, 28 Feb 2019 13:41:02 +0000</pubDate>
      <link>https://dev.to/geocine/a-static-site-generator-doesnt-have-to-be-static-41i</link>
      <guid>https://dev.to/geocine/a-static-site-generator-doesnt-have-to-be-static-41i</guid>
      <description>&lt;p&gt;I will try to explain what a &lt;a href="https://en.wikipedia.org/wiki/Web_template_system#Static_site_generators" rel="noopener noreferrer"&gt;Static Site Generator&lt;/a&gt; (SSG) is. An SSG is a cross between a static site and a &lt;a href="https://en.wikipedia.org/wiki/Content_management_system" rel="noopener noreferrer"&gt;Content Management System&lt;/a&gt; (CMS) in the sense that the static content is generated from a data source.&lt;/p&gt;

&lt;p&gt;The final output would be a static site which can be served through a  &lt;a href="https://en.wikipedia.org/wiki/Content_delivery_network" rel="noopener noreferrer"&gt;Content Delivery Network&lt;/a&gt; (CDN) or any web server. You will not need to run a backend, database and things like that. You can even just run it on your computer by opening the HTML file on your browser. &lt;/p&gt;

&lt;p&gt;This post has good points on explaining what an SSG is.&lt;/p&gt;


&lt;div class="ltag__link"&gt;
  &lt;div class="ltag__link__content"&gt;
    &lt;div class="missing"&gt;
      &lt;h2&gt;Article No Longer Available&lt;/h2&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;


&lt;h2&gt;
  
  
  Its Dynamic Capability
&lt;/h2&gt;

&lt;p&gt;An SSG is not totally static. It achieves dynamic content through the process of gathering data from a source and transforming that data into human consumable content through templates. &lt;/p&gt;

&lt;p&gt;The keyword here is &lt;em&gt;generator&lt;/em&gt;. The generator is responsible for this process and this happens only once every time we need to update our content. Most SSGs use files as a data source. The most common file is a markdown file. &lt;/p&gt;

&lt;p&gt;If you don't know what is markdown go and check this post:&lt;/p&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="/rattanakchea" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F35651%2Ff9ded142-017e-462b-bfe5-c7ef9335c3d2.jpeg" alt="rattanakchea"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="/rattanakchea/markdown-cheatsheet-for-developers-2bjj" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Markdown Cheatsheet for developers&lt;/h2&gt;
      &lt;h3&gt;Rattanak Chea ・ Nov 13 '18&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#markdown&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#cheatsheet&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


&lt;p&gt;Being able to edit content through a file is not truly dynamic. What if we can pull our data from a dynamic source like an API, database or CMS? It is indeed possible, enter Gatsby!&lt;/p&gt;

&lt;h2&gt;
  
  
  Gatsby
&lt;/h2&gt;

&lt;p&gt;I would like to introduce you to &lt;a href="https://www.gatsbyjs.org/" rel="noopener noreferrer"&gt;Gatsby&lt;/a&gt;. Before I start, just wanted to let you know there are tons of SSGs available. Check out &lt;a href="https://www.staticgen.com/" rel="noopener noreferrer"&gt;this list&lt;/a&gt; by the Netlify team, it contains around &lt;em&gt;&lt;strong&gt;~248&lt;/strong&gt;&lt;/em&gt; static site generators.&lt;/p&gt;

&lt;h3&gt;
  
  
  What makes Gatsby different?
&lt;/h3&gt;

&lt;p&gt;Gatsby introduced the concept of &lt;em&gt;"bring your own data"&lt;/em&gt;. Most of the SSGs can only take content from files. That is where Gatsby shines and it shines with class. I'll quote from their website:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Gatsby’s rich data plugin ecosystem lets you build sites with the data you want — from one or many sources: Pull data from headless CMSs, SaaS services, APIs, databases, your file system, and more directly into your pages using GraphQL.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  What is GraphQL and how does it fit in the picture?
&lt;/h3&gt;

&lt;p&gt;I will probably save an introduction to GraphQL on a different post. But here is a good post which explains what is it:&lt;/p&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="/grigorkh" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F78943%2F519049d4-de20-4cdb-a952-fd7f3517165f.jpeg" alt="grigorkh"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="/grigorkh/what-is-graphql-4n9j" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;What is GraphQL?&lt;/h2&gt;
      &lt;h3&gt;Grigor Khachatryan ・ Jun 17 '18&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#graphql&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#javascript&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#facebook&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#node&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


&lt;p&gt;Hold your horses, we don't need to setup any GraphQL server to use GraphQL in Gatsby. We don't even need to transform our existing APIs to GraphQL. So why are we even talking about GraphQL?&lt;/p&gt;

&lt;p&gt;The diagram below from the &lt;a href="https://Gatsby.org" rel="noopener noreferrer"&gt;Gatsby&lt;/a&gt; site shows how GraphQL is being used. Gatsby exposes your data source whichever it may be through GraphQL. This means you don't have to deal with different things if you have a lot of different data sources.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv9bcvorrt64ou80t160h.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv9bcvorrt64ou80t160h.gif" width="" height=""&gt;&lt;/a&gt;&lt;br&gt;
If you are integrating a data source, there is a high chance that a plugin is already written for that. Make sure you check the Gatsby &lt;a href="https://www.Gatsby.org/plugins/?=gatsby-source" rel="noopener noreferrer"&gt;plugins page&lt;/a&gt; and look for &lt;code&gt;gatsby-source&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;If you do not see a plugin for your use case, it's really easy to start writing your own Gatsby source plugin. A detailed guide can be found &lt;a href="https://www.Gatsby.org/docs/create-source-plugin/" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;
  
  
  Dynamic Templates
&lt;/h3&gt;

&lt;p&gt;A template engine will pre-process data with a template to produce a result document or any kind of formatted output. Once the output is produced, it stops there.&lt;/p&gt;

&lt;p&gt;Gatsby is built with React so the way you display stuff is through &lt;a href="https://en.wikipedia.org/wiki/React_(JavaScript_library)#JSX" rel="noopener noreferrer"&gt;JSX&lt;/a&gt;. It will also produce an output similar to a regular SSG. When you load the produced output on a browser, ReactJS kicks in which will enable you to provide better user experiences by making your site interactive, fast and less janky.&lt;/p&gt;

&lt;p&gt;If you have been using ReactJS, it will mostly be the same experience just like how you use it with or without Gatsby. You don't have to switch context to an obscure build system or even a language you haven't used before.&lt;/p&gt;
&lt;h3&gt;
  
  
  Why is Gatsby so fast?
&lt;/h3&gt;

&lt;p&gt;We already got rid a lot of overhead by using an SSG. Gatsby took this a couple of notches higher. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Performance in Gatsby is not optional, it's built-in. I designed Gatsby with the goal that when using it, it'd be really really hard to build a slow site&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You can read a detailed talk about this by (founder of Gatsby) &lt;em&gt;Kyle Matthews&lt;/em&gt; &lt;a href="https://www.Gatsby.org/blog/2017-09-13-why-is-gatsby-so-fast/" rel="noopener noreferrer"&gt;here&lt;/a&gt;. Try it for yourself to see the difference, watch this webinar by the Gatsby team.&lt;/p&gt;

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

</description>
      <category>gatsby</category>
      <category>graphql</category>
      <category>react</category>
      <category>jamstack</category>
    </item>
    <item>
      <title>Getting Started with GatsbyJS and WordPress</title>
      <dc:creator>Aivan Monceller</dc:creator>
      <pubDate>Sun, 24 Feb 2019 12:53:07 +0000</pubDate>
      <link>https://dev.to/geocine/getting-started-with-gatsbyjs-and-wordpress-1k2k</link>
      <guid>https://dev.to/geocine/getting-started-with-gatsbyjs-and-wordpress-1k2k</guid>
      <description>&lt;p&gt;Do you know how to create a static website with HTML, CSS, and JavaScript? I believe you have used WordPress once to create your own blog.&lt;/p&gt;

&lt;p&gt;You can use WordPress, without knowing how to create your own themes and plugins. There are a lot in the wild. But then it starts to get complicated once you start tinkering on things the way you want it to.&lt;/p&gt;

&lt;p&gt;What if there's a way to turn WordPress into an API or a data source in which you could pull content and display it anywhere?&lt;/p&gt;

&lt;p&gt;In this post, we will be setting up WordPress in Headless mode, create a basic HTML/CSS template, and use GatsbyJS to integrate our template with WordPress.&lt;/p&gt;

&lt;h1&gt;
  
  
  WordPress
&lt;/h1&gt;

&lt;p&gt;I will assume you know how to install WordPress. If not, here is &lt;a href="https://www.digitalocean.com/community/tutorials/how-to-install-WordPress-with-lamp-on-ubuntu-18-04" rel="noopener noreferrer"&gt;a step by step guide&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;To setup WordPress in &lt;em&gt;Headless&lt;/em&gt; mode, we will need to install the following plugins:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://WordPress.org/plugins/wp-api-menus/" rel="noopener noreferrer"&gt;WP API Menus&lt;/a&gt; - This will expose the Menus as an API. The built-in WordPress API does not expose menus.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://WordPress.org/plugins/advanced-custom-fields/" rel="noopener noreferrer"&gt;Advanced Custom Fields&lt;/a&gt; - We would be able to create custom fields based on rules and be able to access it through an API&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://WordPress.org/plugins/custom-post-type-ui/" rel="noopener noreferrer"&gt;Custom Post Type UI&lt;/a&gt; - Sometimes Pages and Posts are not enough, we would like to create custom posts like Products, Movies, etc. &lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/postlight/headless-wp-starter/tree/master/wordpress/wp-content/themes/postlight-headless-wp" rel="noopener noreferrer"&gt;Postlight Headless Theme&lt;/a&gt; - This theme will remove the Webpages on the client-facing frontend and will replace it with JSON.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Running in Headless mode means we will still be using the WordPress Dashboard to manage content but we will be serving those through an API. Hence, we won't be using WordPress to show the generated content to our visitors.&lt;/p&gt;

&lt;p&gt;Make sure you have at least 1 post and 1 page on your WordPress site. Make sure at least 1 post has at least 1 tag. We will be using this for the latter part.&lt;/p&gt;

&lt;h1&gt;
  
  
  HTML/CSS Template
&lt;/h1&gt;

&lt;p&gt;Now that we have a WordPress setup. Let us start creating the base template of our website. I will be using the &lt;em&gt;Holy Grail&lt;/em&gt; layout from &lt;a href="https://alligator.io/css/css-grid-holy-grail-layout/" rel="noopener noreferrer"&gt;this article at Alligator.io&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Holy Grail is a layout pattern that’s very common on the web. It consists of a header, a main content area with fixed-width navigation on the left, content in the middle and a fixed-width sidebar on the right and then a footer.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Here is the demo I built on Codepen.io. We will be using this as our layout on GatsbyJS.&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/geocine/embed/wNVbeW?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h1&gt;
  
  
  GatsbyJS
&lt;/h1&gt;

&lt;p&gt;If you are following this guide, I assume you have NodeJS setup on your machine. If not, here &lt;a href="https://www.taniarascia.com/how-to-install-and-use-node-js-and-npm-mac-and-windows/" rel="noopener noreferrer"&gt;is a step by step guide&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;GatsbyJS is ReactJS under the hood so it would be easier to follow this if you have basic understanding of React or frontend frameworks in general. Here is a good starter to &lt;a href="https://www.youtube.com/watch?v=JPT3bFIwJYA&amp;amp;list=PL55RiY5tL51oyA8euSROLjMFZbXaV7skS" rel="noopener noreferrer"&gt;ReactJS Basics&lt;/a&gt; by &lt;em&gt;Maximilian Schwarzmüller&lt;/em&gt;. Don't worry, you should still be able to follow this guide.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting up GatsbyJS
&lt;/h2&gt;

&lt;p&gt;We will be using the &lt;a href="https://www.gatsbyjs.org/starters/GatsbyCentral/gatsby-starter-wordpress/" rel="noopener noreferrer"&gt;gatsby-starter-wordpress&lt;/a&gt;. Here &lt;code&gt;gatsbyhg&lt;/code&gt; is the name of our project, you may use any name you want.&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&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%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/GatsbyCentral" rel="noopener noreferrer"&gt;
        GatsbyCentral
      &lt;/a&gt; / &lt;a href="https://github.com/GatsbyCentral/gatsby-starter-wordpress" rel="noopener noreferrer"&gt;
        gatsby-starter-wordpress
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      LOOKING FOR MAINTAINER  - - - A GatsbyJS starter template that leverages the WordPress API, ACF and more
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;Gatsby v2 WordPress Starter&lt;/h1&gt;
&lt;/div&gt;
&lt;p&gt;This starter is forked from the
&lt;a href="https://github.com/netlify-templates/gatsby-starter-netlify-cms" rel="noopener noreferrer"&gt;gatsby-starter-netlify-cms&lt;/a&gt;
and modified to use WordPress instead of netlify-cms, using the &lt;a href="https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-source-wordpress" rel="noopener noreferrer"&gt;gatsby-source-wordpress&lt;/a&gt; plugin as the data connector.&lt;/p&gt;
&lt;p&gt;Demo: &lt;a href="https://gatsby-starter-wordpress.netlify.com/" rel="nofollow noopener noreferrer"&gt;https://gatsby-starter-wordpress.netlify.com/&lt;/a&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Looking for maintainer&lt;/strong&gt;: If you're interested in taking over the maintenance of this starter, please reach out in an issue. We're not working with Gatsby any more (it got way too complicated, hello nextjs), and so we're not maintaining this.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Use It Now&lt;/h2&gt;
&lt;/div&gt;
&lt;div class="snippet-clipboard-content notranslate position-relative overflow-auto"&gt;&lt;pre class="notranslate"&gt;&lt;code&gt;gatsby new NAME https://github.com/GatsbyCentral/gatsby-starter-wordpress
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Edit &lt;code&gt;gatsby-config.js&lt;/code&gt;, change &lt;code&gt;baseUrl&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;Make sure you have at least 1 post and 1 page on your WordPress site&lt;/li&gt;
&lt;li&gt;Make sure at least 1 post has at least 1 tag&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Ensure the permalink structure in your WordPress installation is set to &lt;code&gt;Post Name&lt;/code&gt; instead of the deafult &lt;code&gt;Plain&lt;/code&gt;, or else the &lt;code&gt;gatsby-source-wordpress&lt;/code&gt; plugin won't be able to communicate with WordPress&lt;/li&gt;
&lt;li&gt;Rejoice
&lt;ul&gt;
&lt;li&gt;For more information on the source plugin, check out the…&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/GatsbyCentral/gatsby-starter-wordpress" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;br&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx gatsby new gatsbyhg https://github.com/GatsbyCentral/gatsby-starter-wordpress
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can preview what's on this gatsby starter template by running it&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;yarn start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, navigate to &lt;code&gt;http://localhost:8000/&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Connecting to our WordPress site
&lt;/h2&gt;

&lt;p&gt;To connect to our WordPress site. Open the &lt;code&gt;gatsby-config.js&lt;/code&gt; file. Look for &lt;code&gt;baseUrl&lt;/code&gt;, modify it to point to your site without the &lt;code&gt;https://&lt;/code&gt;. Start the project and check if the content displayed is indeed from your WordPress site.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yarn start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Integrating our HTML/CSS template
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://www.gatsbyjs.org/starters/GatsbyCentral/gatsby-starter-wordpress/" rel="noopener noreferrer"&gt;gatsby-starter-wordpress&lt;/a&gt; already has a template built with it. We will replace this with our &lt;em&gt;Holy Grail&lt;/em&gt; layout.&lt;/p&gt;

&lt;p&gt;First, let's edit the &lt;code&gt;src/components/Layout.js&lt;/code&gt; to match our layout.&lt;br&gt;
We will be specifically modifying this portion:&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&amp;gt;&lt;/span&gt;
   &lt;span class="nt"&gt;&amp;lt;Helmet&lt;/span&gt; &lt;span class="na"&gt;title=&lt;/span&gt;&lt;span class="s"&gt;"Home | Gatsby + WordPress"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
   &lt;span class="nt"&gt;&amp;lt;Navbar&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
   &lt;span class="nt"&gt;&amp;lt;div&amp;gt;&lt;/span&gt;{children}&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
 &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;To this :&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;className=&lt;/span&gt;&lt;span class="s"&gt;"layout"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;Helmet&lt;/span&gt; &lt;span class="na"&gt;title=&lt;/span&gt;&lt;span class="s"&gt;"Home | Gatsby + WordPress"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;header&amp;gt;&lt;/span&gt;Header&lt;span class="nt"&gt;&amp;lt;/header&amp;gt;&lt;/span&gt;

    &lt;span class="nt"&gt;&amp;lt;Navbar&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;

    &lt;span class="nt"&gt;&amp;lt;main&amp;gt;&lt;/span&gt;{children}&lt;span class="nt"&gt;&amp;lt;/main&amp;gt;&lt;/span&gt;

    &lt;span class="nt"&gt;&amp;lt;aside&amp;gt;&lt;/span&gt;Sidebar&lt;span class="nt"&gt;&amp;lt;/aside&amp;gt;&lt;/span&gt;

    &lt;span class="nt"&gt;&amp;lt;footer&amp;gt;&lt;/span&gt;Footer&lt;span class="nt"&gt;&amp;lt;/footer&amp;gt;&lt;/span&gt;
  &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;Next we add a CSS file called &lt;code&gt;style.css&lt;/code&gt; under &lt;code&gt;src/components/&lt;/code&gt; with the following content:&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="c"&gt;/* Layout */&lt;/span&gt;

&lt;span class="nc"&gt;.layout&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;grid&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="py"&gt;grid-template-areas&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="s1"&gt;"header header header"&lt;/span&gt;
    &lt;span class="s1"&gt;"nav content side"&lt;/span&gt;
    &lt;span class="s1"&gt;"footer footer footer"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="py"&gt;grid-template-columns&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;200px&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="n"&gt;fr&lt;/span&gt; &lt;span class="m"&gt;200px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="py"&gt;grid-template-rows&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;auto&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="n"&gt;fr&lt;/span&gt; &lt;span class="nb"&gt;auto&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="py"&gt;grid-gap&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100vh&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nt"&gt;header&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="py"&gt;grid-area&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;header&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;justify-content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;space-between&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;  
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nt"&gt;nav&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="py"&gt;grid-area&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;nav&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;margin-left&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0.5rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nt"&gt;main&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="py"&gt;grid-area&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nt"&gt;aside&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="py"&gt;grid-area&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;side&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;margin-right&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0.5rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nt"&gt;footer&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="py"&gt;grid-area&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;footer&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c"&gt;/* Theme */&lt;/span&gt;
&lt;span class="c"&gt;/* This is optional, you can use your own style for this */&lt;/span&gt;

&lt;span class="nt"&gt;body&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;font-family&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;-apple-system&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;system-ui&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;BlinkMacSystemFont&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s1"&gt;"Segoe UI"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;Roboto&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s1"&gt;"Helvetica Neue"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;Arial&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nb"&gt;sans-serif&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nt"&gt;header&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;18px&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="m"&gt;#fff&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;min-height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;20px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#0a2b4e&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;20px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nt"&gt;nav&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;span class="nt"&gt;aside&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#666&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&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="m"&gt;#fff&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nt"&gt;footer&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;black&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="m"&gt;#fff&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;20px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.navbar-item&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;inline-block&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="m"&gt;#fff&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.navbar-item&lt;/span&gt; &lt;span class="nt"&gt;img&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;20px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.pagination&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;black&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.pagination&lt;/span&gt; &lt;span class="nt"&gt;a&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="m"&gt;#fff&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;Modify style imports on  &lt;code&gt;src/components/Layout.js&lt;/code&gt;&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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./style.css&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="c1"&gt;// add this&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./style/all.sass&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="c1"&gt;// remove this, we won't be needing this anymore&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can view the &lt;a href="https://gatsbyhg.netlify.com/" rel="noopener noreferrer"&gt;demo&lt;/a&gt; here. The source code is &lt;a href="https://github.com/geocine/gatsbyhg" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>gatsby</category>
      <category>wordpress</category>
      <category>jamstack</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Challenges in Headless WordPress with GatsbyJS</title>
      <dc:creator>Aivan Monceller</dc:creator>
      <pubDate>Sat, 23 Feb 2019 06:25:22 +0000</pubDate>
      <link>https://dev.to/geocine/challenges-in-headless-wordpress-with-gatsbyjs-4a0b</link>
      <guid>https://dev.to/geocine/challenges-in-headless-wordpress-with-gatsbyjs-4a0b</guid>
      <description>&lt;p&gt;Fellow developers, who have used Headless WordPress with GatsbyJS on one of your latest projects what were the major challenges you encountered and how did you go about solving it?&lt;/p&gt;

&lt;p&gt;In this post, I will try to share my experience working on a recent project with this stack. &lt;/p&gt;

&lt;h1&gt;
  
  
  Gutenberg Editor
&lt;/h1&gt;

&lt;p&gt;The Gutenberg editor is a new editor developed by the WordPress team which was released in version 5 of WordPress. You can get a feel of this editor by trying it out on &lt;a href="https://frontenberg.tomjn.com/" rel="noopener noreferrer"&gt;this website&lt;/a&gt; setup by &lt;em&gt;Tom J Nowell&lt;/em&gt; and the official Gutenberg project &lt;a href="https://github.com/WordPress/gutenberg" rel="noopener noreferrer"&gt;here&lt;/a&gt;. I realized that this is exactly what I need for my users' needs&lt;/p&gt;

&lt;h2&gt;
  
  
  Rendering generated content on Gatsby
&lt;/h2&gt;

&lt;p&gt;The very basic way to render content coming from WordPress is this way&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;return &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;dangerouslySetInnerHTML&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;__html&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;WordPressPage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;content&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;/&amp;gt;)&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;How will you be able to render an image gallery which opens a modal when you click on one of the images if the markup generated by WordPress is something like this?&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;"gallery"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"https://placekitten.com/200/300"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"https://placekitten.com/g/200/300"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&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;I have used &lt;code&gt;html-react-parser&lt;/code&gt; and transformed this HTML string into a component. &lt;/p&gt;

&lt;p&gt;Check the code below. Note that the custom Gallery component I implemented here doesn't have that modal I talked about earlier. But since its already a React component, we can do just about anything.&lt;/p&gt;

&lt;p&gt;&lt;iframe src="https://stackblitz.com/edit/html-to-react-component?" width="100%" height="500"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Style of preview should match rendered Gatsby content
&lt;/h2&gt;

&lt;p&gt;Here we should at least sync the styles of the preview with the rendered content. &lt;/p&gt;

&lt;p&gt;Either we repurpose an existing block or create our own custom blocks so that it will look exactly the same on the editor and the site. FYI, blocks are written in React.&lt;/p&gt;

&lt;p&gt;I created overrides of the block styles at the theme level and made sure the same is shown on Gatsby. If we don't do this then the editor is not a WYSIWYG anymore. &lt;/p&gt;

&lt;p&gt;The major challenge here is, the user can install some new blocks then we have to write support code and make sure it doesn't break the others. &lt;/p&gt;

&lt;h2&gt;
  
  
  ACF on Gutenberg Editor Page
&lt;/h2&gt;

&lt;p&gt;At first, you'll think that your &lt;a href="https://www.advancedcustomfields.com/" rel="noopener noreferrer"&gt;Advanced Custom Fields&lt;/a&gt; are broken if you have placed fields below the title. With Gutenberg activated, ACF will only show if you place it below the content. &lt;/p&gt;

&lt;p&gt;I haven't tried placing it on the sidebar but I am guessing it should work too.&lt;/p&gt;

&lt;h1&gt;
  
  
  Publishing Content
&lt;/h1&gt;

&lt;p&gt;I have chosen Netlify to host the content generated by Gatsby. It's fast and reliable. &lt;/p&gt;

&lt;h2&gt;
  
  
  Instant Feeback
&lt;/h2&gt;

&lt;p&gt;I understand users need a way to validate what they have just published instantly. &lt;/p&gt;

&lt;p&gt;I have explored &lt;a href="https://github.com/justinwhall/littlebot-netlify" rel="noopener noreferrer"&gt;this plugin&lt;/a&gt; to solve this issue. During save, this will call a build hook on Netlify to trigger the deployment. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Make sure you have something set for both &lt;code&gt;Production&lt;/code&gt; and &lt;code&gt;Staging&lt;/code&gt;, else the plugin will not work.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It will still take some time to reflect changes on the actual site.&lt;/p&gt;

&lt;h2&gt;
  
  
  Gatsby Cache
&lt;/h2&gt;

&lt;p&gt;There are some instances where I have to clear the cache just to see the changes that I have done.&lt;/p&gt;

&lt;p&gt;I am not sure, what is causing this. It doesn't happen too often though. There is already an &lt;a href="https://github.com/gatsbyjs/gatsby/issues/11747" rel="noopener noreferrer"&gt;open issue&lt;/a&gt; at Gatsby.&lt;/p&gt;

&lt;p&gt;I could explore server-side rendering using Next.js but I really like the Gatsby workflow.&lt;/p&gt;

&lt;h1&gt;
  
  
  Global Settings
&lt;/h1&gt;

&lt;p&gt;There are some things I wanted for the user to be able to configure like the following: footer text, company address, email, etc.&lt;/p&gt;

&lt;p&gt;I haven't tried to look into solutions yet. I am interested in how you guys will approach this.&lt;/p&gt;

&lt;h1&gt;
  
  
  Forms
&lt;/h1&gt;

&lt;p&gt;I used the form submission API provided by Netlify. It was not a straightforward journey. &lt;/p&gt;

&lt;p&gt;I had everything correctly setup by following &lt;a href="https://www.netlify.com/blog/2017/07/20/how-to-integrate-netlifys-form-handling-in-a-react-app/" rel="noopener noreferrer"&gt;this documentation&lt;/a&gt; yet I was not receiving any submissions. &lt;/p&gt;

&lt;p&gt;You should put this in mind. Do not try to test the form with your usual testing instincts. Netlify will automatically block form submissions if it looks like spam without you even knowing. You should test it like filling out a real form not the garbled test strings from muscle memory.&lt;/p&gt;

&lt;p&gt;I wish there was a way on Netlify forms to at least see how many messages were blocked or even disable the filtering on development mode.&lt;/p&gt;

&lt;p&gt;My users wanted to have the messages straight to their emails so I integrated with Zapier.&lt;/p&gt;

&lt;h1&gt;
  
  
  Pages on Gatsby
&lt;/h1&gt;

&lt;p&gt;I am creating pages in Gatsby using the &lt;code&gt;gatsby-node.js&lt;/code&gt; but there are specific pages I want to explicitly create because they have specific styling and stuff.&lt;/p&gt;

&lt;p&gt;For these pages, I query the WordPress API via the page id. These page ids I also exclude on the auto-creation at &lt;code&gt;gatsby-node.js&lt;/code&gt;. This is done to make sure that the page will work even though the title or slug is changed.&lt;/p&gt;

&lt;p&gt;However, if a slug is changed, there will be no route to handle it on Gatsby. Maybe, I am trying to create a non-issue here but this is worth mentioning.&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;If you are a frontend developer who hasn't really done any react or WordPress development in the past. This is something I think you should at least try.&lt;/p&gt;

&lt;p&gt;This workflow is really something that I would like to 'perfect' it allows us to create anything out of a WordPress API.&lt;/p&gt;

&lt;p&gt;I hope these challenges would help you decide if this is something for you. I do expect to get some feedback from the community as well about the challenges you encountered with this stack and how you solved or plan to solve it. &lt;/p&gt;

</description>
      <category>wordpress</category>
      <category>gatsby</category>
      <category>jamstack</category>
      <category>netlify</category>
    </item>
  </channel>
</rss>
