ReactJS
![ReactJS ReactJS](https://www.h2kinfosys.com/blog/wp-content/uploads/2024/05/ba-online-training-2024-05-08T104452.797.png)
ReactJs is a group or cloud even is a quiet efficient and also flexible JavaScript library for creating reusable UI Components. It will be an open source, component based face end library this is quiet common responsible just for the view layer of the software application. It was initially developed and maintained by Facebook and later used by products like whatsapp and also instagram.
What is the foremost goal of ReactJS is to develop the interface that improves the speed of apps. It uses virtual DOM which improves the performance of the app. It has the component and data patterns which progresses readability will manage the larger apps.
How to install ReactJS?
There are two ways to line up an environment for successful ReactJS application.
- Using the npm command
- Using the create-react-app command.
- Using the npm command:
How to install NodeJs and NPM?
NodeJS and NPM are platforms may develop any ReactJS application. We can install NodeJS and NPM package by the link given below.
To verify NodeJS and NPM use command shown within the below image
Install react and react DOM:
Create a root folder with the name reactApp on the desktop or where we like. We create it on the desktop. You create the folder directly or using the command given below as
You need to write the code for a package. json file. To create any module, it is important to return with a package .json file are available in project folder.
javatpoint@root:~/Desktop/reactApp> npm init -y After creating a package.json file,
You have to respond and its DOM packages will use frequent npm command the terminal window.
javatpoint@root:~/Desktop/reactApp>npm install react react-dom –save
The main features of ReactJS:
- JSX- This JSX is called as the JavaScript syntax extension. That is not necessary to use JSX in react development, but it’s suggested.
- Components- React is all about components. We’d highly value more to consider everything as component. The one which is facilitated your maintain the code working on larger scale projects.
- Unidirectional data flow and Flux-React accepts a particular way data flow which makes it easy to reason about your app. Flux is also a pattern that helps keeping your data unidirectional.
- License-React is licensed under the face book Inc. Documentation is licensed under CC By 4.0
The advantages:
- This uses virtual DOM which is JavaScript object. This will have a progress apps performance, since JavaScript virtual DOM is quicker than regular DOM.
- Can be used on client and server side like other frameworks.
- Components and data patterns will increase the quality of readability, which helps to need care of larger apps.
React Limitations:
- Covers only the view layer of app, actually still should choose other technologies to implement a whole complete tool set for development.
- Uses inline template and JSX which can be capable to seem awkward to some developers.
React Forms:
The forms are the important part of any modern web application. It always allows the users to interact with the given application as well gather information from any users. Forms can perform tasks that will depend on the nature of the business requirements and also logic like authentication of the user, adding user, searching, filtering, booking ordering. A form contains the fields, buttons, checkbox radio buttons.
Creating a form:
React provides stageful reactive approach to create a form. This component as DOM manages the react form. In React the form is implemented as it uses controlled components like:
1. Uncontrolled component
2. Controlled component
The uncontrolled component input will be similar as traditional HTML form of inputs. The DOM manages form data. The HTML elements maintain own state that can be updated when the input value will change.
The controlled Component the input from element will managed by the component than DOM. These component have functions which govern data passing them on every On Change event.
Question:
1. What is React JS?
2. What are the advantages and limitations of React Js?