Technical

314 articles ยท all categories

February 2025

A pattern for composable UI in Flask

Turn your unwieldy Flask codebase into manageable, composable fragments with this UI pattern. Very close to HTMX.

January 2023

Async React with NextJS 13

We look at React's native async support and how to use it in a NextJS 13 app. Learn how to use async components, parallel loading states, and caching with React.js and NextJS 13.

November 2022

Reader question: useReducer or XState?

Following up from my article about XState and Stately.ai, fellow reader S. asked if `useReducer` could ever be relevant when using state machines in React code. Yes! Here's how

When your brain is breaking, try Stately.ai

Two years ago I wrote about using XState after building a UI interaction so twisted my brain leaked out my ears. It helped. Now the creators have made something even better โ€“ Stately.ai ๐Ÿ˜

October 2022

Over-engineering tweet embeds with web components for fun and privacy

A way to embed tweets in static sites with full pre-renders and live updates using just 9kB of client-side JavaScript, 2 HTTP requests, and full reader privacy โœŒ๏ธ

September 2022

useCallback is a code smell

One of my favorite ways to simplify and de-gotcha React code is to rip out all the useCallback and useMemo drama. 90% of the time you don't need it.

August 2022

Your code doesn't matter

"Your code doesn't matter" is something experienced programmers say, between the lines, when they sound like complete lunatics. But what do they mean? Why does everyone say it?

April 2022

Promise.allSettled, a wonderful tool for resilient code

The pros and cons of different approaches to writing resilient code that handles partial failures

March 2022

Saving time in UTC doesn't work and offsets aren't enough

Lessons from a painful outage with timezones, UTC offsets, and database clients that took a whole week to resolve.

A quick lesson in writing resilient code

On the backend anything can and will fail. How do you deal with that?

February 2022

A new VSCode extension makes state machines shine on a team

When you grok state machines, a new world of computational beauty and software design opens in front of your eyes. Things that used to be hard become easy. The impossible becomes possible. And you turn into that annoying team member.

December 2021

Small choices can wreck your codebase

wanna see the strangest looping construct I've found in production code?

November 2021

How defensive coding leads to bloat

Defensive coding is an important lesson and over time and engineers it leads to massive bloat, if you're not careful.

October 2021

How to configure Jest with TypeScript

Using plain Jest on a TypeScript codebase is kinda rough. No types in tests no thanks. Making Jest and TypeScript work together smoothly is something you do just rarely enough to forget the details. Hope this helps you and future me too โœŒ๏ธ

September 2021

Anything's a sorting problem if you squint hard enough

What's the most algorithmically fun code you've written recently? ๐Ÿค” Here's mine: A dataviz using a grid of triangles that fits into the client's logo.

July 2021

You don't need a big team to automate your work

The opposite of folks who follow every FAANG trend and over-engineer their companies to death, are the folks who *never* take advice from the big boys.

React 18 and the future of async data

Friend, I have glimpsed the future and it is amazing. React 18 is shipping with Suspense and startTransition for deferred component rendering, but not data loading. That's coming in a future 18.x version.

June 2021

A surprising feature of JavaScript optional chaining

This blew my mind, thought you'd like it too. You can do more with ?. than you thought.

Use Netlify's _redirects on Gatsby Cloud

Something always goes wrong when you change hosting providers. ๐Ÿ˜… For me it was redirects. A vital feature of any site migration.

A better React 18 startTransition demo

Demoing startTransition is hard. Modern computers are too fast ๐Ÿ˜… โ€“ Dan Abramov, a React core team member, helped me fix it up. Here's what I learned

Trying out React 18 Alpha

I read everything about React 18 Alpha, trawled through the work group, and ran some experiments. Here's what you'll wanna know.

A fun security bug with static rendering โ€“ CodeWithSwiz #31

The flash of unlocked content is great fun for any paywall

May 2021

Build privacy-focused blazing fast tweet embeds โ€“ CodeWithSwiz 30

Twitter embeds every tweet on your page as an iframe. Loads 1.2MB of JavaScript, makes 20+ HTTP requests and uses 100+ DOM nodes. ๐Ÿ’ฉ

Twitter embeds without JavaScript, pt1 โ€“ #CodeWithSwiz 29

Continuing our quest for better Lighthouse scores, more reader privacy, and less JavaScript we attacked the next biggest culprit ๐Ÿ‘‰ Twitter.

March 2021

Your serverless questions, answered

When talk comes to serverless, engineers have lots of questions. Here are some answers ๐Ÿ˜Š

Go full-stack in 5min with your first cloud function

How *do* you build a JavaScript function that runs in the cloud serverlessly? Here's how to get started with Vercel, Netlify, or AWS Lambda

Can you automate love?

What's the laziest thing you've ever built? For me it's a bot that sends cute pictures every day

If you can JavaScript, you can backend

When you think of a backend or server developer, who comes to mind? A wizard of arcane magics. The future belongs to full-stack frontend engineers.

That time serverless melted my credit card

Serverless is pretty cheap. But you *can* get it wrong.

Why serverless fits side-projects perfectly

How do you provision servers for no load most days THEN ALL THE LOAD THIS MINUTE? That's how side-projects work and it's hard