Blog

Posts on software development, careers, and craft.

If you’ve only worked with React, Vue, Angular, etc, you might think every...

If you’ve only worked with React, Vue, Angular, etc, you might think every app needs a REST/GraphQL API. That’s not true. Many web apps call the DB...

Why I’m so excited about React’s server components: I can do full stack...

Why I’m so excited about React’s server components: I can do full stack development with just React. I don’t need to build REST/GraphQL APIs anymor...

I knew time zones were complex

I knew time zones were complex. I never knew the mess was this bad. This short video was a real eye-opener. In summary, never try to handle time zo...

Problem: If you rename a file by only changing its casing, Git won't “see”...

Problem: If you rename a file by only changing its casing, Git won't “see” the change. Solution: Use git mv. Example: git mv useraccount.js userAcc...

As a developer, I know I’m not a designer

As a developer, I know I’m not a designer. But that doesn’t mean I should blindly implement designs. I push back on designs that are: 🚫 Insecure �...

React tip: Avoid extracting event handlers to separate functions if they're...

React tip: Avoid extracting event handlers to separate functions if they're only called once. Benefits of declaring inline: ✅ Less code ✅ Automatic...

Why I review PR's in my IDE: It’s easier to see if files are in the right spot

Why I review PR's in my IDE: It’s easier to see if files are in the right spot. In a code review diff, I can’t easily see where a file sits *relati...

Challenge: Can you think of a single decision in software that has no tradeoffs

Challenge: Can you think of a single decision in software that has no tradeoffs? All upside. No cost or downsides.

Problem: If a function accepts two arguments of the same type, people may...

Problem: If a function accepts two arguments of the same type, people may pass arguments in the wrong order. Solution: Accept an object instead. Th...

Problem: You want to ensure environment variables are declared and...

Problem: You want to ensure environment variables are declared and referenced properly in all environments. And you want autocomplete support. Solu...

If I’m coding alone, I may skip writing tests if the project is small enough...

If I’m coding alone, I may skip writing tests if the project is small enough that I can hold the entire project in my head. But, when coding as a t...

I find GitHub CoPilot more useful for programming tasks than ChatGPT

I find GitHub CoPilot more useful for programming tasks than ChatGPT. Two reasons why: 1. Better ergonomics. I need not leave my editor. 2. Richer...

I've been coding for 20+ years

I've been coding for 20+ years. For the first 10 years, I thought automated tests were a waste of time. Then, I dug in, practiced, and got good at...

Problem: You want to run multiple npm scripts at the same time

Problem: You want to run multiple npm scripts at the same time. Solution: 1. Use npm-run-all. 2. Give related scripts a common prefix. Then you can...

Problem: A component is hard to test because it displays many different...

Problem: A component is hard to test because it displays many different messages in different scenarios. Solution: 1. Put the test data in a well-n...

Why I prefer const: It encourages a single, immutable declaration

Why I prefer const: It encourages a single, immutable declaration. This is often simpler. Note how the logic using let below is much more syntax an...

10 technologies I use with nearly every React app: 1

10 technologies I use with nearly every React app: 1. TypeScript 2. Zod 3. Playwright 4. Storybook 5. react-query 6. Jest or Vitest 7. Testing Libr...

Problem: Your dev team makes spelling mistakes in code

Problem: Your dev team makes spelling mistakes in code. Solution: CSpell CSpell has a command line interface. So, run it against your entire codeba...

Is there an ESLint rule to warn when a "bad" variable name is used

Is there an ESLint rule to warn when a "bad" variable name is used? Example: I'd like it to warn when "data" is used. There's typically a more desc...

In React components, I group related items and declare things in a...

In React components, I group related items and declare things in a consistent order. My approach: 1. state 2. derived state 3. other hook calls 4....

Situation: You have two projects, a UI and a REST API

Situation: You have two projects, a UI and a REST API. The UI and API are written in different languages, so different devs do UI vs API dev. The U...

I’m loving Playwright’s new UI mode: npx playwright test --ui It opens a UI...

I’m loving Playwright’s new UI mode: npx playwright test --ui It opens a UI where I can: ✅ Run a test ✅ See the test run in browser ✅ Enable watch...

React-query tip: You probably don’t need initialData or presetData

React-query tip: You probably don’t need initialData or presetData. If you set these, isLoading is always false. Solution: Return early. Display a...

Problem: Your team is using VS Code, and you want to make it easy for all...

Problem: Your team is using VS Code, and you want to make it easy for all your developers to use the same extensions. Solution: Create .vscode/exte...

Problem: With react-query, we may declare inconsistent query keys

Problem: With react-query, we may declare inconsistent query keys. That leads to cache misses and duplicated cache entries. 👎 Solution: 1. Wrap ea...

A sign you may benefit from useReducer: You're making multiple setState...

A sign you may benefit from useReducer: You're making multiple setState calls in a row. With useReducer, multiple pieces of state can be updated vi...

Problem: A long ternary is hard to read

Problem: A long ternary is hard to read. Solution: Extract two functions. (This is especially useful when there's a lot of JSX around a ternary)

I taught a team React this week

I taught a team React this week. My teaching style is unique: We build an app that’s tailored to their company’s requirements, from scratch, togeth...

10 JavaScript/TypeScript features I avoid:

10 JavaScript/TypeScript features I avoid: ?. ?: as var let any else class enum switch They’re not always a problem. But, they’re overused, and can...

5 years ago, I had a full time job

5 years ago, I had a full time job. So did nearly everyone I knew. But, I knew an independent. He inspired me. I took the leap, and quit. After I w...