Fetching Data with async/await in a React Component


Fetching data from a resource, such as a JSON API is a common thing these days, and so is the use of asynchronous (async) functions that avoid locking up applications.

In React components, async functions have some additional caveats to keep in mind that –if left unchecked– can introduce memory leaks or race conditions.

In this article, we’ll be covering a small app that fetches articles from an API and lists them out. We’ll take a look at async functions in a React component, address caveats, and checkout making our function reusable as a custom React hook.

This article will cover:
💚 Async/Await use in a React component
💚 Writing cleaner code with custom hooks
💚 Testing async/await in Jest 👩‍🔬

Prerequisites
✔ Familiar with functional React component basics
✔ Basic understanding of async/await

May/June 2021 – Month(s) in Review


We’re now half way through 2021. This has been a weird one. With this milestone, it does have me thinking about how I can plan out my time better to make the most out of this second half.

I’ve been keeping busy these last couple months, there is actually a lot I would like to share, but it’s all over the place. So I’ll split up those topics through July (hopefully I make good on this).

In my free time, there’s been a lot of Diablo play (I and III), and researching/learning some new technical concepts. I’ve been checking out Apollo GraphQL for API considerations. I’ve also been spending some time getting familiar with Ansible for server configuration.

Diablo III – Season 23

Season 23 began for Diablo 3 and I’ve been playing through it on PC and Switch. This is actually the first season I’ve played on PC in a while, I really like playing on the Switch because it’s portable.

I decided this time around I wanted to complete the season as a whole, and I was able to accomplish that on PC. I’m pretty close on Switch

I discovered some helpful resources to figure out good builds. Icy Veins has a section for Diablo 3 and there’s also Maxroll (I really like their UI). I’ve also been catching info from the Rhykker YouTube channel.

I started with a Wizard meteor build on Switch, unfortunately that build is retired. I didn’t know that until later (I’ve moved over to Firebird Mirror Image). Spectral blade is one of my favorite skills ❤.

April 2021 – Month in Review


The Jamstack

This month I’ve been checking out TravisCI and Netlify. I was able to get my portfolio app and Spotify app (pet projects) deployed to Netlify.

TravisCI is a continuous integration service. It will build an web application and run tests. This helps confirm there have been no changes that break the software.

Netlify is hosting service, more specifically Jamstack websites and serverless functions.

Both Netlify and TravisCI have been free to try. Their limits for the free tier have been more then enough for me to deploy a couple of my projects and push up updates. They also fit into the Github ecosystem very well.

The life cycle from development to deployment looks like this:
Push changes to Github → TravisCI builds app and runs tests → Netlify pulls new code and deploys

Stay Awhile and Listen

Go is a language that has always perked my interest a bit. I was watching a developer on Twitch working on with feature flags, and after looking into Go a little saw that it’s use is still growing. So I decided to finally try it out.

Go feels unique to me, in that a lot of how its used/coded is very opinionated. You have the freedom to do whatever you want of course, but there is a “Go way” of developing programs and mods. For example, it’s common to have all Go projects live under a single Go workspace.

I built a simple app that displays the Diablo III ladder rankings for any of the ladders this season. (Github Source)

Music Pick

Lately I’ve been listening to a lot of Call of the Wild, a weekly music show that has a mix of different electronic music. Episode 341 features Koven’s new album. Here’s a particular song I really like.

Link Picks

Casidoo – Make Jest Faster (Casidoo’s Newsletter)
C# learning this month (dot.net/videos)

Getting More Familiar with Docker


I’ve been spending this week getting more familiar with Docker. I’ve learned how to build new images, spin up a collection of related containers with Docker Compose, and push an image to AWS.

I’m pretty excited about how this will help my team, but I’m also nervous about the unknowns we’ll encounter. My goal is to free up time, not take up more.

It’s important to know what Docker is and isn’t. To be honest, I’m still a little fuzzy. I wrote about this in my last post.

Docker utilizes virtualization technology to run processes in isolated environments called Containers. It has some similarities to virtual machine technology, such as VMWare and VirtualBox.

Docker Containers do not hold an OS, but they do have libraries and binaries from other OSes.

After working with Docker a little, I’m now much familiar with commands to setup a container and access the container (docker exec -it is my friend). I’ve also gotten more familiar with docker-compose (docker-compose up/down are pretty cool).

The documentation for Drupal on Docker provides info on both setting up Drupal and MySQl.

I’ve been able to spin up a Redis and MySQL server with Docker, it has simplified the setup and given my team a consistent toolset.

Regularly Scheduled Maintenance


For about the past year I’ve been putting my time towards planning and managing projects and less time with implementation.

I was stubborn in accepting I didn’t have enough time to both manage and code. I learned the hard way.

I tried to code out a complex solution that ended up taking a long time to finish, because I kept getting pulled away. After that, I focused more on coaching. Guiding my developers to make good decisions has become a more effective use of our time.

One challenge with this approach is my coding skills are becoming a little rusty. My memory of higher level design is fine, but my familiarity with the code base and specific implementation has started to become fuzzy.

Another challenge is keeping up to speed on new features that come out for languages and frameworks. Last year I had an instance that caused a little conflict when I wasn’t familiar with with some new React features that had been announced the year before.

There is a question I’m hoping to get an answer for this year; is it possible to be a technical lead and a manager?

I’ve heard of positions that are both, but my personal experience has shown me it’s difficult and probably best there’s a separation of the two.

Regardless of if I hold on to those responsibilities or not, I want to keep my skills up to date. And that requires some routine maintenance.

I think it’s best to focus on one area at a time, which has me a little torn. Do I put that attention on work or hobby? That’s a topic to delve into more in another post. For now, I’m going to side with work and explore Drupal more.

I was tempted to say Drupal and React, but I need to limit myself to reasonable goals.

Putting in any time to perform any maintenance is an improvement over the past two months.

My target is to get Drupal setup in an environment to test out the layout builder and see how their database schema is structured.

Wish me luck!