SlideShare a Scribd company logo
Introduction to React JS
• ReactJS is a declarative, efficient, and flexible JavaScript
library for building reusable UI components
• It is an open-source, component-based front end library which is
responsible only for the view layer of the application.
• Most people think it as a Framework But it is just a library
developed by Facebook to solve some problems that we were facing
earlier
• React was created by Jordan Walke, a software engineer at Meta, who
released an early prototype of React called "FaxJS“. It was first deployed on
Facebook's News Feed in 2011 and later on Instagram in 2012. It was open-
INTRODUCTION
React Features
•JSX: -- JSX stands for JavaScript XML. It is a JavaScript syntax extension. Its an XML or HTML like
syntax used by ReactJS
•Components:- ReactJS is all about components. ReactJS application is made up of multiple
components, and each component has its own logic and controls. These components can be reusable
which help you to maintain the code when working on larger scale projects.
•One-way Data Binding:- ReactJS is designed in such a manner that follows unidirectional data flow
or one-way data binding. The benefits of one-way data binding give you better control throughout the
application
•Virtual DOM:- A virtual DOM object is a representation of the original DOM object. It works like a one-
way data binding. Whenever any modifications happen in the web application, the entire UI is re-
rendered in virtual DOM representation. Then it checks the difference between the previous DOM
representation and new DOM. Once it has done, the real DOM will update only the things that have
actually changed. This makes the application faster, and there is no wastage of memory.
Virtual Dom
DOM: DOM stands for ‘Document Object Model’. In simple terms, it is a structured representation of the HTML elements that
are present in a webpage or web-app. DOM represents the entire UI of your application. The DOM is represented as a tree data
structure. It contains a node for each UI element present in the web document.
Updating DOM: We Make use of ‘getElementById()’ or ‘getElementsByClassName()’ methods to modify the content of
DOM. Every time there is a change in the state of your application, the DOM gets updated to reflect that change in the
UI. Like this each time there is a component update, the DOM needs to be updated and the UI components have to be re-
rendered.
Virtual DOM: React uses Virtual DOM exists which is like a lightweight copy of the actual DOM(a virtual
representation of the DOM). So for every object that exists in the original DOM, there is an object for that in
React Virtual DOM. It is exactly the same, but it does not have the power to directly change the layout of the
document. Manipulating DOM is slow, but manipulating Virtual DOM is fast as nothing gets drawn on the
screen. So each time there is a change in the state of our application, the virtual DOM gets updated first
instead of the real DOM.
How Virtual DOM actually Works?:When anything new is added to the application, a virtual DOM is created
and it is represented as a tree. Each element in the application is a node in this tree. So, whenever there is a
change in the state of any element, a new Virtual DOM tree is created. This new Virtual DOM tree is then
compared with the previous Virtual DOM tree and make a note of the changes. After this, it finds the best
possible ways to make these changes to the real DOM. Now only the updated elements will get rendered on
the page again.
Advantage of ReactJS
1. Easy to Learn and Use
2. Creating Dynamic Web Applications Becomes Easier
3. Reusable Components
4. Performance Enhancement
5.Excellent cross-platform support.
Environment Setup
• Install Node js Latest Version
• Install Gitbash Latest Version (It Acts Like a Linux Terminal )
• Install Vs Code code Editor
• To Create a new React App type the Command
• npx create-react-app
Components
Components are independent and reusable bits of code. They serve the same
purpose as JavaScript functions, but work in isolation and return HTML.
every application you will develop in React will be made up of pieces called
components. Components make the task of building UIs much easier.
UI broken down into multiple individual pieces called components and work on
them independently and merge them all in a parent component which will be your
final UI.
In React, we mainly have two types of components:
• Functional
Components:
• Functional components
are simply JavaScript
functions. We can
create a functional
component in React by
writing a JavaScript
function.
• Syntax:
• const Democomponent=()=>
• {
• return (
• <h1>Hello World </h1>);
• }
Functional Component
In React, we mainly have two types of components:
• Class Components:
• The class components are
a little more complex than
the functional
components. The
functional components
are not aware of the other
components in your
program whereas the
class components can
work with each other. We
can pass data from one
class component to other
class components.
• Syntax:
class Democomponent extends
React.Component
{ render(){
return <h1>Helloh1>;
}
}
Functional Component
Diff between functional & Class Component
• Functional Component
• Simple functions
• Solution without using logic
• Mainly Responsible for UI
• Stateless/Presentational
• Class Component
• More features
• Maintain their Own private Data
• Stateful
• More Complex Logc
State vs Props
• Props
• Props get Passed to the
Component
• Props are immutable
• Props---functional
• This.propsClass Comp
• State
• State is Managed within the
Component
• Variables declared in Functional
Body
• Use StateHook---Functional
• This.state-Class
Destructuring of Props
• Destructuring is a characteristic of JavaScript, It is used to take out
sections of data from an array or objects, We can assign them to new
own variables created by the developer.
• In destructuring, It does not change an array or any object, it makes a
copy of the desired object or array element by assigning them in its
own new variables, later we can use this new variable in React (class
or functional) components.
• It makes the code more clear. When we access the props
using this keyword, we have to use this/ this.props throughout the
program, but by the use of restructuring, we can discard this/
this.props by assigning them in new variables.
• This is very difficult to monitor props in complex applications, so by
assigning these props in new own variables we can make a code
more readable.
Conditional
Rendering
Your components will often need to display different things depending on different
conditions.
In React, you can conditionally render JSX using JavaScript syntax like
if statements, &&, and ? : operators.
Ad

