Home

Currency handling in React

Make a currency component. Format inputs on blur instead of while typing. Use locale formatting. Provide currency info with React Context.

Custom routing with Remix

Create your own route convention. Use a custom glob pattern. Add layouts automatically, or prepend an optional language segment.

Simple RBAC in Remix

Implement role based authorization in Remix. Hard-code your permissions if possible. Store them in the database if they have to be updated dynamically.

Nested arrays and objects in Form Data with Conform

Use Conform's parseWithZod to handle nested arrays and objects in form data. Repeat the same input name for arrays. Use dot notation for objects. Use `array[index].property` for arrays of objects.

Use API keys to connect apps and services

Use environment variables to store single API keys, or put them in the database for advanced workflows. Use time-limited keys and scope them to specific permissions.

Set up PostgreSQL on Fly

Fly is a managed container platform with first class support for Postgres databases. Create a database. Allocate an IP address. Get a connection string.

Handle both JSON and FormData in Remix

Use formdata for progressive enhancement and json for a better developer experience. Parse request bodies based on their content type, and parse fetchers read pending requests.

Build custom fetchers with Remix

The useFetcher hook is the most powerful tool in the Remix toolbox. Submit data in one component, and display the status of the request in another. Turn fetchers into custom hooks that you can use anywhere in your app.

Server-side pagination with Remix

Use query parameters to implement server-side pagination with Remix. Create a rolling pagination component that shows the current page along with a few pages before and after it, like Google Search.

Upload images with pending UI

Upload images to a third-party service in the background, then display them as thumbnails before the form is submitted. Use drafts for cross-device persistence.

Generate open graph social preview images with Remix

Learn how to generate social preview images for your website with Remix and Tailwind. Use Vercel's Satori package with Remix for dynamic open graph images. Fetch fonts from Google automatically.

Where to host your Remix app in 2024

Should you host your Remix app on a serverless provider like Vercel, Fastly, Netlify, Cloudflare, or AWS Lambda? Or a long-lived server like Fly, Render, Railway, or DigitalOcean? This guide will help you choose the right hosting option for your app.

Redirecting from a resource route

Use redirect routes to redirect users to the right place. Implement dynamic next/previous buttons. Send users back to onboarding or login pages.

Build a server-side filter UI with Remix

Create a filter bar that stores its state in the URL. Use the OData query string format to parse and serialize the filters. Create a custom hook to manage the filter state.

Build your own headless UI components

Write logical components that don't prescribe styles. Avoid manipulating children. Use React Context to provide state to nested components.

Use svg sprite icons in React

How to use svg sprite icons in a React app. Create a single svg file that contains all the icons and use a React component to display a specific icon by referencing its id. Use Sly CLI to download icons from the command line.

Add Prisma to a Remix app

Prisma is a typescript ORM for type-safe database access and automatic migrations. Add it to your Remix app to get started with SQLite.

Show a loading state while images load

Images don't start loading until they appear in the HTML. You can use link tags to start loading them earlier, or use React to show a placeholder until the image loads.

Custom Fetcher Hooks are Remix's Typesafe RPCs

Create RPCs by exporting functions from your resource routes. Get full end-to-end type safety and autocompletion. Use custom fetcher hooks to get automatic revalidation, request cancellation, and more.

Use an emoji favicon

Stop using framework-default favicons and use an emoji favicon instead. Supported on almost all browsers.

Multi-step forms with Remix

Longer forms can be broken up into multiple pages. Store the in-progress form data serverside. When they return to a page, re-fill the inputs with the data they've already entered. Use the in-progress data to automatically send them to the right page.

Multiple forms and actions on a page with Remix

A Remix action is an endpoint for POST requests, and all forms will submit to the same action. Add a name and value to your submit button to know which form was submitted, and use that to determine which action to take.

Dynamic form inputs with Remix

Learn to use just enough React to build dynamic forms without Reinventing the Form by controlling every input. Use Remix to pre-load the form with saved data and to handle the form submission.

Add data to a Google Sheet from a Node.js backend

Learn how to add data to a Google sheet from a Node.js backend using Google's v4 REST API instead of any libraries. Great for collecting feedback, tracking bugs, or keeping a list of newsletter subscribers.

Write good scrum tickets

If your ticket is actually ready to pick up, it'll be completed in half the time. And if the definition of done is clear, development will double in speed again. This is what's needed to get twice the work done in half the time. This is the reason Scrum exists.

Build Vue Components with ESBuild

Simple projects may be able to compile modules using the command line, but if you're trying do anything complicated enough to need plugins, you need to use the ESBuild node modules instead.

Create a custom local eslint rule

Running custom ESLint rules locally is really easy, so there's lots of room to explore automating rules and guidelines that are important to your project but maybe not anyone else.

The Developer's Guide to Hoisting

I often think that if we knew why interviewers continue to ask about hoisting, we'd know a lot more about how to conduct better interviews

Dynamically generate test cases with Jest

As long as you know which cases you want to test up-front (for example, you're not trying to generate them after a network request) you can use Jest to batch out multiple cases at once.

Enter the Tech World

If you're new to the professional tech industry, this is where I'd recommend you start

Filter an array in Typescript

I had a typed array and wanted to remove elements with an empty value, but Array.Filter returns a regular array of regular objects, and the type information about the string unions was lost

Format text with XState (Part 1)

The number of states in a system can grow rapidly as features are added. XState allows us to model these easily with parallel state management.

Import ENV file from 1Password shared note into Gitpod environment

In April 2021, 1Password acquired SecretHub, which means there is now a way to securely store and download text files from a 1Password vault. This is perfect for `.env` files, as vaults can be shared between team members and now also to cloudy development environments.

Understanding HTML's mysterious Void elements

Void elements are HTML elements that cannot have any content, and cannot have separate closing tags. br, hr, img, and input are some of the most common void elements, but there are many more.

Notes for Modern Redux with Redux Toolkit (RTK) and TypeScript

Redux Toolkit simplifies the process of setting up your redux application including building slices, reducers, selectors and thunks. Everything we do in the course is typed with TypeScript to make your application development process as smooth and powerful as possible.

Reverse a Record in Typescript

I had an API adapter that went one direction, and I wanted to make it go the other direction without losing type information

Watch Youtube Streams and Chat with React

In this tutorial I'm going to show you how to bootstrap a React project from scratch using NPM and Webpack, integrate Google Login, grab data from the Youtube API, and deploy your code to Netlify

Tweets

These are a few of my favourite tweets

Write a type-safe singleton module in Typescript

A singleton is a module that returns the same instance every time it is imported. This is useful for database connections, caches, and external processes. This article shows how to write a singleton module in Typescript.

Import Vue SFC files with Typescript

If you're adding Typescript to a Vue project, you need to do a bit of extra work to make Single File Components load properly into the type system.