<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Gatsby Starter Blog RSS Feed]]></title><description><![CDATA[A blog mostly about software craft and a little about other things.]]></description><link>https://www.jdsandifer.com/blog</link><generator>GatsbyJS</generator><lastBuildDate>Wed, 21 Feb 2024 21:40:35 GMT</lastBuildDate><item><title><![CDATA[How to Be a Great PR Reviewer]]></title><description><![CDATA[The other day, one of my teammates asked me for advice about how to get better
at doing PR reviews. Here are some of the ideas I came up…]]></description><link>https://www.jdsandifer.com/blog/how-to-be-a-great-pr-reviewer</link><guid isPermaLink="false">https://www.jdsandifer.com/blog/how-to-be-a-great-pr-reviewer</guid><pubDate>Fri, 02 Feb 2024 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;The other day, one of my teammates asked me for advice about how to get better
at doing PR reviews. Here are some of the ideas I came up with:&lt;/p&gt;
&lt;h2&gt;Read Code and Learn What Good Code Looks Like&lt;/h2&gt;
&lt;p&gt;To start with, it&apos;s important to understand the purpose of code:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;To define a process so people can understand it.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;That&apos;s right, code is not for computers, it&apos;s for people. The computers will&lt;br&gt;
run assembly code that&apos;s very difficult for humans to read; we&apos;ve developed
programming languages on top of that hard-to-read code to make it easier for us
to understand and discuss with others.&lt;/p&gt;
&lt;p&gt;The code has to work, yes, but it&apos;s main goal after that is &lt;strong&gt;to be readable&lt;/strong&gt;!&lt;/p&gt;
&lt;p&gt;Here are a few things I expect from readable code:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;It&apos;s not too complex or surprising. It follows existing patterns.&lt;/li&gt;
&lt;li&gt;It&apos;s not too short or too long. It&apos;s concise.&lt;/li&gt;
&lt;li&gt;There&apos;s a decent chance a non-programmer could figure out what it&apos;s doing. It&apos;s
written in &quot;human&quot; as much as possible, not full of programmer jargon.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Reading good code can help you understand what that looks like and how to
suggest changes that will improve other people&apos;s code.&lt;/p&gt;
&lt;p&gt;But where do you find good code?&lt;/p&gt;
&lt;p&gt;Thankfully, other people have had the same question and answered it for us. Here
are a couple codebases that have some pretty good code:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/alan2207/bulletproof-react&quot;&gt;Bulletproof React&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/bbc/simorgh&quot;&gt;Simorgh&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;And one person that created their own list: &lt;a href=&quot;https://maxrozen.com/examples-of-large-production-grade-open-source-react-apps&quot;&gt;Max Rozen&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;To start with - I recommend checking out JSX files (.jsx or .tsx) in a components
directory if you can find it - it&apos;s often something like &lt;code class=&quot;language-text&quot;&gt;src/app/components/&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;And here&apos;s a repo with suggestions about how to write good code: &lt;a href=&quot;https://github.com/ryanmcdermott/clean-code-javascript&quot;&gt;clean-code-javascript&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;So read code. A lot. Stop and figure out what something confusing is about. Go to
some code that you don&apos;t know is good - see if you can tell whether it is or not.
And of course, see if you can make your next PR a little more readable, too!&lt;/p&gt;
&lt;p&gt;As one final note, don&apos;t forget that there&apos;s a difference between good code and
style. There are many different ways to format and organize code - 2 spaces vs.
4 spaces vs. tabs for indentation, etc. Use the style guide for your
organization or try to get your team to agree on one from somewhere else and use
that. But style is just how the code is formatted. Good code can be created in
any style.&lt;/p&gt;
&lt;h2&gt;Find Good Mentors and Teachers&lt;/h2&gt;
&lt;p&gt;There are a lot of software developers of all levels writing blog posts, making
videos, and recording podcasts about software. They&apos;ll all tell you what they
think is the best way and what they think you should know, but how to tell who
&lt;em&gt;really&lt;/em&gt; knows?&lt;/p&gt;
&lt;p&gt;One good way to tell: &lt;strong&gt;Do they talk about tradeoffs?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Software engineering has a lot of tradeoffs:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;How good can we make the next feature vs. how fast can we get it to the users&lt;/li&gt;
&lt;li&gt;Using the first variable name that comes to mind vs. taking the time to
brainstorm&lt;/li&gt;
&lt;li&gt;Picking a library you know vs. taking more time to research possible
alternatives you&apos;d have to learn how to use, but might work better&lt;/li&gt;
&lt;li&gt;Discussing coding styles with your team so there&apos;s a consisent, readable style
vs. using that time to get more code written, even if it&apos;s harder to read&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Different teams, projects, and technologies may cause one side of the tradeoff
to become more important so many of these don&apos;t have one right answer - it&apos;s all
about finding a good balance for your project and organization.&lt;/p&gt;
&lt;p&gt;Let&apos;s look at some quick examples. Here&apos;s a more basic, surface-level
suggestion:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Make sure your code is &lt;a href=&quot;https://en.wikipedia.org/wiki/Don%27t_repeat_yourself&quot;&gt;DRY&lt;/a&gt;. If you&apos;re writing similar code in
multiple places, create a function to do it in one place and call the
function. This makes it so -you only have to edit one place if you need to
change that code.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;That&apos;s a great suggestion! It&apos;s definitely a skill you should develop and know
when to implement.&lt;/p&gt;
&lt;p&gt;But check out a more advanced suggestion:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Definitely think about making your code DRY, but don&apos;t rush into it. Before
you create a function to replace code in multiple places, ask yourself: &quot;Will
these areas change for the same reason?&quot; If I need to edit it in one place,
will the others &lt;em&gt;definitely&lt;/em&gt; need to change, too. If you&apos;re not sure, wait.&lt;/p&gt;
&lt;p&gt;If the code isn&apos;t perfectly DRY, that&apos;s okay. Better a little &quot;wet&quot; code than
too much coupling that makes the code difficult to change later.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Side note: For more info about the tradeoff&apos;s with DRY code, check out a different
acronym: &lt;a href=&quot;https://kentcdodds.com/blog/aha-programming&quot;&gt;AHA (Avoid
Hasty Abstractions)&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;Improve Your Communication Skills&lt;/h2&gt;
&lt;p&gt;This is good advice for just about everyone everywhere. But in the context of PR
reviews, I&apos;m thinking about 2 specific goals:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Be consistently respectful (even if you have to be firm)&lt;/li&gt;
&lt;li&gt;Be able to clearly share your point of view (even if you don&apos;t end up convincing
them of your idea)&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;Be Respectful (in every comment)&lt;/h3&gt;
&lt;p&gt;Here are some of my rules to keep my comments and communication respectful:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Write things out: Don&apos;t leave off words to save time - it sounds terse, short,
and potentially rude.&lt;/li&gt;
&lt;li&gt;Always talk about how &quot;we&quot; can do things to make &quot;our&quot; code better: If you&apos;re
doing reviews, you&apos;re on some kind of team so keep that in your words, too.
Besides, after a few suggestions from PR reviewers, it&apos;s no longer just code
written by the PR author - it&apos;s code written by all of you!&lt;/li&gt;
&lt;li&gt;Write like you know you could be wrong: Use questions and phrases like &quot;it
seems like&quot; and &quot;I think&quot; before comments like &quot;this is no longer needed&quot;.
(It&apos;s a lot easier when you do make a mistake, but it&apos;s also easier for the reader
to take the feedback and really consider it.)&lt;/li&gt;
&lt;li&gt;Try to encourage discussion: Instead of just making a suggestion, consider
opening up with a couple ideas and ask for additional ideas from the PR
author. Even if you already have an idea, you never know what you might come
up with together!&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Examples:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Can we remove this function? It looks like it&apos;s no longer needed.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Note the &quot;we&quot; and the question. Also &quot;it looks like&quot; - assuming you could be
wrong.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;How about we change this name from BookList to BookCollection?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;It&apos;s a question and it&apos;s using &quot;we&quot;.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;What do you think about trying to refactor this using a more general
component?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Attempting to start a discussion about possibilities instead of making a
specific suggestion - a great way to leverage your team.&lt;/p&gt;
&lt;h3&gt;Be Clear&lt;/h3&gt;
&lt;p&gt;Learning how to clearly communicate your thoughts takes time, but you can help
speed up the process with some deliberate steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Take notes of good exchanges where it&apos;s clear your comments were understood
right away by the reader. How did you make your ideas clear?&lt;/li&gt;
&lt;li&gt;Take notes of lengthy exchanges where you had to re-state your ideas multiple
times - how did you say things when they were finally understood? How was that
different from the first comment you made?&lt;/li&gt;
&lt;li&gt;Revise your comments to try and make them shorter without losing meaning or
leaving out anything. Can you say the same thing with 75% of the words? Half?
20%?&lt;/li&gt;
&lt;li&gt;Ask for feedback every once in a while! E.g. &quot;I noticed it took a while for us to reach an
agreement in that discussion. Could I have done anything to make that
easier?&quot;&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;Learn to Think About Risks, Value, and The Big Picture&lt;/h2&gt;
&lt;h3&gt;Risks&lt;/h3&gt;
&lt;p&gt;This is both a simple concept and a difficult one to measure well. Risks are
what could go wrong. If a variable name isn&apos;t perfect, the code will still work,
but it may be harder for other developers to read and understand. However if a
date isn&apos;t converted properly, that could lead to a significant bug. One clearly
matters more than the other because the risk is bigger.&lt;/p&gt;
&lt;p&gt;Spend more time reading, thinking about, commenting on, and discussing riskier
parts of the PR.&lt;/p&gt;
&lt;p&gt;Don&apos;t be afraid to leave off comments about refactoring, names, or small changes
to avoid distracting too much from risky areas that definitely need a change or a small
discussion to make sure things are handled the right way.&lt;/p&gt;
&lt;h3&gt;Value&lt;/h3&gt;
&lt;p&gt;Finding bugs is the best. Suggesting refactorings that can make the code easier
to read or edit is super helpful. However the 20th name change is not as
important. And making too many suggestions about old code that wasn&apos;t changed
quickly becomes annoying.&lt;/p&gt;
&lt;p&gt;Try to consider how much your suggestion will impact the users of your software,
the amount of money your company makes (if applicable), and how much your team
will appreciate the change. Then decide whether it&apos;s worth the time it&apos;ll take
to make it.&lt;/p&gt;
&lt;p&gt;And if your Project Manager would love how it helped them meet the estimate they
shared with upper management - by avoiding a bug that would have delayed work or
ensuring something matched the specification so it would pass final testing -
that&apos;s always a high value!&lt;/p&gt;
&lt;h3&gt;The Big Picture&lt;/h3&gt;
&lt;p&gt;Always take a moment to &quot;step back&quot; and think about the bigger ideas. Does the
code do what it&apos;s supposed to? Does the overall structure of the files and code
make sense? How long are you spending on the review?&lt;/p&gt;
&lt;p&gt;Make sure you don&apos;t get stuck suggesting name changes and how to remove nested
ternaries and then forget to check the overall functionality or structure. Not
every possible improvement needs to be made on this PR.&lt;/p&gt;
&lt;p&gt;Also, consider the number of commments - if you&apos;ve got 50 comments on a small to
medium size PR, that&apos;s probably too many. Keep the most important ones and see
if you can delete a few without significant risks or loss of value.&lt;/p&gt;
&lt;h2&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;It takes many different skills to review PR&apos;s well. I think that working on
recognizing readable code, finding good teachers, improving your communication,
and remembering the big picture are good areas to focus on to increase your
effectiveness with PR reviews.&lt;/p&gt;
&lt;p&gt;I hope that&apos;s helpful and good luck with your reviews!&lt;/p&gt;</content:encoded></item><item><title><![CDATA[React in Detail: Elements, Components, and HOCs]]></title><description><![CDATA[At Metal Toad, I’m part of a team of developers who often work on code together. Whether it’s pairing with one other person or mobbing as a…]]></description><link>https://www.jdsandifer.com/blog/react-in-detail-elements-components-and-ho-cs</link><guid isPermaLink="false">https://www.jdsandifer.com/blog/react-in-detail-elements-components-and-ho-cs</guid><pubDate>Fri, 11 Oct 2019 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;At Metal Toad, I’m part of a team of developers who often work on code together. Whether it’s pairing with one other person or mobbing as a larger group, teamwork is an important way we help each other and provide the best value to our customers.&lt;/p&gt;
&lt;p&gt;And teamwork requires communication. The better the communication, the more effectively ideas can be shared and topics discussed. And while there are lots of resources out there for general advice about how to communicate well, and we have dictionaries and thesauruses when we need to figure out what words mean, industry-specific language can be more challenging.&lt;/p&gt;
&lt;p&gt;Whether you call it jargon, lingo, or something else, some words only make sense in the context of a specific industry. In the case of software development, sometimes a specific programming language, library, or tool even has its own terms. And you won’t find them in most dictionaries.&lt;/p&gt;
&lt;p&gt;Because they’re so specific to particular fields and are often taught verbally to new people as they’re learning the ropes, it’s much easier for there to be misunderstandings around some of these words. Today, I’d like to talk about a few of those words in the context of React.&lt;/p&gt;
&lt;h2&gt;What is React?&lt;/h2&gt;
&lt;p&gt;If you aren’t already familiar with it, React’s purpose is to speed up the display of the user interface for web apps. It’s a JavaScript library that acts as an intermediary between business logic and the browser. As a developer, I tell React what I want to appear on the screen and it works its magic to make sure those things appear quickly and update efficiently as the user interacts with them.&lt;/p&gt;
&lt;p&gt;A responsive and snappy user interface is an important part of any application so it’s easy to see why we use React at Metal Toad - because we care about the experience of our users and are dedicated to using the latest tools to give them the best experience possible.&lt;/p&gt;
&lt;p&gt;Now that you have some context for why we use React, let&apos;s look at the smallest parts of a React app:&lt;/p&gt;
&lt;h2&gt;Elements&lt;/h2&gt;
&lt;p&gt;React elements are the building blocks of React. They are objects used to create a representation of each part of what should be displayed on the screen - each &lt;em&gt;element&lt;/em&gt;, you might say.&lt;/p&gt;
&lt;p&gt;So what does an element look like in code? It looks like this:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;&amp;lt;div /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Or, if you&apos;re working on a project that doesn&apos;t use JSX, then it would look like this:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;React.createElement(&apos;div&apos;)&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;(JSX compiles to regular JavaScript functions - see how it works with &lt;a href=&quot;https://babeljs.io/repl#?babili=false&amp;#x26;browsers=&amp;#x26;build=&amp;#x26;builtIns=false&amp;#x26;spec=false&amp;#x26;loose=false&amp;#x26;code_lz=DwEwlgbgBA9AfEA&amp;#x26;debug=false&amp;#x26;forceAllTransforms=false&amp;#x26;shippedProposals=false&amp;#x26;circleciRepo=&amp;#x26;evaluate=false&amp;#x26;fileSize=false&amp;#x26;timeTravel=false&amp;#x26;sourceType=module&amp;#x26;lineWrap=true&amp;#x26;presets=react&amp;#x26;prettier=false&amp;#x26;targets=&amp;#x26;version=7.6.0&amp;#x26;externalPlugins=&quot;&gt;Babel’s interactive compiler&lt;/a&gt;.)&lt;/p&gt;
&lt;p&gt;That function call creates a JavaScript object which includes all of the information React needs
to display that piece of the user interface and control it. You might recognize this element as the humble &lt;code class=&quot;language-text&quot;&gt;&amp;lt;div&gt;&lt;/code&gt; tag from HTML. In fact, that is the code to create that tag in React. Of course, the fun really starts when we combine multiple elements. Let&apos;s look at a larger element:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;&amp;lt;div&gt;
  &amp;lt;h1&gt;React Stuff You Need to Know&amp;lt;/h1&gt;
  &amp;lt;p&gt;Here is some stuff about React…&amp;lt;/p&gt;
&amp;lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;As you can see, there are 3 elements here: &lt;code class=&quot;language-text&quot;&gt;&amp;lt;div&gt;&lt;/code&gt;, &lt;code class=&quot;language-text&quot;&gt;&amp;lt;h1&gt;&lt;/code&gt;, and &lt;code class=&quot;language-text&quot;&gt;&amp;lt;p&gt;&lt;/code&gt;. However, this code still only returns one element. Why? Looking at the non-JSX version will be helpful here:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;React.createElement(&apos;div&apos;, null,
  React.createElement(&apos;h1&apos;, null, &apos;React Stuff You Need to Know&apos;),
  React.createElement(&apos;p&apos;, null, &apos;Here is some stuff about React…&apos;)
)&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The three elements are definitely created, but the two child elements become a part of the parent element. The parent element function call takes the function calls for the children as two of its parameters so the end result is one return from the parent function call.&lt;/p&gt;
&lt;p&gt;So far we&apos;ve been just using standard HTML tags as React elements. Let&apos;s switch now and look at how you can create your own elements:&lt;/p&gt;
&lt;h2&gt;Components&lt;/h2&gt;
&lt;p&gt;In React, a component is a function that returns a React element. Let&apos;s take a look at one:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;const ReallyCoolComponent = () =&gt; (&amp;lt;div /&gt;)&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Here are a few other ways of creating the same function using different JavaScript syntax:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;function ReallyCoolComponent() {
  return &amp;lt;div /&gt;
}

const ReallyCoolComponent = () =&gt; React.createElement(&apos;div&apos;)

function ReallyCoolComponent() {
  return React.createElement(&apos;div&apos;)
}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Now this is a pretty basic component - and frankly, not super useful - but it illustrates all of the requirements for a React component:
It&apos;s a function
It returns a React element&lt;/p&gt;
&lt;p&gt;That&apos;s it! If it has those two properties, it&apos;s a React component.&lt;/p&gt;
&lt;p&gt;If you&apos;ve used React some, you might have some objections to this simplistic definition:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Q: What about Class components?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;A: Yes, you can use the class syntax to define a React component and it is different than simply defining it using a function, but ultimately &lt;em&gt;it is still a function&lt;/em&gt;. Don&apos;t believe me? Try it yourself in &lt;a href=&quot;https://repl.it/repls/AlertExternalContent&quot;&gt;a Repl&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Of course, this doesn’t mean that a functional component and a class component are the same. It just means they both fit the description of being a function.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Q: Doesn&apos;t React accept other things besides React elements in the return of a component?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;A: Yep, you&apos;ve got me there. Strings, numbers, booleans, and null are also allowed. The first two are turned into React elements automagically and the other two are ignored (but valid). For simplicity, I&apos;m including all of these things under the umbrella of React elements because React treats them all like elements (or the lack thereof).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Q: What about props?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;A: Good question! Although props are almost always used in a component, they&apos;re not actually required. If they are used, though, they add two additional rules:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The only parameter a React Component accepts is one object called &apos;props&apos;.&lt;/li&gt;
&lt;li&gt;The component must act like a pure function with regard to it&apos;s props.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Let&apos;s look at a component that accepts props:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;const ApplePicker = (props) =&gt; {
  return (
    &amp;lt;div&gt;
      &amp;lt;p&gt;{`I picked ${props.picked} apples today!`}&amp;lt;/p&gt;
      &amp;lt;p&gt;{`I should pick ${props.totalNeeded - props.picked} more…`}&amp;lt;/p&gt;
    &amp;lt;/div&gt;
  )
}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You can see that it accepts a single parameter object. In this case, it expects that object to have two properties called &lt;code class=&quot;language-text&quot;&gt;picked&lt;/code&gt; and &lt;code class=&quot;language-text&quot;&gt;totalNeeded&lt;/code&gt;. It can then use those properties to display data and, in this case, calculate how many more apples should be picked.&lt;/p&gt;
&lt;p&gt;Importantly, the component doesn&apos;t change its props or take in additional parameters. That&apos;s what it means to act like a pure function with regard to it&apos;s props (our last rule).&lt;/p&gt;
&lt;p&gt;Here’s the complete list of rules for a React component:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;It must be a function. (Classes are functions.)&lt;/li&gt;
&lt;li&gt;It must return a valid React element (including string, number, boolean, or null).&lt;/li&gt;
&lt;li&gt;If it accepts parameters, it should accept one parameter object called &lt;code class=&quot;language-text&quot;&gt;props&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;It must act like a pure function with regard to its props.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Now that we have a pretty good handle on elements and components, let&apos;s take a look at the next step up from there:&lt;/p&gt;
&lt;h2&gt;Higher-Order Components&lt;/h2&gt;
&lt;p&gt;What’s a higher-order component? Just like a component is a function that returns a React element, a higher-order component (HOC) is a function that returns a React component. Let&apos;s jump straight in with an example:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;const withData = (data, AComponent) =&gt; {
  return (props) =&gt; (&amp;lt;AComponent {...props} data={data} /&gt;)
}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;And for clarity, here it is without the JSX:&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;function withData(data, AComponent) {
  return function(props) {
    return React.createElement(AComponent, {...props, data})
  }
}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This is definitely a function, but is it an HOC? Let&apos;s do a quick check to see if what it returns is a React component using our four rules for React components:
Is it a function? Yep!
Does it return a React element? Yep. (Note: &lt;code class=&quot;language-text&quot;&gt;AComponent&lt;/code&gt; is a React component, but &lt;code class=&quot;language-text&quot;&gt;&amp;lt;AComponent … /&gt;&lt;/code&gt; is a React element.)
If it accepts parameters, is it one parameter called &lt;code class=&quot;language-text&quot;&gt;props&lt;/code&gt;? Yep.
Does it act like a pure function with regard to its props? It does indeed.&lt;/p&gt;
&lt;p&gt;Success! Since this function returns a component, it’s a higher order component. As you can see, it appears to be adding data to the props of &lt;code class=&quot;language-text&quot;&gt;AComponent&lt;/code&gt;. This is one of the common ways HOC’s are used.&lt;/p&gt;
&lt;h2&gt;Don’t Forget Context&lt;/h2&gt;
&lt;p&gt;If you’re like me, you might already have realized that you’ve used one of these words incorrectly in a discussion about React. Especially when it comes to elements and components, the words are also used in more general ways so it’s easy to confuse them. That’s why it’s important to clarify the context for how you’re using these words. Usually, simply adding ‘React’ in front of ‘element’ or ‘component’ can help everyone follow you.&lt;/p&gt;
&lt;p&gt;I also found that, when I tried to explain higher order components to a coworker, I couldn’t clearly articulate what I knew. That made it so even though we took the time to try to close a communication gap, we couldn’t quite do it on the spot. (It also led me to do the research that ultimately led to this blog post.)&lt;/p&gt;
&lt;p&gt;Hopefully, this article has helped you to solidify your understanding of these concepts so you can use them confidently and help clear up any miscommunications that may happen to you and your team. Thanks for reading!&lt;/p&gt;
&lt;h2&gt;Other Resources&lt;/h2&gt;
&lt;p&gt;To continue reading about this subject, I recommend checking out these other great articles:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The React introduction pages for &lt;a href=&quot;https://reactjs.org/docs/rendering-elements.html&quot;&gt;Elements&lt;/a&gt; and &lt;a href=&quot;https://reactjs.org/docs/components-and-props.html&quot;&gt;Components&lt;/a&gt; (in that order)&lt;/li&gt;
&lt;li&gt;Dan Abramov&apos;s article about &lt;a href=&quot;https://medium.com/@dan_abramov/react-components-elements-and-instances-90800811f8ca&quot;&gt;React Components, Elements, and Instances&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content:encoded></item><item><title><![CDATA[My Programming Journey]]></title><description><![CDATA[My First Programming Language At some point after I learned to read, but before middle school, I took an interest in computers and used my…]]></description><link>https://www.jdsandifer.com/blog/my-programming-journey</link><guid isPermaLink="false">https://www.jdsandifer.com/blog/my-programming-journey</guid><pubDate>Fri, 13 Sep 2019 00:00:00 GMT</pubDate><content:encoded>&lt;h2&gt;My First Programming Language&lt;/h2&gt;
&lt;p&gt;At some point after I learned to read, but before middle school, I took an interest in computers and used my dad&apos;s IBM PC - &lt;a href=&quot;https://unsplash.com/photos/Zd6PL6PSW5E&quot;&gt;this one&lt;/a&gt; - to learn BASIC, a programming language designed to be simple. It had a good name, right?&lt;/p&gt;
&lt;p&gt;I started trying things out on my own but soon teamed up with my best friend from across the street. We made simple computer programs in BASIC and then C++ and eventually in Java - the newest language at the time.&lt;/p&gt;
&lt;p&gt;Through that early experimentation, I learned the ins and outs of logical procedures, debugging code with cryptic errors, and how to communicate ideas about how a program should function and how it could look.&lt;/p&gt;
&lt;h2&gt;My First &quot;Job&quot;&lt;/h2&gt;
&lt;p&gt;In middle school, I had an awesome Geography teacher named Mr. Rogers. He was technologically advanced for a teacher at this time because he regularly used a digital projector and screen to display lesson information at a time when chalkboards were still common and overhead projectors were the only similar technology in everyday use in the classroom.&lt;/p&gt;
&lt;p&gt;He also regularly gave tests via computer. On test days, we would all go over to the computer lab and use the PC&apos;s with Windows 3.0 to demonstrate our knowledge about countries in various time periods - their names, locations, and major events associated with them.&lt;/p&gt;
&lt;p&gt;So it&apos;s not surprising to me that Mr. Rogers also allowed students to turn in some assignments in the form of web pages. Looking back at this, I realize what a brilliant educational incentive that was, but at the time I simply thought that it was a cool way to type up my report and not have to print it out or hand it in. No “the dog ate my homework” issues for me!&lt;/p&gt;
&lt;p&gt;It&apos;s because of that report - and the fact that I coded it by hand in HTML rather than use software to create it - that Mr. Rogers invited me to redesign the school&apos;s web page.&lt;/p&gt;
&lt;p&gt;This was around the time that Animated GIFs were still the new hotness so it seemed like every web page had at least one waving flag, animated smiley face, or dancing cartoon character. I simply had to choose a reasonable color scheme and avoid the temptation to insert unnecessary motion graphics and my school&apos;s web page went from looking like a MySpace page to looking professional.&lt;/p&gt;
&lt;p&gt;Speaking of web pages: It was only a few years after that when Google came out. I can still remember doing my first Google search in 1998. Things have come a long way since then, haven’t they?&lt;/p&gt;
&lt;h2&gt;A Proliferation of Technology&lt;/h2&gt;
&lt;p&gt;Today, the number of programming languages used to create software has increased to over 100. The language I use most right now is JavaScript and within that one language, there are over a million libraries and modules to choose from to help build software. Stack Overflow, a site where software developers can answer each other&apos;s programming questions, has grown from its humble beginnings in 2008 to a staggering 10 million plus users in 2019.&lt;/p&gt;
&lt;p&gt;To say the least, there are a dizzying array of options out there when it comes to technology.
npm&lt;/p&gt;
&lt;h2&gt;Making a Choice&lt;/h2&gt;
&lt;p&gt;I got involved in software development specifically because of this kind of problem. A lot of people find the plethora of technological choices to be overwhelming. In addition, even once you&apos;ve made a choice, it can be difficult to figure out how to best use the technology to achieve your goals. This is true whether you’re envisioning a network of systems reaching around the globe or simply installing a new version of Excel!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;My passion is closing that gap: Creating software that&apos;s designed specifically for people to help them achieve their goals.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;And that&apos;s also why I now work for &lt;a href=&quot;https://www.metaltoad.com&quot;&gt;Metal Toad&lt;/a&gt;. As a company offering custom solutions at the leading edge of technology, Metal Toad exists to help customers find technology solutions that allow them to meet their goals. Whether its discussing the best options for a new project in a discovery phase, leading the charge on getting a new system up and running so it starts out in the best possible way, or planning and executing a successful technology upgrade, Metal Toad takes care of solving technology problems so they can focus on how to solve the problems of their customers.&lt;/p&gt;
&lt;p&gt;With the every-increasing amount of technology out there, it just makes sense to work with a company that makes being familiar with technology it&apos;s business. I&apos;m glad that I get to be a part of that.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[How I Deployed My Web Site]]></title><description><![CDATA[As promised, here is Part 2 of re-designing my web site. Check out Part 1 if you missed it. Netlify I like to meet up with other developers…]]></description><link>https://www.jdsandifer.com/blog/how-i-deployed-my-web-site</link><guid isPermaLink="false">https://www.jdsandifer.com/blog/how-i-deployed-my-web-site</guid><pubDate>Thu, 27 Sep 2018 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;As promised, here is Part 2 of re-designing my web site. Check out Part 1 if you missed it.&lt;/p&gt;
&lt;h2&gt;Netlify&lt;/h2&gt;
&lt;p&gt;I like to meet up with other developers outside my work from time to time to learn as much as I can about software, the industry, and new technologies. It&apos;s also fun swapping stories.&lt;/p&gt;
&lt;p&gt;During one such conversation, I mentioned that I was looking for an easy way to host my website. It had to be free and ideally it supported some kind of continuous deployment.&lt;/p&gt;
&lt;p&gt;His suggestion: &lt;strong&gt;Netlify&lt;/strong&gt;. Here are some of the features they offer:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;FREE&lt;/em&gt; (for small sites) - This one is big for me right now. I don&apos;t need much and don&apos;t want to pay much.&lt;/li&gt;
&lt;li&gt;Continuous deployment with GitHub integration&lt;/li&gt;
&lt;li&gt;DNS Servers and Domain Management - My current domain name company doesn&apos;t have a great website. I love being able to just point my domain to Netlify&apos;s servers and manage everything via Netlify.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Pushing From GitHub&lt;/h2&gt;
&lt;p&gt;Even though I didn&apos;t think of this as a requirement for my new hosting solution, I can&apos;t imagine ever going back!
15 seconds from commit to updates live on my web site - this is a game changer for me.
This is sooooo fast compared to how I used to update my website.&lt;/p&gt;
&lt;p&gt;I used to &lt;em&gt;hate&lt;/em&gt; updating my website by uploading new files.
I also would have to test things out before uploading and check quickly after the new files went live to make sure everything was working correctly.
Combine that with the slow process of editing, saving, and checking the results in a browser and I was always putting off updating my website due to the hassle.&lt;/p&gt;
&lt;p&gt;Now I can make quick changes to text or even simple code changes right on GitHub.
Not only do the changes go live seconds after each commit, but there&apos;s also error checking baked into the build process.
If anything goes wrong with the build, no changes make it to the site. This is nice insurance against mistakes making it online.&lt;/p&gt;
&lt;p&gt;One other benefit: Any changes I make to my site are included in my GitHub history.
I don&apos;t know how much stake hiring managers put in those green squares on my GitHub page, but I like the idea that I&apos;m getting credit for all of the coding I&apos;m doing.&lt;/p&gt;
&lt;h2&gt;Web Page Testing&lt;/h2&gt;
&lt;p&gt;An important part of any website project is web page testing. Does your site load quickly, are you caching resources correctly, and is it accessible? Most of this is handled automatically by Gatsby so I don&apos;t have to worry about it, but it&apos;s important to check.&lt;/p&gt;
&lt;p&gt;For all your website testing needs, go to &lt;a href=&quot;https://www.webpagetest.org/&quot;&gt;Web Page Test&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Progressive JPEG Compression&lt;/h2&gt;
&lt;p&gt;One thing that&apos;s not automatically handled by Gatsby is Progressive JPEG Compression.
It&apos;s worth using technological advancements that solve problems and one recent solution in images is &lt;strong&gt;progressive compression&lt;/strong&gt;.
You&apos;ve probably seen pictures online that load as blurry or very simple images, but get sharper or more complex after a few seconds.
The idea is that this enables you to see the layout of the page and an approximation of the final image &lt;em&gt;very&lt;/em&gt; quickly.
Often that&apos;s all that&apos;s needed to give you context for what you&apos;re reading so I highly recommend taking advantage of it.&lt;/p&gt;
&lt;p&gt;Here&apos;s a great &lt;a href=&quot;https://cloudinary.com/blog/progressive_jpegs_and_green_martians&quot;&gt;article about progressive JPEG&apos;s&lt;/a&gt; - it has green martians! (And useful information, too.)&lt;/p&gt;
&lt;p&gt;The solution I chose to make progressive JPEG&apos;s was to install &lt;code class=&quot;language-text&quot;&gt;mozjpeg&lt;/code&gt; using Homebrew (on MacOS).
I wasted a lot of time learning about compiling from source code before I realized a Homebrew install was possible.
I wish I had seen that earlier, but such is life. :-)&lt;/p&gt;
&lt;p&gt;I&apos;m currently running it from the command line by hand, but I plan to explore adding &lt;code class=&quot;language-text&quot;&gt;mozjpeg&lt;/code&gt; into my Gatsby configuration so I can automate the process.&lt;/p&gt;
&lt;h2&gt;I Had Fun&lt;/h2&gt;
&lt;p&gt;Even as I write this blog post, I&apos;m simply editing a file on GitHub.
Sometimes I use my development environment, but other times I just edit right in my repo - it doesn&apos;t publish until I push to the master branch so it&apos;s safe to draft, revise, and tweak on GitHub!
Even after I commit on the master branch, nothing goes live unless everything compiles correctly so I know I&apos;m safe from simple mistakes causing my site to go down.&lt;/p&gt;
&lt;p&gt;In then end, I really like Netlify as a host, but the important thing is that I&apos;m leveraging modern technology to make my life easier.
Continuous deployment is an awesome tool that speeds up my web development and I highly recommend it!&lt;/p&gt;</content:encoded></item><item><title><![CDATA[The Weird Reason My React App Failed on Chrome for iOS]]></title><description><![CDATA[If you haven't checked out my portfolio, you may not know that I pioneered a move to React for a web app I support at work. This app…]]></description><link>https://www.jdsandifer.com/blog/the-weird-reason-my-react-app-failed-on-chrome-for-i-os</link><guid isPermaLink="false">https://www.jdsandifer.com/blog/the-weird-reason-my-react-app-failed-on-chrome-for-i-os</guid><pubDate>Wed, 26 Sep 2018 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;If you haven&apos;t checked out my portfolio, you may not know that I pioneered a move to React for a web app I support at work. This app displays event orders so technicians can deliver the correct gear to events in the building.&lt;/p&gt;
&lt;h2&gt;The App&apos;s Not Working!&lt;/h2&gt;
&lt;p&gt;It&apos;s never fun to find out that the app you&apos;ve been slaving away at for days and you thought had just been successfully released doesn&apos;t work on a user&apos;s device. It&apos;s hard to test every single device so I doubt this is uncommon, but at work we have a direct connection to our users and can specify which browser they use to access our app so it was surprising to have this happen.&lt;/p&gt;
&lt;p&gt;Anyway, the issue was that the main page that displays events wasn&apos;t displaying anything at all. It seemed to only be affecting users connecting on iOS devices so that&apos;s what we had to go on.&lt;/p&gt;
&lt;h2&gt;Troubleshooting Begins&lt;/h2&gt;
&lt;p&gt;One of my strengths in software development is isolating a problem to help solve it quickly. My process involved some straightforward questions and digging to verify the answers:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Is the HTML page loading ok? (Looks like it.)&lt;/li&gt;
&lt;li&gt;Is the React container showing up? (Yep.)&lt;/li&gt;
&lt;li&gt;Is the React app rendering? (No...)
&lt;ol&gt;
&lt;li&gt;Because of React itself? (No. It&apos;s loading fine.)&lt;/li&gt;
&lt;li&gt;Or React-DOM? (No, it&apos;s also working. Simple substitution testing shows that React renders a simple element fine.)&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;So everything&apos;s working, but the elements aren&apos;t showing up? (Yep...)&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;From there, I dove into the code that controls which elements show up and where. The primary issue became apparent - events weren&apos;t showing up because their dates weren&apos;t getting figured out correctly. They were correctly filtered, but the dates themselves were bad somehow.&lt;/p&gt;
&lt;h2&gt;Documentation&lt;/h2&gt;
&lt;p&gt;As I&apos;ve grown as a devloper, I&apos;ve come to love good documentation. &lt;a href=&quot;https://developer.mozilla.org&quot;&gt;MDN&lt;/a&gt; is an awesome reference for all things JavaScript, HTML, and CSS so that&apos;s where I turn for solutions (after a quick Google search to scan &lt;a href=&quot;https://stackoverflow.com/&quot;&gt;Stack Overflow&lt;/a&gt; - no need to solve a problem someone else has already solved).&lt;/p&gt;
&lt;p&gt;Here&apos;s a sample of the type of code I was trying to verify: &lt;code class=&quot;language-text&quot;&gt;const eventDate = new Date(&quot;2018-09-26&quot;)&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Sure enough, the docs confirmed that the &lt;a href=&quot;https://en.wikipedia.org/wiki/ISO_8601&quot;&gt;ISO 8601&lt;/a&gt; date format is an accepted parameter for creating a new date.&lt;/p&gt;
&lt;p&gt;Just for kicks, I tried &lt;code class=&quot;language-text&quot;&gt;const eventDate = new Date(2018, 8, 26)&lt;/code&gt;, using an older style initialization.&lt;/p&gt;
&lt;h2&gt;Voila! It Works! But Why?&lt;/h2&gt;
&lt;p&gt;Changing the date initialization format caused everything to work correctly again. That was great, but I wasn&apos;t satisfied.&lt;/p&gt;
&lt;p&gt;I love it when things work, but I also hate not knowing why they worked. What if something changes and the &quot;same&quot; solution fails next time because I didn&apos;t truly understand the underlying mechanism? Sometimes time is of the essence and moving forward is too important to linger, but most of the time I don&apos;t think I&apos;m doing my job right unless I &lt;em&gt;know&lt;/em&gt; why a bug fix works and how to prevent the same issue again next time.&lt;/p&gt;
&lt;p&gt;To get to the bottom of the issue, I consulted some of my favorite tools for checking on specific compatibility issues: MDN&apos;s chart at the bottom of each page, &lt;a href=&quot;https://www.caniuse.com&quot;&gt;Can I use&lt;/a&gt;, and if those don&apos;t work - Stack Overflow again.&lt;/p&gt;
&lt;p&gt;It took me a while, but I eventually found this gem: &lt;a href=&quot;https://stackoverflow.com/questions/11259152/chrome-ios-is-it-just-a-uiwebview&quot;&gt;Chrome iOS - Is it just a UIWebView?&lt;/a&gt;. It turns out that Apple requires all apps on the App Store to use their renderer for showing web contect (the same as Mobile Safari uses). Essentially, supporting Chrome actually means supporting Safari on iOS, too. Any client-side rendering of JavaScript is handled by the same engine - no matter what browser you use.&lt;/p&gt;
&lt;h2&gt;Takeaways&lt;/h2&gt;
&lt;p&gt;What did I learn through this process?&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;I&apos;m actually OK at solving tricky compatibility issues. Sometimes I&apos;ve felt like I haven&apos;t had a really tricky bug in a while and it&apos;s nice to get something like this and see that I can come out the other side on top.&lt;/li&gt;
&lt;li&gt;Even narrowing supported browsers and OS&apos;s can leave you with surprises you didn&apos;t foresee.&lt;/li&gt;
&lt;li&gt;Getting to the bottom of an issue is both rewarding and worth it!&lt;/li&gt;
&lt;/ul&gt;</content:encoded></item><item><title><![CDATA[How I Overhauled My Website in a Day]]></title><description><![CDATA[I had been putting off redesigning my website for way too long. Everytime I thought, "Dude, you need to update your site...like yesterday…]]></description><link>https://www.jdsandifer.com/blog/how-i-overhauled-my-website-in-a-day</link><guid isPermaLink="false">https://www.jdsandifer.com/blog/how-i-overhauled-my-website-in-a-day</guid><pubDate>Tue, 25 Sep 2018 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;I had been putting off redesigning my website for way too long. Everytime I thought, &quot;Dude, you &lt;em&gt;need&lt;/em&gt; to update your site...like yesterday,&quot; I also remembered all of the steps that would take:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Choose something to update like adding a new project.&lt;/li&gt;
&lt;li&gt;Go make sure the project looks good on GitHub and wherever it&apos;s hosted.&lt;/li&gt;
&lt;li&gt;Write up a short explanation for it.&lt;/li&gt;
&lt;li&gt;Screenshot it or pick a nice image to represent it.&lt;/li&gt;
&lt;li&gt;And &lt;em&gt;NOW&lt;/em&gt; I can actually start the website update...by trying to remember my AWS password (my last host).&lt;/li&gt;
&lt;li&gt;After I give up on guessing my password, I go through the annoying process of resetting it.&lt;/li&gt;
&lt;li&gt;Now that I&apos;m logged into my host, I&apos;m ready to update my page - HTML &amp;#x26; content - and upload the photo.&lt;/li&gt;
&lt;li&gt;If all goes well, that&apos;s it.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Phew! I know I&apos;m being a little dramatic and some of those steps could be simplified if I took the time to work on them, but it really was a burden that I didn&apos;t want to mess with.&lt;/p&gt;
&lt;p&gt;And that&apos;s why my site languished in its outdated state for a so long. Until one day I had...&lt;/p&gt;
&lt;h2&gt;An Important Conversation&lt;/h2&gt;
&lt;p&gt;As part of my growth as a developer, I try to meet up with other developers - especially people who are more experienced than I am.&lt;/p&gt;
&lt;p&gt;One such conversation was with a Senior Developer over coffee. In addition to getting his take on the market, finding out about what he did and what technologies he used, I also asked him about his suggestions for some typical development tasks.&lt;/p&gt;
&lt;p&gt;Since I had heard a lot about Gatsby recently, I asked what he thought about it for a simple site and he encouraged me to try it out. The most importat thing, he said, was to spend no more than half a day. If I couldn&apos;t get it working by then, he recommended I try something else.&lt;/p&gt;
&lt;p&gt;That seemed wise. Even if it doesn&apos;t work out, what&apos;s half a day if there&apos;s a chance I&apos;d have an updated, more stylish site at the end?&lt;/p&gt;
&lt;h2&gt;My First Static Site Generator&lt;/h2&gt;
&lt;p&gt;I know Gatsby is more than a static site generator, but for my site that&apos;s really all I needed from it. And its website was very encouraging:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Install Gatsby.&lt;/li&gt;
&lt;li&gt;Start a new project from a template.&lt;/li&gt;
&lt;li&gt;Run &lt;code class=&quot;language-text&quot;&gt;gatsby develop&lt;/code&gt; to host a live-reloading version of your site locally as you edit.&lt;/li&gt;
&lt;li&gt;Run &lt;code class=&quot;language-text&quot;&gt;gatsby build&lt;/code&gt; to create the polished, web-ready version of your site.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;That is somewhat simplified, because I did have to choose a template, but that&apos;s the only other thing I needed to get off and running.&lt;/p&gt;
&lt;h2&gt;The Joy of Editing and React&lt;/h2&gt;
&lt;p&gt;As I got into the groove of editing, it was awesome to see my site update on every file save. I&apos;ve had this type of experience on CodePen and various other places, but Gatsby&apos;s version just works well.&lt;/p&gt;
&lt;p&gt;I also enjoyed how React was integrated into the project. Making changes to the actual layout or functionality of the site was easy because I&apos;m very familiar with React - I use it at work right now and love it!&lt;/p&gt;
&lt;p&gt;Time flies as I enjoy the process of taking the template I started with and making it my own. Before I knew it, I was looking at a modern, professional version of my site - I was ready to show it to the world!&lt;/p&gt;
&lt;h2&gt;The Hiccups Begin&lt;/h2&gt;
&lt;p&gt;And here is where I hit my first problem.&lt;/p&gt;
&lt;p&gt;When I went to build my site, the command failed! I had spent hours writing, sourcing images and taking screenshots, and tweaking the look of this site and now it was all going to be for nought!&lt;/p&gt;
&lt;p&gt;I hated how perfectly Gatsby had got me off and running only to dash my hopes near the end!&lt;/p&gt;
&lt;p&gt;But being a good developer, I started to troubleshoot. That is, I Googled the error code. It wasn&apos;t popular and most of the hits were from GitHub issues. I don&apos;t want to find out other people are having the same problem and they think it&apos;s the software itself...&lt;/p&gt;
&lt;p&gt;After some researching and back-tracking, I figured the problem must be that my starter template was for Gatsby v1 and I had installed the latest version - Gatsby v2. The docs had a process for converting a project from v1 to v2, but it looked long and tedious.&lt;/p&gt;
&lt;p&gt;More searching led me to a potential problem in one of Gatsby&apos;s dependencies used for CSS processing. I easily wasted an hour trying to bypass that part of the build to no avail.&lt;/p&gt;
&lt;p&gt;I want to take a moment to point out that somewhere in here would have been a good time to seek help from others. Finding a good place to get responsive help in working with Gatsby would have paid dividends both in getting a solution to my current problem and also in knowing where to go next time. I wanted to get the site finished quickly and I made myself feel like I didn&apos;t have time to wait for someone else to respond to my problem. I definitely think this was a mistake.&lt;/p&gt;
&lt;h2&gt;Inspiration&lt;/h2&gt;
&lt;p&gt;I don&apos;t know when it hit me, but I finally considered another solution: Instead of trying to make my v1 Gatsby starter work with v2, why not just use Gatsby v1?&lt;/p&gt;
&lt;p&gt;I couldn&apos;t find documentation on the Gatsby website about how to choose an older version of Gatsby so it took me a while, but I eventually figured out the correct command to have npm install an older version of Gatsby. (In hindsight, I don&apos;t really blame the folks at Gatsby for this - if I&apos;m going to use a tool like npm, I should probably figure out how to use it!)&lt;/p&gt;
&lt;p&gt;Sure enough, with that done I was building my site and happy as a clam.&lt;/p&gt;
&lt;h2&gt;TL;DR&lt;/h2&gt;
&lt;p&gt;I think I&apos;ve reached a good length for this post so I&apos;m going to cover deployment of the site in another post - stay tuned! Before leaving though, here&apos;s what I learned about redesigning a web site (or building from scratch):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Use a static site generator and a starter template or theme. Build off the work of others!&lt;/li&gt;
&lt;li&gt;Build it first! Sort out any problems before you start spending time on your own content.&lt;/li&gt;
&lt;li&gt;Give yourself time so you can ask others for help. I wanted to GET IT DONE and gave myself an unhelpful time crunch that eliminated seeking help from others.&lt;/li&gt;
&lt;li&gt;Enjoy the beauty of modern development tools!&lt;/li&gt;
&lt;/ul&gt;</content:encoded></item></channel></rss>