SlideShare a Scribd company logo
1 of 25
React
The Dawn of Virtual DOM
What is React
A JAVASCRIPT LIBRARY FOR BUILDING USER INTERFACES
Main Features
• Just V of MVC
• Virtual DOM
• One Way Data Flow
Background of React
• Started by Facebook in 2013
• Motivation - building large applications with data that
changes over time.
• Over 40k+ Star on Github and 645 contributors
• You are in a good company
Source - https://github.com/facebook/react/wiki/Sites-Using-React
Lets Get started
The most important thing
Virtual DOM
To understand this We need to first see
Real DOM
The Reason for performance
Real DOM
Disadvantage
DOM manipulation APIs are slow
Surprisingly 😟
All the framework do this on every update
Enter the Dawn of Virtual DOM
React DOM Update Strategy
React’s Virtual DOM Strategy
On every update to component
• React Builds New Virtual DOM Subtree
• Diff with the actual DOM
• Computes minimal DOM mutation
• Batch executes updates
Benefits
Minimal DOM manipulation calls
Batch execution saves a lot of computation
Super Fast Performance
Getting started with React
React Terminology
React Elements
(Basic Building Block)
var root = React.createElement('div');
React.js Main React Library
react-dom.js
Supporting library to generate DOM
notation
Factories
(Called internally by React Element)
function createFactory(type) {
return React.createElement.bind(null, type);
}
React Nodes Tree of React Element
React Components
var MyComponent = React.createClass({
render: function() {
...
}
});
(Encapsulated React Elements)
(You will use this the most)
React Recommends Use of JSX
What is JSX
ped, object-oriented programming language designed to run on m
In short
Its just like Type script and transpiles into Plain Javascript
Without JSX
With JSX
Recommended Build Tool
Webpack
• Bundles JS using require.js
• Minification, Linting, Production Build
• Loaders system allows easy
extensibility
• Just like gulp but more powerful
• Lets us use ES6 and ES7 features
• React tags are transformed
automatically using babel-react-
presets module
Demo Time
Props
• Props are like parameter to functions
• They make component super re-usable
• Way to pass info from one component to other component
• Includes props type validation to ensure sanity of data
Demo
STATE
• Holds the current state of the component
• Update in the state variable updates the component
• getInitialState and setState method for updating state
value
Demo
Refs
• Used to keep reference to components
• If callback function is passed, then callback is executed just
after the component mounts with component as parameter
• Possible application includes animation, finding specific
node
Component Specification
• render -> Required method. Returns ReactElement
• getInitialState -> Not Required, If we require some
default state for component
• getDefaultProps -> Not Required. If we want to set
default value of prop.
• propTypes -> Not Required. Allows the prop type
validation
Demo
Component Lifecycle
• componentWillMount -> Invoked before the initial rendering of component
• componentWillReceiveProps -> Invoked before the component receives the props
(not on initial render)
• componentDidUpdate -> Invoked immediately after the update of comports are
flushed to DOM
• componentDidMount -> Invoked after initial rendering of the component (Used
for fetching data from server)
• componentWillUpdate -> Called before rendering.
• shouldComponentUpdate -> Must return true (or) false. Called when new state (or)
props are being received.
• componentWillUnmount -> Called before component is unmounted
Advantages
Declarative Nature
numbers = [1,2,3,4]
total = 0
for(i=0; i<numbers.length; i++)
{
total = total + numbers[i]
}
Implicit Declarative
numbers = [1,2,3,4]
numbers.reduce(
function(previousValue, currentValue) {
return previousValue + currentValue;
});
• componentWillMount()
• componentWillReceiveProps( {NextProps} )
• componentDidUpdate( {PreviousProps} , {PreviousState} )
• componentDidMount()
• componentWillUnmount()
• getInitialState
Example
Advantages
Composition
• Rather than building one big component, React
allows to focus building mini components to
compose one big component out of it.
• Highly reusable code
Synthetic events
• Only single event listener is binded per component
• Results in less memory usage and improvement in perform
Plain Javascript
• Directive
• digest cycle
• Transclude function
• $scope and $rootScope
• $scope.$apply
We have all suffered our way through
Not anymore
React is pure javascript
Less time learning and more time implementing
Best in class dev tool
react-devtools
Growing Eco system
React-router Axios - Promise library
Redux
React-Desktop React-Native
react-material
Source - https://github.com/enaqx/awesome-react#components
countless more …….
React-select
Thank You

More Related Content

What's hot

React Js Simplified
React Js SimplifiedReact Js Simplified
React Js SimplifiedSunil Yadav
 
