<?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: Alex Nielsen</title>
    <description>The latest articles on DEV Community by Alex Nielsen (@bushbass).</description>
    <link>https://dev.to/bushbass</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%2F74759%2Fa473108e-3a9f-4071-abbc-7ba8187a6312.jpeg</url>
      <title>DEV Community: Alex Nielsen</title>
      <link>https://dev.to/bushbass</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/bushbass"/>
    <language>en</language>
    <item>
      <title>My Gatsby site stopped working, and how I fixed it</title>
      <dc:creator>Alex Nielsen</dc:creator>
      <pubDate>Fri, 01 Jan 2021 07:18:21 +0000</pubDate>
      <link>https://dev.to/bushbass/my-gatsby-site-stopped-working-and-how-i-fixed-it-1f9h</link>
      <guid>https://dev.to/bushbass/my-gatsby-site-stopped-working-and-how-i-fixed-it-1f9h</guid>
      <description>&lt;p&gt;&lt;strong&gt;&lt;em&gt;TL:DR&lt;/em&gt;&lt;br&gt;
Enable Public Introspection should be checked in WordPress plugin administration&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;My blog is running on Gatsby with Wordpress as a headless CMS for my old blog posts. I recently went to update a few things, just fixing typos in blogs, no code changes, and the darn thing would suddenly not compile!&lt;/p&gt;

&lt;p&gt;I kept getting&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ERROR #11321  PLUGIN
"gatsby-source-graphql" threw an error while running the sourceNodes lifecycle:
warn The gatsby-source-graphql plugin has generated no Gatsby nodes. Do you need it?

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

&lt;/div&gt;



&lt;p&gt;and&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ERROR #85923 GRAPHQL
There was an error in your GraphQL query:
Cannot query field "wpgraphql" on type "Query".

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

&lt;/div&gt;



&lt;p&gt;I figured this meant that Gatsby was not getting any response from my Wordpress site.  I went back to the egghead.io training I used to help me learn how to build the site and realized the WPGraphQL plugin used in the video was on version 0.7.0 and I apparently updated at some point to version 1.0.5. In the GraphQL settings on the left side of the Wordpress administration page, down at the bottom there is a field called 'Enable Public Introspection' which was not clicked. It basically says by default, queries need to be authenticated unless this box is checked. So I checked it, meaning you don't need authentication to hit the wordpress API anymore. Well, it worked. Presumably, you can send some auth info in your query if you need to keep it private but for me just posting blogs I'm not worried about it.&lt;/p&gt;

</description>
      <category>gatsby</category>
    </item>
    <item>
      <title>A Super quick guide to arrow functions</title>
      <dc:creator>Alex Nielsen</dc:creator>
      <pubDate>Wed, 26 Feb 2020 21:30:33 +0000</pubDate>
      <link>https://dev.to/bushbass/a-super-quick-guide-to-arrow-functions-486h</link>
      <guid>https://dev.to/bushbass/a-super-quick-guide-to-arrow-functions-486h</guid>
      <description>&lt;p&gt;This is NOT a definitive guide to arrow functions. I’m writing a few other tutorials and blogs and want to have something to point people to so they can have a quick explanation and example of arrow functions since they are in so many of the modern frameworks. Just enough to be dangerous! To be clear, there are reasons where you should not use arrow functions, but they are not going to be discussed in this blog post. I just want you to be able to know how they work when you see them “in the wild”.&lt;/p&gt;

&lt;p&gt;Let’s get started. I’m going to take you step by step converting a regular function into an arrow function.&lt;/p&gt;

&lt;p&gt;Here’s a regular function using the function keyword&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F9vpfmcgnsekyd04jacqj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F9vpfmcgnsekyd04jacqj.png" alt="A regular old function"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let’s change that to an anonymous function expression&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fy28nbdyih2vrlzpoyp5j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fy28nbdyih2vrlzpoyp5j.png" alt="Function Expression"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Should be nothing new here so far. No Arrows or ES6 yet, but here it comes…&lt;/p&gt;

&lt;p&gt;First remove the function keyword and add the arrow&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fh8uu3sa7rgs3bd76ujqt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fh8uu3sa7rgs3bd76ujqt.png" alt="Basic Arrow Function"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The only thing going on there is removing the function keyword and adding the arrow. And that’s it! You’ve gone and made an arrow function! Hurray! But wait, there’s more!&lt;/p&gt;

