Cleaning up your code in runtime is a non-negotiable part of building efficient, predictable applications. One of the ways that’s done in JavaScript is by stewarding event listeners well — specifically, removing them when they’re no longer needed.There are several approaches available to do this, each with its own set... Read It
I’m rather late to the party, but I recently ran across JavaScript’s Element.matches(), which allows you to check if a given CSS selector matches an element. Put another way, it tells you if an element would be selected if the DOM were being queried by something like document.querySelector().Why I Needed... Read It
This site’s been on Next.js since 2021, and I’ve had very few complaints about it. I’ve appreciated things like its slick developer experience, the first-class support it enjoys from Vercel for features like incremental static regeneration, and the constant innovation driven by its community. It’s a great tool, and my... Read It
I’ve been a vocal opponent of using Disqus for a number of reasons, one of which being what it does to the performance of your website. It’s actually one of the reasons I built an alternative.Despite that, it’s a widely used service that won’t be going away anytime soon. And... Read It
I remember when I first started to get a little more serious about blogging. It was with a statically generated Gatsby site, with posts stored in flat Markdown files, and deployed on Netlify. I loved it. But I knew it was still missing something I wanted: a way for readers... Read It
If you’ve worked with React for any length of time, you’ve probably heard of the infamous useLayoutEffect() hook. You’ve also probably never used it. That’s because for most cases, useEffect() covers the vast majority of use cases with a much lower chance of shooting yourself in the foot. In fact,... Read It
I recently made a pretty big change on my website. For the first time ever, my posts don’t live in Markdown files. Instead, they’re all in Notion, the tool I’ve been using to draft posts for quite some time now. It’s nice being able to have a top-notch writing experience... Read It
If you haven’t noticed, we’re in a bit of a server-rendered resurgence right now. It seems like the heyday of the Jamstack, and more specifically, static site generation (SSG) is behind us, and the pendulum is once again swinging toward more traditional paradigms. Namely: HTML that’s generated on demand/request rather... Read It
Harken back to a time when you needed to execute some code a specific number of times and had some reason to not use a for loop. You might’ve made a fresh array with a certain number of items, and then attempted to .forEach() over it:If you did take that... Read It
More and more frequently, I’ve been working with little single-page applications that are built independently and then mounted into something more complex. Think of things like interactive calculators, multi-step forms, or other tools intended to plug into a bigger system, like a CMS.Overall, it’s a useful approach. Rather than being... Read It