React js programming concept
React js programming conceptReact js programming concept
React js programming conceptTariqul islam
 
Why and How to Use Virtual DOM
Why and How to Use Virtual DOMWhy and How to Use Virtual DOM
Why and How to Use Virtual DOMDaiwei Lu
 
What is component in reactjs
What is component in reactjsWhat is component in reactjs
What is component in reactjsmanojbkalla
 
React workshop presentation
React workshop presentationReact workshop presentation
React workshop presentationBojan Golubović
 
[Final] ReactJS presentation
[Final] ReactJS presentation[Final] ReactJS presentation
[Final] ReactJS presentation洪 鹏发
 
Introduction to React
Introduction to ReactIntroduction to React
Introduction to ReactRob Quick
 
React new features and intro to Hooks
React new features and intro to HooksReact new features and intro to Hooks
React new features and intro to HooksSoluto
 
Introduction to React JS for beginners
Introduction to React JS for beginners Introduction to React JS for beginners
Introduction to React JS for beginners Varun Raj
 
React state
React  stateReact  state
React stateDucat
 
React js - The Core Concepts
React js - The Core ConceptsReact js - The Core Concepts
React js - The Core ConceptsDivyang Bhambhani
 
Understanding react hooks
Understanding react hooksUnderstanding react hooks
Understanding react hooksSamundra khatri
 

What's hot (20)

React and redux
React and reduxReact and redux
React and redux
 
React JS - Introduction
React JS - IntroductionReact JS - Introduction
React JS - Introduction
 
React Js Simplified
React Js SimplifiedReact Js Simplified
React Js Simplified
 
React js programming concept
React js programming conceptReact js programming concept
React js programming concept
 
Intro to React
Intro to ReactIntro to React
Intro to React
 
Why and How to Use Virtual DOM
Why and How to Use Virtual DOMWhy and How to Use Virtual DOM
Why and How to Use Virtual DOM
 
What is component in reactjs
What is component in reactjsWhat is component in reactjs
What is component in reactjs
 
React js
React jsReact js
React js
 
React workshop presentation
React workshop presentationReact workshop presentation
React workshop presentation
 
[Final] ReactJS presentation
[Final] ReactJS presentation[Final] ReactJS presentation
[Final] ReactJS presentation
 
Introduction to React
Introduction to ReactIntroduction to React
Introduction to React
 
React workshop
React workshopReact workshop
React workshop
 
Learn react-js
Learn react-jsLearn react-js
Learn react-js
 
Its time to React.js
Its time to React.jsIts time to React.js
Its time to React.js
 
React new features and intro to Hooks
React new features and intro to HooksReact new features and intro to Hooks
React new features and intro to Hooks
 
Introduction to React JS for beginners
Introduction to React JS for beginners Introduction to React JS for beginners
Introduction to React JS for beginners
 
React state
React  stateReact  state
React state
 
React js - The Core Concepts
React js - The Core ConceptsReact js - The Core Concepts
React js - The Core Concepts
 
Reactjs
ReactjsReactjs
Reactjs
 
Understanding react hooks
Understanding react hooksUnderstanding react hooks
Understanding react hooks
 

Viewers also liked

React JS and why it's awesome
React JS and why it's awesomeReact JS and why it's awesome
React JS and why it's awesomeAndrew Hull
 
React for .net developers
React for .net developersReact for .net developers
React for .net developersmacsdickinson
 
CSS 讀書會 - 1 (Grid system)
CSS 讀書會 - 1 (Grid system)CSS 讀書會 - 1 (Grid system)
CSS 讀書會 - 1 (Grid system)Chih-cheng Wang
 
Styling Components with JavaScript: MelbCSS Edition
Styling Components with JavaScript: MelbCSS EditionStyling Components with JavaScript: MelbCSS Edition
Styling Components with JavaScript: MelbCSS Editionbensmithett
 
Javascript template & react js 初探
Javascript template & react js 初探Javascript template & react js 初探
Javascript template & react js 初探wantingj
 
Synchronizing application state using Virtual DOM trees
Synchronizing application state using Virtual DOM treesSynchronizing application state using Virtual DOM trees
Synchronizing application state using Virtual DOM treesJari Voutilainen
 
Introduction to React
Introduction to ReactIntroduction to React
Introduction to ReactYos Riady
 
Intro to Web Map APIs
Intro to Web Map APIsIntro to Web Map APIs
Intro to Web Map APIsYos Riady
 
