Frontend Dad Blog.
A highly performant and meandering blog. And also some occasional cheatsheets. Written by a human!
React's useEffect hook is a powerful, controversial part of the React architecture. However, its intended use is often misunderstood. In this article, I will walk through some of the ins and outs of the useEffect hook with the simple example of a timer component. We will see that a timer isn't necessarily so simple after all.
Older...
Thinking of Multidimensional Arrays as Rows and Columns
In doing some leetcode/algorithm practice, I've come across a series of interesting challenges that involve multidimensional or nested array structures. These problems involve modeling the array a structure that contains columns and rows. Solutions for these challenges are interesting enough that I thought they merited a blog post. They've changed the way I think about these types of problems and made them significantly less scary.
Recursion for Idiots Like Me
Most software developers will likely come across the topic of recursion at some point in their career. In a large percentage of cases, this will probably be during a job interview. Recursive functions and their applications are a favorite at the old whiteboard. I recently implemented a recursive function in practice, and the process of designing the function caused me to step back and re-teach myself about recursive functions in general. In this post, I will walk through four problems and four recursive solutions. As always, these solutions are almost certainly not the best. But they work, damn it.
Closing Time: Stale Closures in React and Javascript
Recently, a member of my team with a fair amount of React experience ran into a bug. Their component was referencing a state variable in its markup, but the value wasn't updating as expected. It was stale. This was an example of the 'Stale Closure' phenomenon that can affect all Javascript applications, but tends to be extra sneaky in React. It's a heady concept and so I will almost certainly confuse you even more by attempting to explain!
Setting Up a Local Python Environment (For Idiots)
I've decided to celebrate the holiday season by throwing together a simple HTTP server using the Bottle library. I haven't written anything object oriented in quite some time, and I was feeling like using some decorators again. My intention was to write a bit about my experience using the Bottle library, but of course this devolved largely into an exploration of the 'peculiarities' of setting up a local Python environment...
The Checklist: a Framework For Dealing With a Screaming Child
Now that we've had Quinn at home for a few weeks, Charlotte and I have developed a strategy for soothing him when he's losing his mind. We've dubbed this 'the checklist', and that's exactly what it is. It reminds me a bit of the protocol that airplane pilots use when something has gone (terribly) wrong. Don't panic, just follow the checklist!
The Mighty Quinn
When Charlotte and I settled on the name “Quinn” for our first kid, I didn’t think that the old Dylan song would become a source of some much needed strength for us.