<?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: Dan V</title>
    <description>The latest articles on DEV Community by Dan V (@dan_v).</description>
    <link>https://dev.to/dan_v</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%2F277414%2F61483ce9-d12c-4153-8393-4083545c2e19.jpg</url>
      <title>DEV Community: Dan V</title>
      <link>https://dev.to/dan_v</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dan_v"/>
    <language>en</language>
    <item>
      <title>ES6 Arrow Function Syntax Explained Simply</title>
      <dc:creator>Dan V</dc:creator>
      <pubDate>Sun, 18 Apr 2021 13:28:34 +0000</pubDate>
      <link>https://dev.to/dan_v/es6-arrow-function-syntax-explained-simply-77j</link>
      <guid>https://dev.to/dan_v/es6-arrow-function-syntax-explained-simply-77j</guid>
      <description>&lt;h1&gt;
  
  
  ES6 Arrow Function Syntax Explained Simply
&lt;/h1&gt;

&lt;p&gt;Photo by &lt;a href="https://unsplash.com/@flowforfrank?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Ferenc Almasi&lt;/a&gt; on &lt;a href="https://unsplash.com/?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Unsplash&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;This is a JavaScript arrow function:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const getUserIds = users =&amp;gt; users.map(user =&amp;gt; user.id)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If your response to the above code is, "Wait, what?!", then read on! Even if you do understand what's going on, you may still pick up a thing or two along the way.&lt;/p&gt;

&lt;p&gt;Some initial questions you may have:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What is it doing?!&lt;/li&gt;
&lt;li&gt;What is it returning (if anything)?&lt;/li&gt;
&lt;li&gt;What does the arrow mean?&lt;/li&gt;
&lt;li&gt;What is &lt;code&gt;users&lt;/code&gt; doing there?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In this article, I want to go over the basics of arrow functions to help new JavaScript developers understand what is &lt;em&gt;actually&lt;/em&gt; going on here.&lt;/p&gt;

&lt;h2&gt;
  
  
  A quick bit of history
&lt;/h2&gt;

&lt;p&gt;ES6 was the 6th Edition of JavaScript released in 2015. It is also known as "ECMAScript 6" or "EMCAScript2015". ES6 was a major revision of JavaScript, and introduced new syntax to help developers write complex code in a simpler form.&lt;/p&gt;

&lt;p&gt;One of these new additions was arrow function syntax. Arrow function syntax (or just "arrow syntax") provides a different method of writing functions, in a way that is often shorter and mostly quicker to write and comprehend once you've grasped how the syntax works.&lt;/p&gt;

&lt;h2&gt;
  
  
  "Normal" functions vs arrow functions
&lt;/h2&gt;

