Form Handling in ReactJS

Rahul Bansal
Updated on 18-Mar-2021 10:41:14

611 Views

In this article, we are going to see how to handle the forms properly in a React application.Handling Forms is one of the most crucial parts needed while building a real-world React application. It is all about taking the inputs from the user, validating it and displaying if there are errors in the data submitted by the user.ExampleIn this example, we will build an Information Page that takes the information from the user, validates it and displays the result accordingly.Here, we have App.js as the parent component of the Details.js component.Details.jsimport React, { useState } from 'react'; const Details ... Read More

Debugging ReactJS Applications

Rahul Bansal
Updated on 18-Mar-2021 10:38:17

796 Views

While building a real-world application, the most important thing that a developer should know is how to properly debug the React application. There are many ways to debug our React application and some of the proven methods are explained below −Using Code LinterTools like ESLint help to write better and clean codes, as it follows proper guidelines which prevent errors at the time of developing the codes.Using React Developer ToolsThis tool comes very handy while debugging ReactJS applications, as it allows to navigate through the Component Tree and allows to take a look at the state or the props or ... Read More

Custom Hooks in ReactJS

Rahul Bansal
Updated on 18-Mar-2021 10:36:29

436 Views

In this article, we are going to learn how to define custom hooks in ReactJS.All the rules and usage guidelines are the same as that of the predefined ReactJS hooks like −Call Hooks at the Top LevelCall Hooks from React Functions onlyExampleIn this example, we will build an input validator application that will display some text based on the user-defined conditions in the custom hook.App.jsximport React from 'react'; import useForm from './CustomHook'; const App = () => {    const input = useForm();    return (                   {input.valid ? ... Read More

CSS Loader in ReactJS

Rahul Bansal
Updated on 18-Mar-2021 10:33:47

2K+ Views

In this article, we will learn how to provide dynamic class names to our React application.StepsNpm run ejectThis command will allow us to customize the configurations and the options that were predefined when we run the command of create-react-app. It is a one-sided operation that can’t be undone later on.Change Webpack configurationsWe need to configure the webpack loaders so as to enable css-loader which will then provide dynamic naming to our classes.Set the configurations as −{    test: /\.css$/,    loader: 'style-loader' }, {    test: /\.css$/,    loader: 'css-loader',    query: {       modules: true,     ... Read More

Context API in ReactJS

Rahul Bansal
Updated on 18-Mar-2021 10:33:01

1K+ Views

In this article, we are going to see how to access the data without passing it through every parent component in the class-based component.Context APIs are used to set the global data and this data can now be accessed in any of the children's components without the need to pass it through every parent component.ExampleSuppose there are three components namely, A, B and C. A is the parent component of B and B is the parent component of C. So, our component structure is as follows − A→B→C.We have defined some data in A and want to handle it in ... Read More

Conditional Rendering in ReactJS

Rahul Bansal
Updated on 18-Mar-2021 10:32:01

619 Views

In this article, we are going to see how to conditionally render a component based on some conditions in a React applicationIn ReactJS, we can render only the desired components based on certain given conditions by using the if-else statements or by using the logical && operator of JavaScript. When the provided condition is satisfied, then React will match the UI and update it accordingly.Using if-else conditionsExampleIn this example, we will build a React application that has an App component as a parent component which will conditionally re-render the Form component and update the UI accordingly.App.jsximport React, { useState } ... Read More

Remove Web Scripting Virus

PranavBhardwaj
Updated on 18-Mar-2021 10:25:27

2K+ Views

In order to provide advanced and high-quality content, some web developer uses complex codes on their websites. Video streaming sites mainly execute such advance codes. These codes help end-users to instruct web programs. However, if not correctly structured, the codes are vulnerable to cyber-attacks.Cybercriminals carry out the virus attacks on such websites by deploying malicious scripts, thereby disabling the web program or take control of it to carry out vicious tasks. Such types of malicious programs are known as Web Scripting Virus.In this guide, we would discuss more on Web Scripting Virus and how to remove them from your system.What ... Read More

Delete Desired Node from a Binary Search Tree in JavaScript

AmitDiwan
Updated on 18-Mar-2021 08:45:50

274 Views

ProblemSuppose, we have the following code that creates a Binary Search Tree DS and provides us with the functionality to insert node −class Node{    constructor(data) {       this.data = data;       this.left = null;       this.right = null;    }; }; class BinarySearchTree{    constructor(){       // root of a binary seach tree       this.root = null;    }    insert(data){       var newNode = new Node(data);       if(this.root === null){          this.root = newNode;       }else{       ... Read More

Uninstall PowerShell Module

Chirag Nagrekar
Updated on 18-Mar-2021 07:54:23

19K+ Views

To uninstall the PowerShell module, we can directly use the Uninstall-Module command but the module should not be in use, otherwise, it will throw an error.When we use the Uninstall-Module command, it can uninstall the module from the current user profile or from the all users profile.Uninstall-Module 7Zip4PowerShell -Force -VerboseAnother method, Get-InstalledModule 7Zip4Powershell | Uninstall-Module -Force -VerboseIf you have multiple versions of the same module installed in the PowerShell, and if you want to uninstall all of them then use the -AllVersions Parameter.Uninstall-Module 7Zip4PowerShell -AllVersions -Force -VerboseIf you want to uninstall the specific version, we can use -RequiredVersion.Uninstall-Module 7Zip4PowerShell -RequiredVersion ... Read More

What is Adware?

PranavBhardwaj
Updated on 18-Mar-2021 07:52:57

567 Views

If you are suddenly receiving random ads on your browser and system, it might be because of an Adware infection. This post will guide you on what is Adware, how do you get it, what are its symptoms, and how to protect your device from Adware.What is Adware?Adware is short for advertising-supported software. It is the extension or application responsible for ad displaying on your browser, applications, or system. Generally, Adware enters the system unintentionally, and therefore it comes under Potentially Unwanted Programs or PUP. Since it can conduct various malicious tasks after infiltrating your device, it is also one ... Read More

Advertisements