Rahul Bansal has Published 50 Articles

Validate URL in ReactJS

Rahul Bansal

Rahul Bansal

Updated on 19-Mar-2021 11:15:50

In this article, we are going to see how to validate a URL (Uniform Resource Locator) in a React application.To validate a URL, we are going to install a third-party package of ‘validator’ which is used to validate the URL. Example of a valid and an invalid URL are as ... Read More

Using onKeyPress event in ReactJS

Rahul Bansal

Rahul Bansal

Updated on 19-Mar-2021 11:15:29

In this article, we are going to see how to access the keycode which the user has pressed in a React applicationTo detect the keycode or the key which the user has pressed from his keyboard then React has a predefined onKeyPress event for this. Although it is not fired for ... Read More

Suspense in ReactJS

Rahul Bansal

Rahul Bansal

Updated on 19-Mar-2021 11:15:05

In this article, we will learn how to show a loader while the component is being lazily loaded.When the components are lazily loaded, it requires a fallback to be shown to indicate that the component is being loaded in the DOM.SyntaxExampleIn this example, we will build a Routing application that ... Read More

Strict Mode in ReactJS

Rahul Bansal

Rahul Bansal

Updated on 19-Mar-2021 11:12:27

In this article, we are going to see how to highlight potential problems that we might have in a React Application.React.StrictMode is a helper functionality provided by React which allows us to write better React codes. It provides visual feedback in the form of warnings if we don’t follow the ... Read More

Sending Http Requests in ReactJS

Rahul Bansal

Rahul Bansal

Updated on 19-Mar-2021 11:08:51

In this article, we are going to learn how to send and receive Http Responses in a React application.To send or receive data, we don’t need to use third-party packages, rather we can use the fetch() method which is now supported by all the modern browsers.Sending GET requesthttps://jsonplaceholder.typicode.com/todos/1Jsonplaceholder is a ... Read More

RegEx in ReactJS

Rahul Bansal

Rahul Bansal

Updated on 19-Mar-2021 11:07:49

In this article, we are going to see how to handle the strings with RegEx handling in a React application.A RegEx or Regular Expression is a sequence of characters that forms a search pattern and is used to check if a string contains a specified search pattern or not. It ... Read More

ReactJS – useState hook

Rahul Bansal

Rahul Bansal

Updated on 19-Mar-2021 11:02:51

In this article, we are going to see how to use the useState hook in a functional component.State is the place where the data comes from. We should always try to make our state as simple as possible. With React 16.8, hooks are released which allow us to handle the ... Read More

ReactJS – useRef hook

Rahul Bansal

Rahul Bansal

Updated on 19-Mar-2021 11:00:49

In this article, we are going to see how to create a reference to any DOM element in a functional component.This hook is used to access any DOM element in a component and it returns a mutable ref object which will be persisted as long as the component is placed ... Read More

ReactJS – useReducer hook

Rahul Bansal

Rahul Bansal

Updated on 19-Mar-2021 10:58:54

This hook is a better alternative of the useState hook, as it is used when we want to attach a function along with handling the state or when we want to handle the state based on the previous values.Syntaxconst [state, dispatch] = useReducer(reducer, initialArgs, init);ParametersReducer − The function to handle ... Read More

ReactJS – useMemo hook

Rahul Bansal

Rahul Bansal

Updated on 19-Mar-2021 10:55:25

In this article, we are going to see how to optimize a React application by passing a memoized value.This hook is used to optimize the React application by returning a memoized value which helps to prevent doing the complex calculations on every re-rendering. This hook stores the cached value and ... Read More

Advertisements