Carl Topham

React.js & JavaScript developer

Recent articles

Fixing issues with NextJS local file APIs and Netlify functions

May 17, 2022

Recently I migrated my personal website to Next.js and thought I had everything working well with Netlify, however on deployment I noticed an issue with the API data...


As part of my migration from Gatsby to Next.js I moved the .gpx data to a Next.js API end point so that I can easily access the data in multiple places. I'm currently using the data in a custom Leaflet map component on posts. Each <Map /> component requests the geo json data it needs and the renders the routes and elevation profiles...

Type narrowing and discriminating unions in TypeScript

May 10, 2022

Type narrowing is the process of moving from a less precise set of types to a more precise type or set of types. The aim of type narrowing is to reduce the types down to only the ones where the following methods or properties can be correctly accessed or called without throwing errors.

It's a bit like playing a game of "Twenty questions".

In the traditional game, one player is chosen to be the answerer. That person chooses a subject but does not reveal this to the others. All other players are questioners....

Putting the `S` in SOLID JavaScript

February 16, 2021

S - Single-Responsibility Principle (SRP) is the first design principal covered by SOLID principals.

SOLID is an Object oriented design principal. It stands for:

  • S - Single-responsiblity Principle
  • O - Open-closed Principle
  • L - Liskov Substitution Principle
  • I - Interface Segregation Principle
  • D - Dependency Inversion Principle

The principals were originally created and promoted by Robert Martin (aka Uncle Bob).

SRP simply states that Classes and functions should only have a single responsibility. This sounds...

Getting started with Blender

February 13, 2021

I recently picked up 3d modelling after quite a few years away. I have not used Blender before so learning the basics involved many seaches and skimming videos to fine what I needed. This post is a quick guide to getting started with blender that I have created from my notes.

Hopefully it will enable you to get started more quickly than I did!


Firstly if you're on a (mac) laptop without a numpad then you will want to enable numpad emulation. This will allow you to use the normal numbers to navigate...

React and Material UI (MUI)

January 8, 2021

When I first used Material UI, I struggled with a few concepts. I've written this quick overview to help get my head around it, and hopefully guide others to a quicker start.

I'm going to make a new project and then create some (horrible) styles!

Create the project and add MUI

Create a project and install the Material UI package

npx create-react-app material-ui-playground 
cd material-ui-playground 
yarn add @material-ui/core 

Clean up the initial templates

Remove some unused contents (import of the styles)...

Recent projects

Migrate from Gatsby to Next.js

Rebuild my portfolio site ( in Next.js, migrating from Gatsby

Running kit bag

Interactive kit bag checklist app to ensure that I always have the right running kit for training, races and all weather!

SmartSave & LiveLend WebApps

React.js Redux WebApps using REST APIs with Auth.

Advanced Strava Stats

Sync your Strava data and analyse it in extra ways than the official app. React, Redux, Saga, Axios & D3.

SmartSave Public Website

Wagtail/Django/Python backend with WebPack, React & Bootstrap frontend