Utilizing the useReducer Hook in React Development

Discover the benefits and implementation of the useReducer React hook! Ever since the introduction of hooks in React, I have found them to be incredibly useful in several projects. They offer a more streamlined approach to writing code, making it feel like “real” JavaScript. By eliminating the need for class-based components, functional components can now handle state management effectively. For those who are new to hooks, I recommend checking out my introductory guide to React hooks here....

Validating input in Express using express-validator

In this blog post, we will learn how to validate input data in your Express endpoints using the express-validator package. Specifically, we will look at how to validate the name, email, and age parameters in a POST endpoint. Let’s start by setting up our Express server and configuring it to parse incoming JSON data: const express = require('express'); const { check, validationResult } = require('express-validator'); const app = express(); app.use(express.json()); Next, let’s define our POST endpoint and perform validation on the input data:...

Van Life in Winter: Tips and Challenges

Winter brings a whole new set of challenges when it comes to living the van life. While using a van during the summer months may not require much preparation, the cold weather of winter necessitates some additional considerations. In this blog, I will share my experiences and offer some tips for successfully navigating van life during the winter. Heating Systems The first and most important thing to note is that you need a reliable heating system in your van....

Van Life: Electricity - A Guide to Powering Your Van

Welcome to another post in my van life series! Today, we’re diving into the topic of electricity in your van. When living on the road, electricity becomes a crucial aspect of your daily life. With limited energy reserves, it is important to ensure that you have enough power and the means to obtain more whenever needed. Most vans and motorhomes have two electric systems running in parallel: a 230V system and a 12V system....

Van Life: Water - The Key to Survival on the Road

Water is an essential resource that plays a vital role in our daily lives, especially when living the van life. From drinking and cooking to personal hygiene and cleaning, water serves multiple purposes on our journeys. In this blog post, we will explore the importance of water in van life and discuss effective water management techniques. When it comes to water storage in your van, the capacity largely depends on the size of your vehicle....

Van Life: Where to Go with Your Van

When it comes to van life, deciding where to go can be both exciting and challenging. There are two important aspects to consider: where you want to go and where you can go. In this blog, we will explore both aspects to help you find the perfect destinations for your van life adventures. Where Can You Go? In terms of accessibility, vans can go almost anywhere there is a road. However, it’s important to be aware of the laws and regulations regarding parking and camping in the country you are visiting....

Variables and Types in Go: Understanding the Basics

In Go, variables are defined using the var keyword. You can define variables at the package level or inside a function. At the package level, a variable is visible across all the files that make up the package. On the other hand, a variable defined inside a function is only visible within that function. When you define a variable using var, Go automatically infers its type based on the assigned value....

Visualize your local Git contributions with Go

In this tutorial, I will show you how to write a Git stats analysis CLI tool using Go. This tool will allow you to visualize your local Git contributions in a graph format, similar to the one shown on GitHub.com. A few years ago, I built a desktop app using Electron, Meteor.js, and the gitlog package. This app scanned my local Git repositories and provided a nice contributions graph. However, I disliked using Electron due to its large app size compared to other options like MacGap....

Vite Tutorial: A Next-Generation Frontend Tool

Recently, I’ve been exploring Vite, which is often referred to as “the new create-react-app”. While there are many tools that serve a similar purpose, such as Parcel, esbuild, Rollup, Rome, webpack, and Turbopack, Vite stands out in its unique approach. Vite describes itself as a “next-generation frontend tool”. It functions as a module bundler like webpack or Turbopack, but with a significant difference. Instead of creating a single bundled JavaScript file that is sent to the browser, Vite leverages the native browser’s ES modules support to directly ship modules to the browser....

VS Code: Utilizing Language-Specific Settings

In VS Code, you have the flexibility to personalize your preference regarding spaces versus tabs similar to any other text editor. Additionally, you can specify the number of spaces a tab should translate to. However, it is essential to consider that different programming languages often require distinct settings. To illustrate, let’s assume I prefer utilizing four spaces in HTML files but only two in CSS and JavaScript files. Conversely, Go requires eight spaces....