Javascript Event Capturing Example
In this post, we will learn on javascript event capturing Event Capturing: Event capturing refers to the propagation of an event from the outermost element to the innermost element. the…
In this post, we will learn on javascript event capturing Event Capturing: Event capturing refers to the propagation of an event from the outermost element to the innermost element. the…
If you notice that the useEffect hook is running twice in your React component, it is usually due to the dependencies specified in the dependency array. Here are a few…
useEffect hook in different scenarios: Fetching Data from an API: import React, { useState, useEffect } from 'react'; const MyComponent = () => { const [data, setData] = useState(null); useEffect(()…
Here’s an example that demonstrates how to use the useEffect hook with a cleanup function: import React, { useState, useEffect } from 'react'; const MyComponent = () => { const…
React Hook Form provides many other features for form validation, custom validations, error handling, and more. You can explore the official documentation for more information on how to use React…
React Hooks introduce a different approach to managing component state and side effects in functional components. With Hooks, you no longer need to rely on class components and their lifecycle…
The React lifecycle can be divided into three main phases: Mounting, Updating, and Unmounting. Each phase consists of specific lifecycle methods that you can override in your components to define…
There are several ways to compare arrays in JavaScript. Here are some examples: Using JSON.stringify(): This method serializes the arrays into a string and then compares the strings. const array1…
In this post, we will see if array contains string or object in given array Using IndexOf Method: let arr = [{id: 1, name: "Jayaram"}, {id: 2, name: "Javasavvy"}, {id:…
In this post, we will see how to check if string contains substring Using IndexOf Method: let str = "Hello World"; let substring = "Hello"; if (str.indexOf(substring) !== -1) {…