Digitaalisesti vaikuttavaksi. @HelsinkiUniUX -projektin tarina
Digitaalisesti vaikuttavaksi. @HelsinkiUniUX  -projektin tarina Digitaalisesti vaikuttavaksi. @HelsinkiUniUX  -projektin tarina
Digitaalisesti vaikuttavaksi. @HelsinkiUniUX -projektin tarina University of Helsinki
 
ReactNativeを語る勉強会
ReactNativeを語る勉強会ReactNativeを語る勉強会
ReactNativeを語る勉強会yohei sugigami
 
From Back to Front: Rails To React Family
From Back to Front: Rails To React FamilyFrom Back to Front: Rails To React Family
From Back to Front: Rails To React FamilyKhor SoonHin
 
Webpack & React Performance in 16+ Steps
Webpack & React Performance in 16+ StepsWebpack & React Performance in 16+ Steps
Webpack & React Performance in 16+ StepsGrgur Grisogono
 
An introduction to React.js
An introduction to React.jsAn introduction to React.js
An introduction to React.jsEmanuele DelBono
 
React Native - Workshop
React Native - WorkshopReact Native - Workshop
React Native - WorkshopFellipe Chagas
 
Introduction to ReactJS
Introduction to ReactJSIntroduction to ReactJS
Introduction to ReactJSHoang Long
 

Viewers also liked (20)

React JS and why it's awesome
React JS and why it's awesomeReact JS and why it's awesome
React JS and why it's awesome
 
React for .net developers
React for .net developersReact for .net developers
React for .net developers
 
CSS 讀書會 - 1 (Grid system)
CSS 讀書會 - 1 (Grid system)CSS 讀書會 - 1 (Grid system)
CSS 讀書會 - 1 (Grid system)
 
Styling Components with JavaScript: MelbCSS Edition
Styling Components with JavaScript: MelbCSS EditionStyling Components with JavaScript: MelbCSS Edition
Styling Components with JavaScript: MelbCSS Edition
 
Javascript template & react js 初探
Javascript template & react js 初探Javascript template & react js 初探
Javascript template & react js 初探
 
React entry
React entryReact entry
React entry
 
Synchronizing application state using Virtual DOM trees
Synchronizing application state using Virtual DOM treesSynchronizing application state using Virtual DOM trees
Synchronizing application state using Virtual DOM trees
 
Repaint & reflow
Repaint & reflowRepaint & reflow
Repaint & reflow
 
Introduction to React
Introduction to ReactIntroduction to React
Introduction to React
 
Intro to Web Map APIs
Intro to Web Map APIsIntro to Web Map APIs
Intro to Web Map APIs
 
Digitaalisesti vaikuttavaksi. @HelsinkiUniUX -projektin tarina
Digitaalisesti vaikuttavaksi. @HelsinkiUniUX  -projektin tarina Digitaalisesti vaikuttavaksi. @HelsinkiUniUX  -projektin tarina
Digitaalisesti vaikuttavaksi. @HelsinkiUniUX -projektin tarina
 
Introduction to React
Introduction to ReactIntroduction to React
Introduction to React
 
ReactNativeを語る勉強会
ReactNativeを語る勉強会ReactNativeを語る勉強会
ReactNativeを語る勉強会
 
Pjax 深入淺出
Pjax 深入淺出Pjax 深入淺出
Pjax 深入淺出
 
React
ReactReact
React
 
From Back to Front: Rails To React Family
From Back to Front: Rails To React FamilyFrom Back to Front: Rails To React Family
From Back to Front: Rails To React Family
 
Webpack & React Performance in 16+ Steps
Webpack & React Performance in 16+ StepsWebpack & React Performance in 16+ Steps
Webpack & React Performance in 16+ Steps
 
An introduction to React.js
An introduction to React.jsAn introduction to React.js
An introduction to React.js
 
React Native - Workshop
React Native - WorkshopReact Native - Workshop
React Native - Workshop
 
Introduction to ReactJS
Introduction to ReactJSIntroduction to ReactJS
Introduction to ReactJS
 

Similar to React.js - The Dawn of Virtual DOM

React and Flux life cycle with JSX, React Router and Jest Unit Testing
React and  Flux life cycle with JSX, React Router and Jest Unit TestingReact and  Flux life cycle with JSX, React Router and Jest Unit Testing
React and Flux life cycle with JSX, React Router and Jest Unit TestingEswara Kumar Palakollu
 
Optimizing your use of react life cycles by shedrack akintayo
Optimizing your use of react life cycles by shedrack akintayoOptimizing your use of react life cycles by shedrack akintayo
Optimizing your use of react life cycles by shedrack akintayoShedrack Akintayo
 
Understanding Facebook's React.js
Understanding Facebook's React.jsUnderstanding Facebook's React.js
Understanding Facebook's React.jsFederico Torre
 