More Related Content

Similar to Introduction to ReactJS UI Web Dev .pptx (20)

Getting started with react &amp; redux
Getting started with react &amp; reduxGetting started with react &amp; redux
Getting started with react &amp; redux
Girish Talekar
 
React.js vs node.js
React.js vs node.jsReact.js vs node.js
React.js vs node.js
Metricoid Technology
 
REACTJS.pdf
REACTJS.pdfREACTJS.pdf
REACTJS.pdf
ArthyR3
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
Karmanjay Verma
 
React JS - A quick introduction tutorial
React JS - A quick introduction tutorialReact JS - A quick introduction tutorial
React JS - A quick introduction tutorial
Mohammed Fazuluddin
 
Getting Started with React, When You’re an Angular Developer
Getting Started with React, When You’re an Angular DeveloperGetting Started with React, When You’re an Angular Developer
Getting Started with React, When You’re an Angular Developer
Fabrit Global
 
Techpaathshala ReactJS .pdf
Techpaathshala ReactJS .pdfTechpaathshala ReactJS .pdf
Techpaathshala ReactJS .pdf
Techpaathshala
 
JOSA TechTalks - Better Web Apps with React and Redux
JOSA TechTalks - Better Web Apps with React and ReduxJOSA TechTalks - Better Web Apps with React and Redux
JOSA TechTalks - Better Web Apps with React and Redux
Jordan Open Source Association
 
React DOM/Virtual DOM
React DOM/Virtual DOMReact DOM/Virtual DOM
React DOM/Virtual DOM
RajasreePothula3
 
Copy of React_JS_Notes.pdf
Copy of React_JS_Notes.pdfCopy of React_JS_Notes.pdf
Copy of React_JS_Notes.pdf
suryanarayana272799
 
Presentation1
Presentation1Presentation1
Presentation1
Kshitiz Rimal
 
Fundamental concepts of react js
Fundamental concepts of react jsFundamental concepts of react js
Fundamental concepts of react js
StephieJohn
 
Better web apps with React and Redux
Better web apps with React and ReduxBetter web apps with React and Redux
Better web apps with React and Redux
Ali Sa'o
 
React JS Interview Question & Answer
React JS Interview Question & AnswerReact JS Interview Question & Answer
React JS Interview Question & Answer
Mildain Solutions
 
REACTJS1.ppsx
REACTJS1.ppsxREACTJS1.ppsx
REACTJS1.ppsx
IshwarSingh501217
 
Introduction to React JS
Introduction to React JSIntroduction to React JS
Introduction to React JS
Arnold Asllani
 
React ppt
React pptReact ppt
React ppt
Naresh Thamizharasan
 
Tech Talk on ReactJS
Tech Talk on ReactJSTech Talk on ReactJS
Tech Talk on ReactJS
Atlogys Technical Consulting
 
The following features are associated with reacting to lifecycle methods.
The following features are associated with reacting to lifecycle methods.The following features are associated with reacting to lifecycle methods.
The following features are associated with reacting to lifecycle methods.
Wikiance
 
Welcome to React & Flux !
Welcome to React & Flux !Welcome to React & Flux !
Welcome to React & Flux !
Ritesh Kumar
 
Getting started with react &amp; redux
Getting started with react &amp; reduxGetting started with react &amp; redux
Getting started with react &amp; redux
Girish Talekar
 
