Found 10710 Articles for Web Development

How to use Redux with React Native?

Mohit Panchasara
Updated on 10-Mar-2023 17:54:53

7K+ Views

Redux is a state-management library for JavaScript programs. It provides a central location to store all state information for an application and a predictable way to alter the state using actions and reducers. React Native is a framework for building native mobile applications using React. To utilize Redux with React Native, users must integrate the Redux store with their React Native components. To use Redux with ReactNative, we will follow some steps described in short, and later we will discuss the process more descriptively. First, install the Redux and React-Redux libraries. To construct a store, use the ... Read More

How to use Container Component in ReactJS?

Mohit Panchasara
Updated on 09-Mar-2023 13:34:20

3K+ Views

The container component creates a container on the web page like a box. Also, we can set the height of the container according to the height of the inside content. Furthermore, we can set the variable width for the Container component. Basically, we can use the Container to create a Rectangular box and add some HTML content inside that. Users should use the below command to install the Material UI in the React project. npm install @mui/material @emotion/react @emotion/styled Syntax Users can follow the syntax below to use the Cotnainer component of Material UI. ... Read More

How to use Checkboxes in ReactJS?

Mohit Panchasara
Updated on 09-Mar-2023 12:57:13

20K+ Views

The checkbox allows users to select multiple values in the form. Also, it is useful to take the Boolean response from the users. For example, an Instagram-like button is a kind of checkbox. When users like the post, it shows the filled icon; Otherwise, it shows the border icon. Here, we will learn to handle single and multiple checkboxes in ReactJS. First, we will create the custom checkboxes and then learn to use the checkbox component of Material UI. Create a Custom Checkbox Component in ReactJS We can use the normal HTML input to create a checkbox in ... Read More

How to upload file without form using JavaScript?

Mohit Panchasara
Updated on 09-Mar-2023 12:55:06

5K+ Views

Sometimes, developers may require to upload a file without using the form in JavaScript. Generally, we create a form to get the data and files from the users, but in this tutorial, we will learn to get the file from users without a form and send it to the backend. Use the FormData() object and Ajax Request The FormData object allows us to store the form data in the key value pair. We need to initialize the variable with a constructor. We can allow users to upload files using HTML input and store that file in form data. After ... Read More

How to uniquely identify computers visiting web site in JavaScript?

Mohit Panchasara
Updated on 09-Mar-2023 12:52:49

526 Views

Whenever we create any application or website, we require to identify computers visiting the website uniquely. There are a lot of benefits to uniquely identifying computers. For example, you are providing some services to your users. By uniquely identifying the computer, you can give free service for a trial purpose when a user visits your website for the first time from a new device. When a user visits again, you can ask users to buy premium or subscribe to your application. Here, we will use cookies to identify the computer visiting web site. What are cookies? The ... Read More

How to Understand Recursion in JavaScript?

Mohit Panchasara
Updated on 09-Mar-2023 12:49:13

147 Views

What is Recursion? The word recursion came from the recurring, meaning comes back to again and again. The recursion function is the function calling itself again and again by changing the input step by step. Here, changing the input by one step means decreasing or increasing the input by one step. Whenever a recursive function hits the base condition, it stops its execution of itself. Let’s understand what is the base condition by one example. For example, we need to find the factorial of a number. We call the factorial function by decreasing the input by 1, and we ... Read More

How to test a value x against predicate function and returns fn(x) or x in JavaScript?

Mohit Panchasara
Updated on 09-Mar-2023 12:45:01

63 Views

Testing the value x against the predicate function means checking if x is evaluated to be valid for a particular condition. If x is following the particular condition, we need to perform some operation on the x using any function named ‘fn’ and passing it as a function parameter. Otherwise, we need to return the value of x itself. Syntax Users can follow the syntax below to test a value x against the predicate function and return the fn(x) or x in JavaScript. let result = predicate(x) ? operation(x) : x; In the above syntax, we ... Read More

How to terminate a script in JavaScript?

Mohit Panchasara
Updated on 09-Mar-2023 12:32:39

12K+ Views

The termination of the script means that it stops executing the JavaScript code. In some emergency cases, developers requires to abort the execution of JavaScript code in the middle while the script is executing. Also, we can use the if-else statement to decide when to terminate the script execution and when to continue. Here, we will learn different ways to terminate the script midway. Use the Return Statement The return statement is used to terminate the execution of any code inside the script. Once we execute the return statement inside the function, the code written after the return statement ... Read More

How to stop event propagation with inline onclick attribute in JavaScript?

Mohit Panchasara
Updated on 09-Mar-2023 12:22:53

2K+ Views

Sometimes, we require adding the same events on the nested HTML elements. For example, we have two divs, one is parent div, and another is child div. Now, we need to add the onclick event on the parent div and child div and execute the different functions when users click on the parent div and child div. In this case, it will always execute the event on the parent div and child div. Let’s understand executing the same event on the nested HTML elements via the example below. Example In the example below, we have created the two ... Read More

Identifiers and Keywords in Typescript

Rushi Javiya
Updated on 07-Mar-2023 12:37:57

2K+ Views

In this tutorial, we'll learn about identifiers and keywords in TypeScript. Identifiers and keywords are two fundamental concepts in TypeScript, a statically-typed superset of JavaScript. Identifiers are names we give to variables, functions, classes, and other things in our code. Keywords are special words with specific meanings in TypeScript and can't be used as identifiers. Identifiers must follow certain rules in naming variables, functions, and classes to avoid syntax errors. On the other hand, using keywords as identifiers can lead to errors and make our code difficult to read and understand. Rules and Best Practices for Identifiers and ... Read More

Advertisements