Continuous Integration on AWS
Continuous Integration on AWSContinuous Integration on AWS
Continuous Integration on AWSPetar Petrov
 
Introduction to React, Flux, and Isomorphic Apps
Introduction to React, Flux, and Isomorphic AppsIntroduction to React, Flux, and Isomorphic Apps
Introduction to React, Flux, and Isomorphic AppsFederico Torre
 
React state management with Redux and MobX
React state management with Redux and MobXReact state management with Redux and MobX
React state management with Redux and MobXDarko Kukovec
 
Angular Application Testing
Angular Application TestingAngular Application Testing
Angular Application TestingTroy Miles
 
From MEAN to the MERN Stack
From MEAN to the MERN StackFrom MEAN to the MERN Stack
From MEAN to the MERN StackTroy Miles
 
Building High-Performance Force.com Applications in React
Building High-Performance Force.com Applications in ReactBuilding High-Performance Force.com Applications in React
Building High-Performance Force.com Applications in ReactSalesforce Developers
 
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
 
Web Performance & Latest in React
Web Performance & Latest in ReactWeb Performance & Latest in React
Web Performance & Latest in ReactTalentica Software
 
Introduction to React
Introduction to ReactIntroduction to React
Introduction to ReactAustin Garrod
 
React && React Native workshop
React && React Native workshopReact && React Native workshop
React && React Native workshopStacy Goh
 
Bundle deployment at state machine level - Ales Justin, JBoss
Bundle deployment at state machine level - Ales Justin, JBossBundle deployment at state machine level - Ales Justin, JBoss
Bundle deployment at state machine level - Ales Justin, JBossmfrancis
 
20171108 PDN HOL React Basics
20171108 PDN HOL React Basics20171108 PDN HOL React Basics
20171108 PDN HOL React BasicsRich Ross
 
Introduction to React native
Introduction to React nativeIntroduction to React native
Introduction to React nativeDhaval Barot
 

Similar to React.js - The Dawn of Virtual DOM (20)

React and Flux life cycle with JSX, React Router and Jest Unit Testing
React and  Flux life cycle with JSX, React Router and Jest Unit TestingReact and  Flux life cycle with JSX, React Router and Jest Unit Testing
React and Flux life cycle with JSX, React Router and Jest Unit Testing
 
Optimizing your use of react life cycles by shedrack akintayo
Optimizing your use of react life cycles by shedrack akintayoOptimizing your use of react life cycles by shedrack akintayo
Optimizing your use of react life cycles by shedrack akintayo
 
React Native Firebase
React Native FirebaseReact Native Firebase
React Native Firebase
 
Understanding Facebook's React.js
Understanding Facebook's React.jsUnderstanding Facebook's React.js
Understanding Facebook's React.js
 
Continuous Integration on AWS
Continuous Integration on AWSContinuous Integration on AWS
Continuous Integration on AWS
 
Introduction to React, Flux, and Isomorphic Apps
Introduction to React, Flux, and Isomorphic AppsIntroduction to React, Flux, and Isomorphic Apps
Introduction to React, Flux, and Isomorphic Apps
 
React state management with Redux and MobX
React state management with Redux and MobXReact state management with Redux and MobX
React state management with Redux and MobX
 
Angular Application Testing
Angular Application TestingAngular Application Testing
Angular Application Testing
 
From MEAN to the MERN Stack
From MEAN to the MERN StackFrom MEAN to the MERN Stack
From MEAN to the MERN Stack
 
Building High-Performance Force.com Applications in React
Building High-Performance Force.com Applications in ReactBuilding High-Performance Force.com Applications in React
Building High-Performance Force.com Applications in React
 
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...
 
Web Performance & Latest in React
Web Performance & Latest in ReactWeb Performance & Latest in React
Web Performance & Latest in React
 
Introduction to React
Introduction to ReactIntroduction to React
Introduction to React
 
React && React Native workshop
React && React Native workshopReact && React Native workshop
React && React Native workshop
 
Bundle deployment at state machine level - Ales Justin, JBoss
Bundle deployment at state machine level - Ales Justin, JBossBundle deployment at state machine level - Ales Justin, JBoss
Bundle deployment at state machine level - Ales Justin, JBoss
 
React JS
React JSReact JS
React JS
 
ReactJS
ReactJSReactJS
ReactJS
 
20171108 PDN HOL React Basics
20171108 PDN HOL React Basics20171108 PDN HOL React Basics
20171108 PDN HOL React Basics
 