REACTJS.pdf
REACTJS.pdfREACTJS.pdf
REACTJS.pdf
ArthyR3
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
Karmanjay Verma
 
React JS - A quick introduction tutorial
React JS - A quick introduction tutorialReact JS - A quick introduction tutorial
React JS - A quick introduction tutorial
Mohammed Fazuluddin
 
Getting Started with React, When You’re an Angular Developer
Getting Started with React, When You’re an Angular DeveloperGetting Started with React, When You’re an Angular Developer
Getting Started with React, When You’re an Angular Developer
Fabrit Global
 
Techpaathshala ReactJS .pdf
Techpaathshala ReactJS .pdfTechpaathshala ReactJS .pdf
Techpaathshala ReactJS .pdf
Techpaathshala
 
Fundamental concepts of react js
Fundamental concepts of react jsFundamental concepts of react js
Fundamental concepts of react js
StephieJohn
 
Better web apps with React and Redux
Better web apps with React and ReduxBetter web apps with React and Redux
Better web apps with React and Redux
Ali Sa'o
 
React JS Interview Question & Answer
React JS Interview Question & AnswerReact JS Interview Question & Answer
React JS Interview Question & Answer
Mildain Solutions
 
Introduction to React JS
Introduction to React JSIntroduction to React JS
Introduction to React JS
Arnold Asllani
 
The following features are associated with reacting to lifecycle methods.
The following features are associated with reacting to lifecycle methods.The following features are associated with reacting to lifecycle methods.
The following features are associated with reacting to lifecycle methods.
Wikiance
 
Welcome to React & Flux !
Welcome to React & Flux !Welcome to React & Flux !
Welcome to React & Flux !
Ritesh Kumar
 

More from SHAIKIRFAN715544 (7)

Object oriented Programming in Python.pptx
Object oriented Programming in Python.pptxObject oriented Programming in Python.pptx
Object oriented Programming in Python.pptx
SHAIKIRFAN715544
 
uuserinterfacewebdevelopmentnewoneppt.pptx
uuserinterfacewebdevelopmentnewoneppt.pptxuuserinterfacewebdevelopmentnewoneppt.pptx
uuserinterfacewebdevelopmentnewoneppt.pptx
SHAIKIRFAN715544
 
ui2.pptx
ui2.pptxui2.pptx
ui2.pptx
SHAIKIRFAN715544
 
UI Web Development.pptx
UI Web Development.pptxUI Web Development.pptx
UI Web Development.pptx
SHAIKIRFAN715544
 
DEMO On PYTHON WEB Development.pptx
DEMO On PYTHON WEB Development.pptxDEMO On PYTHON WEB Development.pptx
DEMO On PYTHON WEB Development.pptx
SHAIKIRFAN715544
 
Introduction to React JS.pptx
Introduction to React JS.pptxIntroduction to React JS.pptx
Introduction to React JS.pptx
SHAIKIRFAN715544
 
packages.pptx
packages.pptxpackages.pptx
packages.pptx
SHAIKIRFAN715544
 
Object oriented Programming in Python.pptx
Object oriented Programming in Python.pptxObject oriented Programming in Python.pptx
Object oriented Programming in Python.pptx
SHAIKIRFAN715544
 
uuserinterfacewebdevelopmentnewoneppt.pptx
uuserinterfacewebdevelopmentnewoneppt.pptxuuserinterfacewebdevelopmentnewoneppt.pptx
uuserinterfacewebdevelopmentnewoneppt.pptx
SHAIKIRFAN715544
 
DEMO On PYTHON WEB Development.pptx
DEMO On PYTHON WEB Development.pptxDEMO On PYTHON WEB Development.pptx
DEMO On PYTHON WEB Development.pptx
SHAIKIRFAN715544
 
Introduction to React JS.pptx
Introduction to React JS.pptxIntroduction to React JS.pptx
Introduction to React JS.pptx
SHAIKIRFAN715544
 
Ad

Recently uploaded (20)

UiPath Agentic Automation: Community Developer Opportunities
UiPath Agentic Automation: Community Developer OpportunitiesUiPath Agentic Automation: Community Developer Opportunities
UiPath Agentic Automation: Community Developer Opportunities
DianaGray10
 
Cybersecurity Threat Vectors and Mitigation
Cybersecurity Threat Vectors and MitigationCybersecurity Threat Vectors and Mitigation
Cybersecurity Threat Vectors and Mitigation
VICTOR MAESTRE RAMIREZ
 
Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...
Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...
Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...
Mike Mingos
 
