Recent posts

30 July 2020

Showing Vercel region to visitors

I wanted to add a note at the bottom of this site to say that it is hosted with Vercel. One of their main features is the edge network, meaning this website is served from multiple regions. I thought it would be interesting to also show the exact region each visitor is connecting to when visiting the website.

10 June 2020

Generating PDFs and images from React components

Let's say that we have a React element that we would like to save as a PDF document or an image. In order to do that, we can use Puppeteer, which uses a headless instance of the Chromium browser and is able to generate PDFs and images.

3 August 2019

Reliable timeouts in React apps

Let's say your React app presents the user with a task that has a time limit. The user must submit the task before the time runs out. The simple solution would be to call setTimeout at the start of the task. However, this is not a good solution.

16 December 2018

Rendering HTML in Gatsby

The Gatsby blog starter uses the dangerouslySetInnerHTML prop to render HTML for blog posts written in Markdown. While this works, there is a better solution.