&lt;p&gt;Here is a simple &lt;strong&gt;function declaration&lt;/strong&gt; in basic JavaScript:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function times10(number) {
  return number * 10;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here is the same thing as an &lt;strong&gt;arrow function&lt;/strong&gt; using ES6 arrow syntax:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const times10 = number =&amp;gt; number * 10;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's pick out the main, visible differences in the arrow function:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;There are no curly braces (&lt;code&gt;{}&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt; There are no parentheses (or "brackets") around the function parameter (i.e. &lt;code&gt;= user =&amp;gt;&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Arguably, the syntax is a bit more &lt;em&gt;streamlined&lt;/em&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Note that I use the word "streamlined", and not "better" or "simpler".&lt;/p&gt;

&lt;h2&gt;
  
  
  How is this useful?
&lt;/h2&gt;

&lt;p&gt;Perhaps you're not convinced that the use of arrow syntax in the above example is providing anything much more useful than the "normal" way of writing functions. In this case, I'd tend to agree. However, arrow functions begin to show their use in more complex scenarios.&lt;/p&gt;

&lt;p&gt;Take the below function, which gets ids from an array of user data:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;getUserIds(users) {
  return users.map(function(user) {
    return user.id;
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Using arrow syntax, we can choose to write this function as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const getUserIds = users =&amp;gt; users.map(user =&amp;gt; user.id);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In some ways, you may find the arrow function more readable and probably quicker write too. Try writing each function in a code editor and see how they compare.&lt;/p&gt;

&lt;p&gt;Now, let's break down what is happening in the arrow function's single line of code: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;We are &lt;strong&gt;declaring a variable&lt;/strong&gt; named &lt;code&gt;getUserIds&lt;/code&gt;. &lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;value&lt;/strong&gt; of &lt;code&gt;getUserIds&lt;/code&gt; is &lt;strong&gt;a function definition&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;That&lt;/em&gt; function takes an argument named &lt;code&gt;users&lt;/code&gt;. &lt;/li&gt;
&lt;li&gt;The function uses a JavaScript array function called &lt;code&gt;map()&lt;/code&gt; to iterate over each item in the &lt;code&gt;users&lt;/code&gt; array and &lt;strong&gt;return a new array&lt;/strong&gt; containing only the user ids.&lt;/li&gt;
&lt;li&gt;The function &lt;strong&gt;returns the array that was returned&lt;/strong&gt; by the map() function.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All on one line. &lt;/p&gt;

&lt;h2&gt;
  
  
  How did we get here?
&lt;/h2&gt;

&lt;p&gt;Arrow function syntax is flexible, and we could have written this function in a few different ways, including being more verbose with our syntax. &lt;/p&gt;

&lt;p&gt;For example, each of these functions when called would map over the &lt;code&gt;users&lt;/code&gt; array and return an array of user ids:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// ✔️
const getUserIds1 = (users) =&amp;gt; {
  return users.map((user) =&amp;gt; {
    return user.id;
  });
}

// ✔️
const getUserIds2 = users =&amp;gt; {
  return users.map(user =&amp;gt; {
    return user.id;
  });
}

// ✔️
const getUserIds3 = users =&amp;gt; users.map(user =&amp;gt; {
  return user.id
})

// ✔️
const getUserIds4 = users =&amp;gt; users.map(user =&amp;gt; user.id)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the second example, we were able to remove the parentheses from around the &lt;code&gt;users&lt;/code&gt; and &lt;code&gt;user&lt;/code&gt; parameters, and it works exactly the same.&lt;/p&gt;

&lt;p&gt;Why do this? Arguably: for simplicity, though it is entirely optional. Note that &lt;strong&gt;this only works&lt;/strong&gt; for functions with a &lt;strong&gt;single parameter&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In the third and fourth examples, we stripped the syntax down further, removing the braces (&lt;code&gt;{}&lt;/code&gt;) and the &lt;code&gt;return&lt;/code&gt; keywords from the &lt;code&gt;getUserIds()&lt;/code&gt; function and then the &lt;code&gt;map()&lt;/code&gt; function. This is called &lt;strong&gt;implicit return&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Multiple parameters
&lt;/h3&gt;

&lt;p&gt;If your function has multiple parameters (takes multiple arguments), you must use parentheses:&lt;/p&gt;

&lt;p&gt;❌ Will throw a syntax error:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const getUserIds = users, prefix =&amp;gt; {
  return users.map(user =&amp;gt; prefix + user.id);
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✔️ This is fine:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const getUserIds = (users, prefix) =&amp;gt; {
  return users.map(user =&amp;gt; prefix + user.id);
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Argument destructuring
&lt;/h4&gt;

&lt;p&gt;You must however always use parentheses when using argument destructuring:&lt;/p&gt;

&lt;p&gt;❌ Will throw a syntax error:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const user = { id: 1, name: "Daniel" }
const getName = { name } =&amp;gt; name;
getName(user);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✔️ This is fine:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const user = { id: 1, name: "Daniel" }
const getName = ({ name }) =&amp;gt; name;
getName(user)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Implicit return
&lt;/h3&gt;

&lt;p&gt;Arrow functions return the last value returned within it's own scope by default. Note that you should &lt;em&gt;not&lt;/em&gt; use the &lt;code&gt;return&lt;/code&gt; keyword when writing an arrow function without braces.&lt;/p&gt;

&lt;p&gt;Here are some examples of returning (or not) from arrow functions:&lt;/p&gt;

&lt;p&gt;Here is our &lt;code&gt;users&lt;/code&gt; data:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const users = [{id: 1, name: "Aaron"}, {id: 2, name: "Maya"}]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;❌ Using &lt;code&gt;return&lt;/code&gt; without braces:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const getUserIds = (users) =&amp;gt; return users.map(user =&amp;gt; user.id)
                                   ^^^^^^

Uncaught SyntaxError: Unexpected token 'return'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✔️ Implicit return:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const getUserIds = (users) =&amp;gt; users.map(user =&amp;gt; user.id)

getUserIds(users)

// [1, 2]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✔️ Explicit return:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const getUserIds = (users) =&amp;gt; {
  return users.map(user =&amp;gt; user.id);
}

getUserIds(users)

// [1, 2]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✔️ Explicitly returning nothing (or &lt;code&gt;undefined&lt;/code&gt;, to be precise):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const getUserIds = (users) =&amp;gt; {
  users.map(user =&amp;gt; user.id);
}

getUserIds(users)

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

&lt;/div&gt;



&lt;p&gt;You may have expected that last example to return &lt;code&gt;[1, 2]&lt;/code&gt;, as that is what &lt;code&gt;map()&lt;/code&gt; returns. However, the lack of a &lt;code&gt;return&lt;/code&gt; keyword means we are not returning the return value of &lt;code&gt;map()&lt;/code&gt;. While &lt;code&gt;map()&lt;/code&gt; returns a value, we have not set up &lt;code&gt;getUserIds&lt;/code&gt; to explicitly or implicitly return that value. Hence, the return value of &lt;code&gt;getUserIds&lt;/code&gt; is &lt;code&gt;undefined&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Anonymous functions
&lt;/h3&gt;

&lt;p&gt;We can also use arrow syntax to write anonymous functions. I won't go in-depth on anonymous functions here, but this is what they look like in regular and arrow syntax:&lt;/p&gt;

&lt;p&gt;Anonymous function declaration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function(x, y) { 
  return x + y;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Anonymous function expression (implicit return):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function(x, y) { x + y }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Anonymous arrow functions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(x, y) =&amp;gt; x + y;
// Returns x plus y

(x) =&amp;gt; x * 100;
// Returns x times 100

x =&amp;gt; x
// Returns x

x =&amp;gt; {
  return x;
}
// Returns x

const z = 99;
() =&amp;gt; z + 1;
// Returns 100;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Ok, but what does the arrow mean?!
&lt;/h2&gt;

&lt;p&gt;The arrow is characters which form syntax which Node or the browser will recognise, just like &lt;code&gt;===&lt;/code&gt; or &lt;code&gt;.&lt;/code&gt; or &lt;code&gt;+&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;It says: "and now I'm going to tell you what this function does".&lt;/p&gt;

&lt;p&gt;A nice way to think about it &lt;strong&gt;semantically&lt;/strong&gt; is picturing the arrow as the conveyer belt which moves the arguments through the function.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const add = (a, b) =&amp;gt; a + b;
// Take these things, (a,b), and move them through 
// in this direction =&amp;gt; into the function, leaving 
// the result on the other side.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Some caveats
&lt;/h2&gt;

&lt;p&gt;Arrow functions are not that different from regular functions. Most of time, you can use them interchangeably without fear of consequence.&lt;/p&gt;

&lt;p&gt;However, there are a few technical points you should be aware of when using arrow functions.&lt;/p&gt;

&lt;h3&gt;
  
  
  No function hoisting
&lt;/h3&gt;

&lt;p&gt;Functions written using the &lt;code&gt;function&lt;/code&gt; keyword are "hoisted" at runtime. In simple terms, this means the engine running your code (i.e. Node) will take these functions and store them in memory before executing the rest of your code.&lt;/p&gt;

&lt;p&gt;✔️ So you can do this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;multiply(5, 2)
// 10

function multiply(x, y) {
  return x * y;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We've written our code in a way where we're calling &lt;code&gt;multiply()&lt;/code&gt;  before defining what &lt;code&gt;multiply()&lt;/code&gt; is. &lt;/p&gt;

&lt;p&gt;But because we've used the &lt;code&gt;function&lt;/code&gt; keyword, at runtime &lt;code&gt;multiply()&lt;/code&gt; will &lt;strong&gt;hoisted&lt;/strong&gt;; it will be read and stored in memory (&lt;em&gt;defined&lt;/em&gt;) before the line &lt;code&gt;multiply(5, 2)&lt;/code&gt; is executed.&lt;/p&gt;

&lt;p&gt;❌ But you can't do this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;multiply(5, 2) // TypeError: multiply is not a function

const multiply = (x, y) =&amp;gt; {
  return x * y;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because we've used arrow syntax, &lt;code&gt;multiply()&lt;/code&gt; has not been hoisted. So when the runtime engine gets to &lt;code&gt;multiply(5, 2)&lt;/code&gt;, it sees that &lt;code&gt;multiply()&lt;/code&gt; is not defined at this point in the execution and throws an error.&lt;/p&gt;

&lt;h3&gt;
  
  
  No &lt;code&gt;this&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Arrow functions do not have their own &lt;code&gt;this&lt;/code&gt;. This is perhaps best explained with examples.&lt;/p&gt;

&lt;p&gt;✔️ Using a normal function to access &lt;code&gt;this&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const myObject1 = {
  x: 10,
  getX: function () {
    return this.x;
  }
};

console.log(myObject1.getX());
// 10
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;❌ Using an arrow function to access &lt;code&gt;this&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const myObject2 = {
  x: 10,
  getX: () =&amp;gt; this.x
};

console.log(myObject2.getX());
// TypeError: Cannot read property 'x' of undefined
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Other caveats
&lt;/h3&gt;

&lt;p&gt;This article is to help you understand the basics of arrow syntax, but it's helpful to be &lt;em&gt;aware&lt;/em&gt; (even if you don't understand in detail) that there are some other technical differences with arrow functions. MDN Web Docs has a good &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions"&gt;rundown of all the differences&lt;/a&gt;, if you are interested in further research.&lt;/p&gt;

&lt;h2&gt;
  
  
  Are arrow functions better?
&lt;/h2&gt;

&lt;p&gt;Not necessarily. Arrow function syntax provides developers with a tool for writing code in a different way, often with the benefits of code that is easier to read and write.&lt;/p&gt;

&lt;p&gt;When ES6 was still fancy and new, arrow functions were seen by some as the "new" way of writing JavaScript functions. Bootcamps and online tutorials would sometimes teach arrow functions by default, and often still do.&lt;/p&gt;

&lt;p&gt;But these days, I'm seeing a trend towards bringing it back to the &lt;code&gt;function&lt;/code&gt; keyword. Kent C. Dodds, a well-renowned React expert, posted &lt;a href="https://kentcdodds.com/blog/function-forms"&gt;an article&lt;/a&gt; about how he uses different function forms for different purposes, which makes for interesting reading.&lt;/p&gt;

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

&lt;p&gt;ES6 arrow function syntax provides a useful way to write more streamlined code which is often more readable. Code readability is important for helping others to understand your code. Likewise, it's important to be able to read others' code well yourself. So regardless of how you like to write functions, it is good to be able to understand different syntaxes when you encounter them.&lt;/p&gt;

&lt;p&gt;I hope this article has been useful for those of you new to writing JavaScript code. If you have any questions, comments, suggestions, or indeed corrections, please let me know in the comments below. I would love to hear your thoughts, whether this article was helpful, and any constructive criticism.&lt;/p&gt;

&lt;p&gt;Please feel free to follow me here and on Twitter (&lt;a href="https://twitter.com/dan_j_v"&gt;@dan_j_v&lt;/a&gt;).&lt;/p&gt;

</description>
      <category>es6</category>
      <category>javascript</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>Use RSS feeds to automate your reading lists and keep up-to-date</title>
      <dc:creator>Dan V</dc:creator>
      <pubDate>Fri, 09 Apr 2021 17:05:48 +0000</pubDate>
      <link>https://dev.to/dan_v/use-rss-feed-and-read-later-apps-to-encourage-learning-55lp</link>
      <guid>https://dev.to/dan_v/use-rss-feed-and-read-later-apps-to-encourage-learning-55lp</guid>
      <description>&lt;h1&gt;
  
  
  Introduction
&lt;/h1&gt;

&lt;p&gt;I recently discovered the magical and somewhat retro world of RSS feeds. Remember that little orange "wifi" icon that used to live next to blog titles? Yes, that's what we're talking about. Very 00s.&lt;/p&gt;

&lt;p&gt;I'm here to tell you why RSS is still useful today, particularly for a developer in the everchanging tech world.&lt;/p&gt;

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

&lt;p&gt;RSS stands for "Really Simple Syndication" (or "RDF Site Summary". Aren't acronyms fun?).&lt;/p&gt;

&lt;p&gt;Put simply, it's a way for websites to allow users to subscribe to their content, most commonly used in blogs.&lt;/p&gt;

&lt;p&gt;RSS has fallen out of vogue in the past 10 years with the rise of social media. but I believe it can still be a very useful tool, particularly in the dev world.&lt;/p&gt;

&lt;h1&gt;
  
  
  Why should I care?
&lt;/h1&gt;

&lt;p&gt;As developers, particularly if you're a newbie, there is so much to learn and to keep on top of. How do we orchestrate the journey of those streams of information from disparate websites and into our brains?&lt;/p&gt;

&lt;p&gt;That's where RSS feed apps come in. RSS feed apps can help you keep up to date with tech blogs, release notes, video tutorials series, and even email-only newsletters.&lt;/p&gt;

&lt;h1&gt;
  
  
  RSS feed apps
&lt;/h1&gt;

&lt;p&gt;There are plenty of apps available out there, each with their pros and cons. I've been checking out two of the most popular, which are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="//feedly.com"&gt;Feedly&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.inoreader.com" rel="noopener noreferrer"&gt;Inoreader&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;They look a bit like this:&lt;/p&gt;

&lt;p&gt;Feedly:&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%2Fuploads%2Farticles%2F2qm6elk7c5djrnqqep1q.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%2Fuploads%2Farticles%2F2qm6elk7c5djrnqqep1q.PNG" alt="Feedly"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Inoreader:&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%2Fuploads%2Farticles%2Fl5a42xcc4w0jqyf0tw48.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%2Fuploads%2Farticles%2Fl5a42xcc4w0jqyf0tw48.PNG" alt="Inoreader"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I have blocked any ads for posting here, but I usually allow them to help support the developers.&lt;/p&gt;

&lt;h2&gt;
  
  
  How it works
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Search for a topic you want to read about and follow any feeds that look interesting.&lt;/li&gt;
&lt;li&gt;Alternatively, enter a URL for a website you want to follow, or use your chosen app's browser extension (if available) to add sites to your feed when you visit them.&lt;/li&gt;
&lt;li&gt;The feed will appear in your feeds list and you'll be able to start browsing through a list of previous posts from that website straight away.&lt;/li&gt;
&lt;li&gt;Over time, you'll see new content from your feeds coming through, like an email inbox.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And that's it!&lt;/p&gt;

&lt;p&gt;Well, that's not it it. There is plenty more you can do with these apps, such as setting up rules for highlighting specific content, sharing reading lists with teams, and much much more.&lt;/p&gt;

&lt;p&gt;But to start with, just by following a few feeds, you can now easily stay up-to-date with React's release notes, or your favourite tech guru's blog, or a YouTube tutorial series you've been following. All in one place!&lt;/p&gt;

&lt;h1&gt;
  
  
  Which app should I use?
&lt;/h1&gt;

&lt;p&gt;It's best to just go out and try a few and find out what you prefer. However, here are a few initial thoughts on the two RSS feed apps I've been trying out:&lt;/p&gt;

&lt;h2&gt;
  
  
  Feedly
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Friendly, helpful UI with plenty of useful action buttons like "save for later" and "mark as read".&lt;/li&gt;
&lt;li&gt;Pretty design. Looks like a magazine.&lt;/li&gt;
&lt;li&gt;Intuitive search UI for finding new feeds.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Inoreader
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Design is more functional and compact.&lt;/li&gt;
&lt;li&gt;Has some really nice features, like "send to device".&lt;/li&gt;
&lt;li&gt;Seems to be able to retrieve images for articles more easily than Feedly.&lt;/li&gt;
&lt;li&gt;Can subscribe to email newsletter subscriptions, without all the inconvenience of them entering your actual email inbox!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There are plenty of other apps available, these are just the two I've spent most time with, and arguably the most popular. They're both great, and I am continuing to trial and compare them.&lt;/p&gt;

&lt;p&gt;A great feature some of these apps have is that they are able to subscribe to web page content updates that don't actually have their own RSS feed. So you're not always relying on websites providing an RSS feed in the first place. (I know that Inoreader can do this; I'm not sure whether Feedly can yet.)&lt;/p&gt;

&lt;p&gt;Now, often RSS feed apps won't be able to retrieve the website's full content, and will encourage you to visit the website itself instead. To me, that's fine. The app is serving the purpose of notifying me about new content, which is the prime purpose of using an RSS feed app.&lt;/p&gt;

&lt;p&gt;But reading content without the usual guff and bulk that websites often come with can be really helpful. Furthermore, having a place outside of your browser tabs to safely store a list of reading materials for later is invaluable. This is why I use a reading app alongside an RSS feed app.&lt;/p&gt;

&lt;h1&gt;
  
  
  Reading (or "read later") apps
&lt;/h1&gt;

&lt;p&gt;Browsers like Firefox and Opera come with a built-in reading mode. You can even turn on Chrome's experimental reading list feature (go to chrome://flags and search "reading list"). But for ease of use, I like to use &lt;a href="https://getpocket.com" rel="noopener noreferrer"&gt;Pocket&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Pocket looks a little like this:&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%2Fuploads%2Farticles%2Fgy0gu7tlqakrgkgsh8x6.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%2Fuploads%2Farticles%2Fgy0gu7tlqakrgkgsh8x6.PNG" alt="Pocket (desktop)"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F43qitwmdhpvye7rhsfpm.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%2Fuploads%2Farticles%2F43qitwmdhpvye7rhsfpm.png" alt="Pocket (mobile)"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Pocket is a really handy application for easily saving website content to read later. The reading view simplifies content, allowing you to focus on text and images. It's like reading an eBook on a Kindle.&lt;/p&gt;

&lt;p&gt;A popular alternative to Pocket is &lt;a href="https://www.instapaper.com" rel="noopener noreferrer"&gt;Instapaper&lt;/a&gt;, although I haven't had the pleasure of trying it out yet. I'm sure there are plenty others too.&lt;/p&gt;

&lt;p&gt;RSS feeder apps do generally come with their own reading mode features, but they don't always work perfectly. In any case, I find it helpful to separate out a few articles I actually want to read into my reading app, and let my RSS feed app just deal with offering new content to me.&lt;/p&gt;

&lt;h1&gt;
  
  
  Keep it simple
&lt;/h1&gt;

&lt;p&gt;On that point, and going back to RSS, I would advise against following too many feeds to start with. &lt;/p&gt;

&lt;p&gt;It may be tempting to click "follow" on as many feeds as possible. I did that at first, but this was instantly overwhelming and unhelpful. So many unread articles!&lt;/p&gt;

&lt;p&gt;Instead, be selective. Think YAGNI ("You Aren't Gonna Need It"). Or perhaps YARNI ("You Aren't Gonna Read It").&lt;/p&gt;

&lt;p&gt;I suggest following a few feeds you're genuinely interested in following, and building up gradually.&lt;/p&gt;

&lt;p&gt;Similarly, don't add every single article you see to Pocket. Find some you're actually going to read, then make sure you read them before adding too many more. Remember: "the road to hell is paved with good intentions".&lt;/p&gt;

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

&lt;p&gt;RSS feed apps are a useful tool for any developer. They're not the be all and end all, and you will likely want to utilise Twitter (bleugh!) if you're serious about staying up-to-date with all the goings-on in the tech world. But using these tools can certainly help automate your knowledge-absorbing process.&lt;/p&gt;

&lt;p&gt;Do you use an RSS reader or a reading app? What are your favourite apps to use, and why? Are there any other methods of learning and keeping up-to-date that you find helpful? Comment below!&lt;/p&gt;

&lt;p&gt;Disclaimer: I am in no way affiliated with any of the apps mentioned in this article, they're just a few I've been trying out or have heard of.&lt;/p&gt;

&lt;p&gt;Also: this is my first proper blog post! Any constructive feedback is much appreciated.&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>learning</category>
      <category>rss</category>
      <category>reading</category>
    </item>
    <item>
      <title>Dependency cycle detected in React component index file</title>
      <dc:creator>Dan V</dc:creator>
      <pubDate>Sat, 08 Feb 2020 12:56:33 +0000</pubDate>
      <link>https://dev.to/dan_v/dependency-cycle-detected-in-react-component-index-file-8o8</link>
      <guid>https://dev.to/dan_v/dependency-cycle-detected-in-react-component-index-file-8o8</guid>
      <description>&lt;p&gt;Hi all. Wondering whether someone could help me understand and resolve a dependency cycle in my React project.&lt;/p&gt;

&lt;p&gt;I decided to use an index.js file to handle my component exports. The file structure of my components folder looks ike this:&lt;/p&gt;

&lt;p&gt;components&lt;br&gt;
├── ComponentA&lt;br&gt;
│   └── ComponentA.jsx&lt;br&gt;
├── ComponentB&lt;br&gt;
│   └── ComponentB.jsx&lt;br&gt;
└── index.js&lt;/p&gt;

&lt;p&gt;Here are the files involved in the dependency cycle:&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="c1"&gt;// index.js&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;ComponentA&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./ComponentA/ComponentA&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// &amp;lt;-- Eslint: 'Dependency cycle detected.eslint(import/no-cycle)'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;ComponentB&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./ComponentB/ComponentB&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;ComponentA&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;ComponentB&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;

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

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// ComponentA.jsx&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;ComponentB&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;../index&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// ... rest of component ...&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;ComponentA&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;In 'index.js', eslint is detecting a dependency cycle for ComponentA. I've tried to work out why this is and how to fix it but no luck so far. I know it must be something to do with ComponentA importing ComponentB, and then them both being imported and exported in index.js.&lt;/p&gt;

&lt;p&gt;The app still runs fine but I don't want to ignore this linting issue. I would be really grateful for any help in understanding and fixing this.&lt;/p&gt;

&lt;p&gt;Thanks in advance&lt;/p&gt;

&lt;p&gt;Daniel&lt;/p&gt;

</description>
      <category>help</category>
      <category>react</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Which CSS framework (if any) for my portfolio website?</title>
      <dc:creator>Dan V</dc:creator>
      <pubDate>Sat, 01 Feb 2020 19:50:45 +0000</pubDate>
      <link>https://dev.to/dan_v/which-css-framework-if-any-for-my-portfolio-website-1ehh</link>
      <guid>https://dev.to/dan_v/which-css-framework-if-any-for-my-portfolio-website-1ehh</guid>
      <description>&lt;p&gt;Hi all. First time posting on DEV so I hope I'm posting in the right place for this sort of question.&lt;/p&gt;

&lt;p&gt;A little background about myself: I'm a junior dev, currently with 1 year of industry experience. In terms of frontend experience, I have worked with React, Vue.js, Bootstrap, Material-UI and CSS flexbox (not Grid yet).&lt;/p&gt;

&lt;p&gt;I'm looking for a new job currently and have decided to make myself a portfolio website.&lt;/p&gt;

&lt;p&gt;I'm building my website in React, because I don't get to use it at work and want to brush up on my skills (I did a lot of React at bootcamp but we use Vue.js where I work).&lt;/p&gt;

&lt;p&gt;In terms of styling my website, I decided to use Material UI. I came to this decision for two reasons: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;I already use Bootstrap a tonne at work and wanted to work on a different skill.&lt;/li&gt;
&lt;li&gt;MUI is a bit more flashy than Bootstrap, which serves well for what is essentially a promotional website.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;However, I'm not sure about my choice of CSS framework. I'm starting to worry that MUI will be too restrictive; that my site will look like a generic product website.&lt;/p&gt;

&lt;p&gt;Ultimately, I want to build a website that: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;looks good, with a personal touch&lt;/li&gt;
&lt;li&gt;shows off some technical skills&lt;/li&gt;
&lt;li&gt;won't take too long to build&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Does anybody have any advice on what route I should go down? &lt;/p&gt;

&lt;p&gt;Should I carry on with MUI so I can show employers that I know more than just Bootstrap? &lt;/p&gt;

&lt;p&gt;Should I try using pure CSS to show that I understand CSS and help my site look more personal?&lt;/p&gt;

&lt;p&gt;Maybe I should stick with Bootstrap for speed, with the addition that it's very 'plain' and it's styles can be overwritten easily?&lt;/p&gt;

&lt;p&gt;Or should I do something completely different?&lt;/p&gt;

&lt;p&gt;Thanks. And apologies if this was a bit long-winded!&lt;/p&gt;

</description>
      <category>help</category>
    </item>
  </channel>
</rss>