fennec fox optimization algorithm for optimal solution
fennec fox optimization algorithm for optimal solutionfennec fox optimization algorithm for optimal solution
fennec fox optimization algorithm for optimal solution
shallal2
 
Config 2025 presentation recap covering both days
Config 2025 presentation recap covering both daysConfig 2025 presentation recap covering both days
Config 2025 presentation recap covering both days
TrishAntoni1
 
Bepents tech services - a premier cybersecurity consulting firm
Bepents tech services - a premier cybersecurity consulting firmBepents tech services - a premier cybersecurity consulting firm
Bepents tech services - a premier cybersecurity consulting firm
Benard76
 
Does Pornify Allow NSFW? Everything You Should Know
Does Pornify Allow NSFW? Everything You Should KnowDoes Pornify Allow NSFW? Everything You Should Know
Does Pornify Allow NSFW? Everything You Should Know
Pornify CC
 
Slack like a pro: strategies for 10x engineering teams
Slack like a pro: strategies for 10x engineering teamsSlack like a pro: strategies for 10x engineering teams
Slack like a pro: strategies for 10x engineering teams
Nacho Cougil
 
Jignesh Shah - The Innovator and Czar of Exchanges
Jignesh Shah - The Innovator and Czar of ExchangesJignesh Shah - The Innovator and Czar of Exchanges
Jignesh Shah - The Innovator and Czar of Exchanges
Jignesh Shah Innovator
 
Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...
Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...
Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...
Raffi Khatchadourian
 
Zilliz Cloud Monthly Technical Review: May 2025
Zilliz Cloud Monthly Technical Review: May 2025Zilliz Cloud Monthly Technical Review: May 2025
Zilliz Cloud Monthly Technical Review: May 2025
Zilliz
 
Q1 2025 Dropbox Earnings and Investor Presentation
Q1 2025 Dropbox Earnings and Investor PresentationQ1 2025 Dropbox Earnings and Investor Presentation
Q1 2025 Dropbox Earnings and Investor Presentation
Dropbox
 
Smart Investments Leveraging Agentic AI for Real Estate Success.pptx
Smart Investments Leveraging Agentic AI for Real Estate Success.pptxSmart Investments Leveraging Agentic AI for Real Estate Success.pptx
Smart Investments Leveraging Agentic AI for Real Estate Success.pptx
Seasia Infotech
 
Com fer un pla de gestió de dades amb l'eiNa DMP (en anglès)
Com fer un pla de gestió de dades amb l'eiNa DMP (en anglès)Com fer un pla de gestió de dades amb l'eiNa DMP (en anglès)
Com fer un pla de gestió de dades amb l'eiNa DMP (en anglès)
CSUC - Consorci de Serveis Universitaris de Catalunya
 
Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Kit-Works Team Study_아직도 Dockefile.pdf_김성호Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Wonjun Hwang
 
DevOpsDays SLC - Platform Engineers are Product Managers.pptx
DevOpsDays SLC - Platform Engineers are Product Managers.pptxDevOpsDays SLC - Platform Engineers are Product Managers.pptx
DevOpsDays SLC - Platform Engineers are Product Managers.pptx
Justin Reock
 
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
Ivano Malavolta
 
Canadian book publishing: Insights from the latest salary survey - Tech Forum...
Canadian book publishing: Insights from the latest salary survey - Tech Forum...Canadian book publishing: Insights from the latest salary survey - Tech Forum...
Canadian book publishing: Insights from the latest salary survey - Tech Forum...
BookNet Canada
 
UiPath Agentic Automation: Community Developer Opportunities
UiPath Agentic Automation: Community Developer OpportunitiesUiPath Agentic Automation: Community Developer Opportunities
UiPath Agentic Automation: Community Developer Opportunities
DianaGray10
 
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdfKit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Wonjun Hwang
 
UiPath Agentic Automation: Community Developer Opportunities
UiPath Agentic Automation: Community Developer OpportunitiesUiPath Agentic Automation: Community Developer Opportunities
UiPath Agentic Automation: Community Developer Opportunities
DianaGray10
 
Cybersecurity Threat Vectors and Mitigation
Cybersecurity Threat Vectors and MitigationCybersecurity Threat Vectors and Mitigation
Cybersecurity Threat Vectors and Mitigation
VICTOR MAESTRE RAMIREZ
 
Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...
Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...
Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...
Mike Mingos
 
