React TypeScript: Simplify Imports with Path Aliases

React TypeScript: Simplify Imports with Path Aliases

  • January 27, 2024

As codebases grow larger and more complex in structure, imports can become unmanageable. As more directories are added, imports become intricately long and obscure clarity. Fortunately, we can simplify imports with path aliases. The problem The following is a fairly common occurrence in a large project: This can be burdensome...

Why should we not use index as key in React Lists

Why should we not use index as key in React Lists

  • January 22, 2024

When working with React, developers often come across the need to render lists of items efficiently. Every item in a list needs to have a key prop assigned to it. It is essential for enabling React to track changes made to these items. Using array indexes as these keys is...

Delete git branches that do not exist on remote

Delete git branches that do not exist on remote

  • December 23, 2023

After working on a project for a while, there will come a time when we will end up with a lot of local branches that have been merged on remote but still exist on our local machine. To delete git branches that do not exist on remote, we can perform...

Partial Matching in Jest

Partial Matching in Jest

  • October 25, 2023

Jest has the ability to check for partial matches on arrays and objects. Let us see how to do partial matching in Jest. expect has powerful matcher methods for partial matching, and they can also be combined with the tohavebeencalledwith method. Matching objects partially using expect.objectContaining When trying only to...

Fixing “error: cannot find module semver” error in Node.js

Fixing “error: cannot find module semver” error in Node.js

  • October 19, 2023

When installing a package using npm, you might encounter the “error: cannot find module semver” error. The error is caused because of a corrupted package-lock.json or yarn.lock. The most common reason for this is a change in the node version. Fixing “error: cannot find module semver” The fix is a...

Fix “Error:0308010C:digital envelope routines::unsupportedFixing” in Node.js

Fix “Error:0308010C:digital envelope routines::unsupportedFixing” in Node.js

  • October 17, 2023

Node 17 introduced OpenSSL v3.0, which brought in some breaking changes, and the “Error: error:0308010C:digital envelope routines::unsupported” is a result of one such change. It can be solved by passing in a “–openssl-legacy-provider” flag when running the application. Setting the NODE_OPTIONS environment variable We can set the environment variable that...