Musings on web, technology, worklife and more.

  • Higher Order Reducers in Redux

    As you may already be aware, a high order function is a function that operates on another function and returns a new function. This is a type of functional composition. If you’ve used Redux for sometime you will also be aware that Reducers are simply functions which accept state and an action and return a … Continued

  • What is Middleware in Redux?

    In a previous article I wrote about how Redux stores provide a dispatch function to “send” action objects to the reducer in order to update the store’s state. But what if we want to do something before or after each and every dispatch such as logging, centralised error handling or allowing dispatch to handle action … Continued

  • Learn Redux by implementing your own Store

    I recently (re)watched Dan Abrmov’s Egghead.io series on Learning Redux and used it to re-create my own Redux store from scratch with tests.

  • When to use React.useCallback()

    I write a lot of React components which require code review. Many times during that process someone has dropped the classic line: I think we should wrap this function in useCallback for performance reasons. But what is useCallback and when does it make sense to use it? useCallback refresher To recap, useCallback is a React … Continued

  • Learning the React Context API

    I have to admit, I’ve never fully taken the time to learn React Context API. Sure I’ve “used” it, but it’s always been me skirting around the edges of existing code. This post puts an end to that. I’ll walk through the basics of what I’ve learnt and how to put it into practice in … Continued

  • Avoiding React component re-renders with React.memo

    Used properly, React.memo can help avoid unnecessary re-renders. Learn how to apply it correctly.

  • Deploying WordPress sites to Pressable via the command line

    Pressable is a reliable and powerful WordPress hosting solution, but it doesn’t provide SSH access. So how can we achieve robust and automated deployments that can be run from the command line?

  • What is the JavaScript Event Loop?

    If you’ve been working on significant JavaScript applications for a while, you’ve likely heard engineers using terms like “non-blocking”, “single threaded” and “the event loop”. If you’re anything like me, for a long time I had only a superficial understanding of what those terms meant and even less of an idea how JavaScript worked under … Continued

  • What is a closure in JavaScript?

    If you are working with JavaScript it is critical that you understand the definition of a closure. Closures are widely employed in JavaScript code, for example: as callback functions for information hiding in currying or partial application As a result, without a firm grasp of how closures work you will struggle to produce high quality … Continued

  • Demystifying JavaScript Function Expressions vs Declarations

    I was recently asked to explain the difference between a JavaScript function expression and a function declaration. This one always caught me out until I created a mental model to allow me to understand it. Firstly though, let’s clear up which is which: A function expression looks like this …where as a function definition looks … Continued