fennec fox optimization algorithm for optimal solution
fennec fox optimization algorithm for optimal solutionfennec fox optimization algorithm for optimal solution
fennec fox optimization algorithm for optimal solution
shallal2
 
Config 2025 presentation recap covering both days
Config 2025 presentation recap covering both daysConfig 2025 presentation recap covering both days
Config 2025 presentation recap covering both days
TrishAntoni1
 
Bepents tech services - a premier cybersecurity consulting firm
Bepents tech services - a premier cybersecurity consulting firmBepents tech services - a premier cybersecurity consulting firm
Bepents tech services - a premier cybersecurity consulting firm
Benard76
 
Does Pornify Allow NSFW? Everything You Should Know
Does Pornify Allow NSFW? Everything You Should KnowDoes Pornify Allow NSFW? Everything You Should Know
Does Pornify Allow NSFW? Everything You Should Know
Pornify CC
 
Slack like a pro: strategies for 10x engineering teams
Slack like a pro: strategies for 10x engineering teamsSlack like a pro: strategies for 10x engineering teams
Slack like a pro: strategies for 10x engineering teams
Nacho Cougil
 
Jignesh Shah - The Innovator and Czar of Exchanges
Jignesh Shah - The Innovator and Czar of ExchangesJignesh Shah - The Innovator and Czar of Exchanges
Jignesh Shah - The Innovator and Czar of Exchanges
Jignesh Shah Innovator
 
Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...
Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...
Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...
Raffi Khatchadourian
 
Zilliz Cloud Monthly Technical Review: May 2025
Zilliz Cloud Monthly Technical Review: May 2025Zilliz Cloud Monthly Technical Review: May 2025
Zilliz Cloud Monthly Technical Review: May 2025
Zilliz
 
Q1 2025 Dropbox Earnings and Investor Presentation
Q1 2025 Dropbox Earnings and Investor PresentationQ1 2025 Dropbox Earnings and Investor Presentation
Q1 2025 Dropbox Earnings and Investor Presentation
Dropbox
 
Smart Investments Leveraging Agentic AI for Real Estate Success.pptx
Smart Investments Leveraging Agentic AI for Real Estate Success.pptxSmart Investments Leveraging Agentic AI for Real Estate Success.pptx
Smart Investments Leveraging Agentic AI for Real Estate Success.pptx
Seasia Infotech
 
Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Kit-Works Team Study_아직도 Dockefile.pdf_김성호Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Wonjun Hwang
 
DevOpsDays SLC - Platform Engineers are Product Managers.pptx
DevOpsDays SLC - Platform Engineers are Product Managers.pptxDevOpsDays SLC - Platform Engineers are Product Managers.pptx
DevOpsDays SLC - Platform Engineers are Product Managers.pptx
Justin Reock
 
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
Ivano Malavolta
 
Canadian book publishing: Insights from the latest salary survey - Tech Forum...
Canadian book publishing: Insights from the latest salary survey - Tech Forum...Canadian book publishing: Insights from the latest salary survey - Tech Forum...
Canadian book publishing: Insights from the latest salary survey - Tech Forum...
BookNet Canada
 
UiPath Agentic Automation: Community Developer Opportunities
UiPath Agentic Automation: Community Developer OpportunitiesUiPath Agentic Automation: Community Developer Opportunities
UiPath Agentic Automation: Community Developer Opportunities
DianaGray10
 
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdfKit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Wonjun Hwang
 
Ad

