How to parse a URL query parameters in javascript

How to parse a URL query parameters in javascript

To parse the URL query parameters in Javascript, we can use the URLSearchParams interface, which has some utility functions that allow us to easily parse/build URLs. Examples…

useNavigate may be used only in the context of a component

useNavigate may be used only in the context of a component

If you’ve ever faced the following error in React: useNavigate() may be used only in the context of a component This error throws in useNavigate hook.  This happens…

 How To Dynamically load a JavaScript file in React

How To Dynamically load a JavaScript file in React

Introduction Some use cases require loading a specific Javascript script conditionally, this article will demonstrate how to dynamically load a javascript file in React once a particular…

How to invalidate query after mutations in React-Query

How to invalidate query after mutations in React-Query

Introduction Query invalidation is an essential part while working with React-Query. Usually, when there is a mutation in the app, there are queries related, and when a…

Find last index of element inside array by certain condition

Find last index of element inside array by certain condition

In Javascript, the following snippet of code pass over an array of objects and does filter the array based on certain conditions, the output of this process…

Detect If Browser Tab Has Focus

Detect If Browser Tab Has Focus In Javascript

There are a few options we can use in order to Detect If Browser Tab Has Focus In Javascript. Some of those options are: 1- Detect using…

How to handle multiple queries with React-Query

How to handle multiple queries with React-Query

A super cool feature of React Query is that we can execute multiple queries in the same component, whether these queries are dependent or independent of each…

No QueryClient set, use QueryClientProvider to set one

No QueryClient set, use QueryClientProvider to set one

When working with React-Query you might encounter the following error: No QueryClient set, use QueryClientProvider to set one, this source of this error might be one of…

how-to-get-days-in-a-month-using-javascript

Get the number of days in a month using JavaScript

Introduction There are a few options we can use to get the number of days in a month using JavaScript, let’s check the following examples to see…