
A quick introduction to Javascript shadow DOM
Introduction JavaScript Shadow DOM is a powerful tool for creating isolated and reusable components in web development. It allows developers to create custom elements with their own…

Mock useSearchParams react testing library
To mock the useSearchParams hook from react-router-dom, you can use Jest’s mock function to provide a mocked implementation for the hook. For example: Consider we’ve a URL…

How to format relative times in Javascript
Introduction Formatting relative times in JavaScript can be a useful way to present information to the user in a human-readable format. A relative time is a time…

Looping through Javascript Set object in React
In React, you can loop over a JavaScript Set using the Array.from() method to convert the Set object to an array. You can then use the map()…

Looping through Javascript Map object in React
In ReactJS, you can loop over a map using Object.entries() method to convert the Map object into an array of key-value pairs, and then use the map()…

The basic guide for React Query useMutation hook
React Query is a popular library for fetching, caching, and updating asynchronous data in React applications. It provides a number of hooks, including useMutation that allows you…

How to measure the performance of javascript function
Introduction There are several ways to measure the performance of a JavaScript function. One way is to use the performance.now() method, which is part of the Performance…

Build React Heatmap Chart using Highcharts
Introduction HightCharts is a powerful library for creating data visualizations, It comes with many tools that allow to creation of a reliable and secure chart. This article…

Jest.mock is not allowed to reference variables
Sometimes when trying to mock a function in Jest, you might encounter the following error: Service mocked with Jest causes “The module factory of jest.mock() is not…