React.js+Redux Workshops
React.js+Redux WorkshopsReact.js+Redux Workshops
React.js+Redux Workshops
 
Introduction to React native
Introduction to React nativeIntroduction to React native
Introduction to React native
 

Recently uploaded

W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 

Recently uploaded (20)

W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 

React.js - The Dawn of Virtual DOM

  • 1. React The Dawn of Virtual DOM
  • 2. What is React A JAVASCRIPT LIBRARY FOR BUILDING USER INTERFACES Main Features • Just V of MVC • Virtual DOM • One Way Data Flow
  • 3. Background of React • Started by Facebook in 2013 • Motivation - building large applications with data that changes over time. • Over 40k+ Star on Github and 645 contributors • You are in a good company Source - https://github.com/facebook/react/wiki/Sites-Using-React
  • 4. Lets Get started The most important thing Virtual DOM To understand this We need to first see Real DOM The Reason for performance
  • 5. Real DOM Disadvantage DOM manipulation APIs are slow Surprisingly 😟 All the framework do this on every update
  • 6. Enter the Dawn of Virtual DOM React DOM Update Strategy
  • 7. React’s Virtual DOM Strategy On every update to component • React Builds New Virtual DOM Subtree • Diff with the actual DOM • Computes minimal DOM mutation • Batch executes updates
  • 8. Benefits Minimal DOM manipulation calls Batch execution saves a lot of computation Super Fast Performance
  • 9.
  • 10. Getting started with React React Terminology React Elements (Basic Building Block) var root = React.createElement('div'); React.js Main React Library react-dom.js Supporting library to generate DOM notation Factories (Called internally by React Element) function createFactory(type) { return React.createElement.bind(null, type); } React Nodes Tree of React Element React Components var MyComponent = React.createClass({ render: function() { ... } }); (Encapsulated React Elements) (You will use this the most)
  • 11. React Recommends Use of JSX What is JSX ped, object-oriented programming language designed to run on m In short Its just like Type script and transpiles into Plain Javascript Without JSX With JSX
  • 12. Recommended Build Tool Webpack • Bundles JS using require.js • Minification, Linting, Production Build • Loaders system allows easy extensibility • Just like gulp but more powerful • Lets us use ES6 and ES7 features • React tags are transformed automatically using babel-react- presets module
  • 14. Props • Props are like parameter to functions • They make component super re-usable • Way to pass info from one component to other component • Includes props type validation to ensure sanity of data Demo
  • 15. STATE • Holds the current state of the component • Update in the state variable updates the component • getInitialState and setState method for updating state value Demo
  • 16. Refs • Used to keep reference to components • If callback function is passed, then callback is executed just after the component mounts with component as parameter • Possible application includes animation, finding specific node
  • 17. Component Specification • render -> Required method. Returns ReactElement • getInitialState -> Not Required, If we require some default state for component • getDefaultProps -> Not Required. If we want to set default value of prop. • propTypes -> Not Required. Allows the prop type validation Demo
  • 18. Component Lifecycle • componentWillMount -> Invoked before the initial rendering of component • componentWillReceiveProps -> Invoked before the component receives the props (not on initial render) • componentDidUpdate -> Invoked immediately after the update of comports are flushed to DOM • componentDidMount -> Invoked after initial rendering of the component (Used for fetching data from server) • componentWillUpdate -> Called before rendering. • shouldComponentUpdate -> Must return true (or) false. Called when new state (or) props are being received. • componentWillUnmount -> Called before component is unmounted
  • 19. Advantages Declarative Nature numbers = [1,2,3,4] total = 0 for(i=0; i<numbers.length; i++) { total = total + numbers[i] } Implicit Declarative numbers = [1,2,3,4] numbers.reduce( function(previousValue, currentValue) { return previousValue + currentValue; }); • componentWillMount() • componentWillReceiveProps( {NextProps} ) • componentDidUpdate( {PreviousProps} , {PreviousState} ) • componentDidMount() • componentWillUnmount() • getInitialState Example
  • 20. Advantages Composition • Rather than building one big component, React allows to focus building mini components to compose one big component out of it. • Highly reusable code
  • 21. Synthetic events • Only single event listener is binded per component • Results in less memory usage and improvement in perform
  • 22. Plain Javascript • Directive • digest cycle • Transclude function • $scope and $rootScope • $scope.$apply We have all suffered our way through Not anymore React is pure javascript Less time learning and more time implementing
  • 23. Best in class dev tool react-devtools
  • 24. Growing Eco system React-router Axios - Promise library Redux React-Desktop React-Native react-material Source - https://github.com/enaqx/awesome-react#components countless more ……. React-select