Blog

Posts on software development, careers, and craft.

After using @PrettierCode, watching someone code without it makes me cringe

After using @PrettierCode, watching someone code without it makes me cringe. Manually adjusting indentation and line breaks feels downright silly....

Slick way to get a unique JavaScript array: 1

Slick way to get a unique JavaScript array: 1. Declare a Set (Set enforces unique values). 2. Convert it to an array via object spread. One liner:...

Why react-query / swr are awesome: They return cached data *immediately*,...

Why react-query / swr are awesome: They return cached data *immediately*, then fetch behind the scenes and update the UI when it’s returned. Result...

I ♥️ Hooks

I ♥️ Hooks. But they created a “2nd system” problem: There are 2 ways to do everything. The function API is superior. 😀 But, most the React docs s...

In a JavaScript app, what do you call a file that only contains functions...

In a JavaScript app, what do you call a file that only contains functions that perform HTTP requests? For example, this file contains functions tha...

TIL: HTML <details> and <summary> create collapsable content

TIL: HTML <details> and <summary> create collapsable content. No JS required! 😎 Works in all evergreen browsers. And IE11 degrades nic...

30 Ways to Handle React State

While preparing my upcoming Pluralsight course “Managing React State”, I found a surprising number of React state management options. This slide from the upcomi…

As a developer, UI/UX can seem like an art or innate talent

As a developer, UI/UX can seem like an art or innate talent. We're not “born with” these skills. We learn them. Here’s a compelling short video on...

Interesting UI monorepo config: 1

Interesting UI monorepo config: 1. Place each project in a separate folder 2. Place a single package.json in root. So all projects share a single p...

Overrated: Buying new stuff

Overrated: Buying new stuff. Underrated: Maintaining your stuff so well that it continues to feel new, so you don't have a big desire to upgrade.

Why I write integration tests first: 1 I don't have to keep manually running...

Why I write integration tests first: 1 I don't have to keep manually running the app to see my code work. Integration tests automate the browser. 2...

I've spent the last week trying to use #JavaScript Map and Set instead of...

I've spent the last week trying to use #JavaScript Map and Set instead of plain ol' arrays and objects. My verdict? Not worth it. The lack of basic...

When working with a list, an array is an obvious choice

When working with a list, an array is an obvious choice. But sometimes it's preferable to use an object instead. Here's when: 1. Each item has a un...

I was manually updating localStorage anytime state was updated

I was manually updating localStorage anytime state was updated. Then I realized: That's the perfect job for useEffect. Here, I’m persisting shoppin...

The fastest way I've found to learn new tech: I build something with it...

The fastest way I've found to learn new tech: I build something with it *outside my company's environment*. Here's why: - I don’t have to wait for...

React-query and swr are awesome

React-query and swr are awesome. 🔥 They taught me to ask a bunch of questions that I should have been asking: 1. Should I cache data on the client...

Learning is hard

Learning is hard. Here's a mindset I find helpful. I don't expect to understand the docs at first. I don't expect to "do it right" at first. But I...

Most React devs know to declare a key when iterating over an array

Most React devs know to declare a key when iterating over an array. But there are 2 lessor known reasons to use keys: 1. To force a re-render on a...

These are the 6 questions I ask to decide where to store state in React apps

These are the 6 questions I ask to decide where to store state in React apps. See any missing scenarios? Suggested tweaks? #reactjs

I'm torn about @tailwindcss

I'm torn about @tailwindcss. It's a tradeoff. Benefit: Move faster. No need to declare my own classes. Cost: More "noisy" HTML due to long class de...

New React state library from Facebook: Recoil

New React state library from Facebook: Recoil. 🎉 ✅ Flexible shared state ✅ Derived data and queries ✅ App-wide state observation This short video...

I’m creating a reusable React component library in TypeScript for a client

I’m creating a reusable React component library in TypeScript for a client. It’s taking longer than a plain JS library. That’s not surprising. Type...

When fixing a bug, I write a test that reproduces the bug first

When fixing a bug, I write a test that reproduces the bug first. Benefits: ✅I don't have to repeatedly configure the app to reproduce the bug while...

Announcement: I'm writing a new course

Announcement: I'm writing a new course! 🎉 Title: "Managing React State" I'm publishing on @pluralsight this summer. ☀️ What do you expect/hope to...

I don't write end-to-end (e2e) tests

I don't write end-to-end (e2e) tests. Instead, I write integration tests against realistic mock APIs. With comprehensive tests against a mock API,...

"I don't have time to write tests"

"I don't have time to write tests". Do you have time to: 1. Run the app manually after each change 2. Investigate and fix broken builds 3. Investig...

Two things that totally changed the way I think about separation of concerns: 1

Two things that totally changed the way I think about separation of concerns: 1. This 2013 talk by Pete Hunt: https://www.youtube.com/watch?v=x7cQ3...

Why I code against a mock API: 1 I control the speed 2 It's never down 3 No...

Why I code against a mock API: 1 I control the speed 2 It's never down 3 No internet required 4 No cross-team dependency 5 I can force it to throw...

React: The Good Parts 1

React: The Good Parts 1. Function components 2. JSX 3. Props 4. useState 5. useEffect I can elegantly solve most problems with these 5 simple tools...

HTTP call checklist: -Can this run in parallel with other requests

HTTP call checklist: -Can this run in parallel with other requests? -When should the request time out? -How are server errors handled? -What if the...