&lt;p&gt;If there is only one argument, you can get rid of the parentheses around it.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Flb4qi18y39oa91yhivwx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Flb4qi18y39oa91yhivwx.png" alt="Arrow function with parentheses removed"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Getting pretty lean but we can take it even further. If the body of the code is only one line, we can get rid of the curly braces.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fm9mi26ckjcr1xnchrd7t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fm9mi26ckjcr1xnchrd7t.png" alt="Arrow function with parentheses and braces removed"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Frequently, you’ll see these used as a callback in another function so there is no const and no function name. This is the case that we see quite a bit and the real reason I wrote this all up in the first place&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Flobbd53i6eu9dmqqdfz9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Flobbd53i6eu9dmqqdfz9.png" alt="Anonymous arrow function"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This doesn’t do anything on its own, but as a callback it’s useful. Here we’re using as a callback for looping over an array with the forEach array method.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F4jqxr6ae5q2et7bw9jih.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F4jqxr6ae5q2et7bw9jih.png" alt="Array.forEach with arrow function"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As a comparison, here’s a regular old for loop. Sure, we understand this as programmers, but the arrow function just reads like a sentence in normal language. So much easier to understand!&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fanmroe9zzwgrbhdmmwfs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fanmroe9zzwgrbhdmmwfs.png" alt="Looping over an array with a for loop"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I think that covers the basics. Again this is not meant to be the definitive guide, just an intro to figure out what they mean because we see them ‘in the wild’ in all the modern frameworks.&lt;/p&gt;

&lt;p&gt;I added a video version of this blog. If you prefer video, check it out: &lt;br&gt;
YouTube: &lt;iframe width="710" height="399" src="https://www.youtube.com/embed/HC2W75WMw6c"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>arrowfunction</category>
      <category>es6</category>
    </item>
    <item>
      <title>I have two accounts by accident</title>
      <dc:creator>Alex Nielsen</dc:creator>
      <pubDate>Tue, 21 Jan 2020 14:53:14 +0000</pubDate>
      <link>https://dev.to/bushbass/i-have-two-accounts-by-accident-260p</link>
      <guid>https://dev.to/bushbass/i-have-two-accounts-by-accident-260p</guid>
      <description>&lt;p&gt;Somehow I have two accounts.  One with my twitter login and one with my github.  Is there any easy way to combine them and get rid of one or should I just leave one hanging and choose the other and focus on it?  Thanks for any input.&lt;/p&gt;

</description>
      <category>help</category>
    </item>
    <item>
      <title>Event delegation in JavaScript</title>
      <dc:creator>Alex Nielsen</dc:creator>
      <pubDate>Sun, 30 Dec 2018 14:08:44 +0000</pubDate>
      <link>https://dev.to/bushbass/event-delegation-in-javascript-4bnc</link>
      <guid>https://dev.to/bushbass/event-delegation-in-javascript-4bnc</guid>
      <description>&lt;p&gt;I have been making web development videos to help me solidify what I've been learning. This one is about event delegation in JavaScript. How to add one listener to multiple elements.  &lt;a href="https://youtu.be/buVEB6TI3VU"&gt;https://youtu.be/buVEB6TI3VU&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
    </item>
    <item>
      <title>How Array.map works in JavaScript with and example in React</title>
      <dc:creator>Alex Nielsen</dc:creator>
      <pubDate>Thu, 20 Dec 2018 02:49:04 +0000</pubDate>
      <link>https://dev.to/bushbass/how-arraymap-works-in-javascript-with-and-example-in-react-581i</link>
      <guid>https://dev.to/bushbass/how-arraymap-works-in-javascript-with-and-example-in-react-581i</guid>
      <description>&lt;p&gt;I'm new to Dev.to but I wanted to get something up here.  I'm currently a stay-at-home-dad but I am wokring on making a return to tech full-time.  A sizeable gap in my employment in the tech industry has made it difficult to show relevant work experience, so I decided to start my blog to share what I'm re-learning.  I'm still a bit hit or miss on whether or not I really keep it updated but I do have a few recent videos I've put on youtube.  I recently made a video explaining how Array.map works so I thought I would share it here. &lt;/p&gt;

&lt;p&gt;&lt;a href="http://alexnielsen.com/uncategorized/array-map-how-the-map-method-works-in-javascript/"&gt;How Array.map works in JavaScript&lt;/a&gt; &lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