Introduction to ReactJS UI Web Dev .pptx

  • 2. • ReactJS is a declarative, efficient, and flexible JavaScript library for building reusable UI components • It is an open-source, component-based front end library which is responsible only for the view layer of the application. • Most people think it as a Framework But it is just a library developed by Facebook to solve some problems that we were facing earlier • React was created by Jordan Walke, a software engineer at Meta, who released an early prototype of React called "FaxJS“. It was first deployed on Facebook's News Feed in 2011 and later on Instagram in 2012. It was open- INTRODUCTION
  • 3. React Features •JSX: -- JSX stands for JavaScript XML. It is a JavaScript syntax extension. Its an XML or HTML like syntax used by ReactJS •Components:- ReactJS is all about components. ReactJS application is made up of multiple components, and each component has its own logic and controls. These components can be reusable which help you to maintain the code when working on larger scale projects. •One-way Data Binding:- ReactJS is designed in such a manner that follows unidirectional data flow or one-way data binding. The benefits of one-way data binding give you better control throughout the application •Virtual DOM:- A virtual DOM object is a representation of the original DOM object. It works like a one- way data binding. Whenever any modifications happen in the web application, the entire UI is re- rendered in virtual DOM representation. Then it checks the difference between the previous DOM representation and new DOM. Once it has done, the real DOM will update only the things that have actually changed. This makes the application faster, and there is no wastage of memory.
  • 4. Virtual Dom DOM: DOM stands for ‘Document Object Model’. In simple terms, it is a structured representation of the HTML elements that are present in a webpage or web-app. DOM represents the entire UI of your application. The DOM is represented as a tree data structure. It contains a node for each UI element present in the web document. Updating DOM: We Make use of ‘getElementById()’ or ‘getElementsByClassName()’ methods to modify the content of DOM. Every time there is a change in the state of your application, the DOM gets updated to reflect that change in the UI. Like this each time there is a component update, the DOM needs to be updated and the UI components have to be re- rendered. Virtual DOM: React uses Virtual DOM exists which is like a lightweight copy of the actual DOM(a virtual representation of the DOM). So for every object that exists in the original DOM, there is an object for that in React Virtual DOM. It is exactly the same, but it does not have the power to directly change the layout of the document. Manipulating DOM is slow, but manipulating Virtual DOM is fast as nothing gets drawn on the screen. So each time there is a change in the state of our application, the virtual DOM gets updated first instead of the real DOM. How Virtual DOM actually Works?:When anything new is added to the application, a virtual DOM is created and it is represented as a tree. Each element in the application is a node in this tree. So, whenever there is a change in the state of any element, a new Virtual DOM tree is created. This new Virtual DOM tree is then compared with the previous Virtual DOM tree and make a note of the changes. After this, it finds the best possible ways to make these changes to the real DOM. Now only the updated elements will get rendered on the page again.
  • 5. Advantage of ReactJS 1. Easy to Learn and Use 2. Creating Dynamic Web Applications Becomes Easier 3. Reusable Components 4. Performance Enhancement 5.Excellent cross-platform support.
  • 6. Environment Setup • Install Node js Latest Version • Install Gitbash Latest Version (It Acts Like a Linux Terminal ) • Install Vs Code code Editor • To Create a new React App type the Command • npx create-react-app
  • 7. Components Components are independent and reusable bits of code. They serve the same purpose as JavaScript functions, but work in isolation and return HTML. every application you will develop in React will be made up of pieces called components. Components make the task of building UIs much easier. UI broken down into multiple individual pieces called components and work on them independently and merge them all in a parent component which will be your final UI.
  • 8. In React, we mainly have two types of components: • Functional Components: • Functional components are simply JavaScript functions. We can create a functional component in React by writing a JavaScript function. • Syntax: • const Democomponent=()=> • { • return ( • <h1>Hello World </h1>); • } Functional Component
  • 9. In React, we mainly have two types of components: • Class Components: • The class components are a little more complex than the functional components. The functional components are not aware of the other components in your program whereas the class components can work with each other. We can pass data from one class component to other class components. • Syntax: class Democomponent extends React.Component { render(){ return <h1>Helloh1>; } } Functional Component
  • 10. Diff between functional & Class Component • Functional Component • Simple functions • Solution without using logic • Mainly Responsible for UI • Stateless/Presentational • Class Component • More features • Maintain their Own private Data • Stateful • More Complex Logc
  • 11. State vs Props • Props • Props get Passed to the Component • Props are immutable • Props---functional • This.propsClass Comp • State • State is Managed within the Component • Variables declared in Functional Body • Use StateHook---Functional • This.state-Class
  • 12. Destructuring of Props • Destructuring is a characteristic of JavaScript, It is used to take out sections of data from an array or objects, We can assign them to new own variables created by the developer. • In destructuring, It does not change an array or any object, it makes a copy of the desired object or array element by assigning them in its own new variables, later we can use this new variable in React (class or functional) components. • It makes the code more clear. When we access the props using this keyword, we have to use this/ this.props throughout the program, but by the use of restructuring, we can discard this/ this.props by assigning them in new variables. • This is very difficult to monitor props in complex applications, so by assigning these props in new own variables we can make a code more readable.
  • 13. Conditional Rendering Your components will often need to display different things depending on different conditions. In React, you can conditionally render JSX using JavaScript syntax like if statements, &&, and ? : operators.
  翻译: