Tim Mouskhelichvili • October 31, 2022 • 2 minutes to read
Sometimes, a TypeScript developer may want to add a global variable to the code base. Luckily, this is easy to do. To add a new global variable to TypeScript, you can: Augment the global object (when running in a [...]
Tim Mouskhelichvili • October 24, 2022 • 3 minutes to read
When preparing for a coding interview, you may have encountered the queue data structure and wanted to implement it in a TypeScript project. Luckily, this is easy to do. The queue data structure is a list of elements that [...]
Tim Mouskhelichvili • October 10, 2022 • 3 minutes to read
Enums are useful when you have a fixed set of constants. Sometimes, a developer needs to transform a TypeScript enum into an array. Luckily, this is easy to do. To transform an enum into an array in TypeScript, you [...]
Tim Mouskhelichvili • October 4, 2022 • 2 minutes to read
When developing a web application or TypeScript library, a developer may need to initialize an empty typed object. Luckily, it is easy to achieve. To initialize an empty typed object in TypeScript, you can: Use type assertion Create a [...]
Tim Mouskhelichvili • September 12, 2022 • 2 minutes to read
When creating a React web application or library, often a developer needs to import JSON data. A typical example is having a JSON file with country names used by the React web application. Luckily, it is easy to achieve [...]
Tim Mouskhelichvili • September 7, 2022 • 3 minutes to read
The react-router package is a fantastic library that enables React applications to have different routes that users can view. It has various features; however, one of its most significant ones is its ability to manipulate the browser history inside [...]
Tim Mouskhelichvili • August 30, 2022 • 4 minutes to read
Images are often the most significant elements (size-wise) to load on a website. That's why it is best only to load the images that the user sees, and when the user scrolls, progressively load the others. This brings the [...]
Tim Mouskhelichvili • August 29, 2022 • 3 minutes to read
Whether you are creating a single-page application or an e-commerce store, there is often a situation when you need to get the URL of the current page. Luckily, this is easy to accomplish in React. To get the current [...]
Tim Mouskhelichvili • August 24, 2022 • 3 minutes to read
When working on a React web application, buttons are one of the most common elements a developer will use. Sometimes, a developer may want to enable a button conditionally. This situation brings the question of how to disable a [...]
Tim Mouskhelichvili • August 23, 2022 • 2 minutes to read
React provides a simple way to build web applications. Often, those applications require adding links to other Internet resources. This brings the question of how to open a link in a new tab. Luckily it is easy to accomplish [...]