SlideShare a Scribd company logo
1 of 21
Download to read offline
ReactJSPresented by Sajith Dilshan
First Project
$ npm install -g create-react-app
$ create-react-app hello-world
$ cd hello-world
$ npm start
Let’s see how it
really works
Components
import React, { Component } from 'react';
class App extends Component {
render() {
return (
<div className="App">
<h1> Hello World </h1>
</div>
);
}
}
export default App;
React JSXsyntactic-sugar for JS
const element =
(
<h1 className="greeting">
Hello, world!
</h1>
);
JSX Code
const element =
React.createElement(
'h1',
{className: 'greeting'},
'Hello, world!'
);
Compiled JS Code
• Template Language with full power of JS
• Prevents injection attacks
https://facebook.github.io/react/docs/introducing-jsx.html
more…
https://facebook.github.io/react/docs/jsx-in-depth.html
State vs.Props
•STATE - Specific to a particular component (to track the
changes of the component
•PROPS - Passed from the parent Component.Inputs to
the child component
Features STATE PROPS
Can get initial value from parent
component?
Yes Yes
Can be directly changed by parent
component?
No Yes
Can set default values inside
component?
Yes Yes
Can change inside component? Yes No
Can set initial value for child
component?
Yes Yes
Can change in child component? Yes No
Component Events - Mounting
• constructor()
• componentWillMount()
• render()
• componentDidMount()
Component Events - Updating
• componentWillReceiveProps(nextProps)
• shouldComponentUpdate(nextProps,nextState)
• componentWillUpdate(nextProps,nextState)
• render()
• componentDidUpdate(prevProps,prevState)
Component Events - Unmounting
• componentWillUnmount()
Instance Properties,API
• props
• state
• setState()
• forceUpdate()
Virtual DOM
User’s View
(Real DOM)
Background JS Process
(Virtual DOM)
Initial State
Virtual DOM
User’s View
(Real DOM)
Background JS Process
(Virtual DOM)
First Render
<html>
<div>
<h1>Sajith</h1>
</div>
</html>
Virtual DOM
User’s View
(Real DOM)
Background JS Process
(Virtual DOM)
Real DOM populated and Virtual DOM cleared
<html>
<div>
<h1>Sajith</h1>
</div>
</html>
<html>
<div>
<h1>Sajith</h1>
</div>
</html>
Virtual DOM
User’s View
(Real DOM)
Background JS Process
(Virtual DOM)
Click on Change Me
<html>
<div>
<h1>Sajith</h1>
</div>
</html>
<html>
<div>
<h1>Dilshan</h1>
</div>
</html>
Virtual DOM
User’s View
(Real DOM)
Background JS Process
(Virtual DOM)
Only modified section is updated in Real DOM and
Virtual DOM is cleared
<html>
<div>
<h1>Dilshan</h1>
</div>
</html>
<html>
<div>
<h1>Dilshan</h1>
</div>
</html>
<html>
<div>
<h1>Sajith</h1>
</div>
</html>
Reconciliation
• Use “diffing” algorithm
• the state of the art algorithms have a
complexity in the order of O(n3) where n is
the number of elements in the tree.
• React implements a heuristic O(n)
algorithm
https://facebook.github.io/react/docs/reconciliation.html
Flux
Action
Dispatcher Store View
Flux
Action
Dispatcher Store View
Flux
Action
Dispatcher Store View
Flux
Action
Dispatcher Store View
Let’s see how it
used in UltraStudio
Q&A

More Related Content

What's hot

Getting started with Redux js
Getting started with Redux jsGetting started with Redux js
Getting started with Redux jsCitrix
 
Designing applications with Redux
Designing applications with ReduxDesigning applications with Redux
Designing applications with ReduxFernando Daciuk
 
Intro to Redux | DreamLab Academy #3
Intro to Redux | DreamLab Academy #3 Intro to Redux | DreamLab Academy #3
Intro to Redux | DreamLab Academy #3 DreamLab
 
ComponenKit and React Native
ComponenKit and React NativeComponenKit and React Native
ComponenKit and React NativeStanfy
 
ReactJs presentation
ReactJs presentationReactJs presentation
ReactJs presentationnishasowdri
 
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 ReduxAli Sa'o
 
Introduction to react_js
Introduction to react_jsIntroduction to react_js
Introduction to react_jsMicroPyramid .
 
JavaScript, React Native and Performance at react-europe 2016
JavaScript, React Native and Performance at react-europe 2016JavaScript, React Native and Performance at react-europe 2016
JavaScript, React Native and Performance at react-europe 2016Tadeu Zagallo
 
Creating a WYSIWYG Editor with React
Creating a WYSIWYG Editor with ReactCreating a WYSIWYG Editor with React
Creating a WYSIWYG Editor with Reactpeychevi
 
React.js and Redux overview
React.js and Redux overviewReact.js and Redux overview
React.js and Redux overviewAlex Bachuk
 
React vs Angular: ups & downs (speaker Oleksandr Kovalov, Binary Studio)
React vs Angular: ups & downs (speaker Oleksandr Kovalov, Binary Studio)React vs Angular: ups & downs (speaker Oleksandr Kovalov, Binary Studio)
React vs Angular: ups & downs (speaker Oleksandr Kovalov, Binary Studio)Binary Studio
 
ReactJS presentation
ReactJS presentationReactJS presentation
ReactJS presentationThanh Tuong
 
React state managmenet with Redux
React state managmenet with ReduxReact state managmenet with Redux
React state managmenet with ReduxVedran Blaženka
 
Introduction to React & Redux
Introduction to React & ReduxIntroduction to React & Redux
Introduction to React & ReduxBoris Dinkevich
 
A Closer Look At React Native
A Closer Look At React NativeA Closer Look At React Native
A Closer Look At React NativeIan Wang
 

What's hot (20)

Getting started with Redux js
Getting started with Redux jsGetting started with Redux js
Getting started with Redux js
 
Designing applications with Redux
Designing applications with ReduxDesigning applications with Redux
Designing applications with Redux
 
ReactJS for Beginners
ReactJS for BeginnersReactJS for Beginners
ReactJS for Beginners
 
Intro to Redux | DreamLab Academy #3
Intro to Redux | DreamLab Academy #3 Intro to Redux | DreamLab Academy #3
Intro to Redux | DreamLab Academy #3
 
ComponenKit and React Native
ComponenKit and React NativeComponenKit and React Native
ComponenKit and React Native
 
ReactJs presentation
ReactJs presentationReactJs presentation
ReactJs presentation
 
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
 
React.js+Redux Workshops
React.js+Redux WorkshopsReact.js+Redux Workshops
React.js+Redux Workshops
 
React / Redux Architectures
React / Redux ArchitecturesReact / Redux Architectures
React / Redux Architectures
 
Introduction to react_js
Introduction to react_jsIntroduction to react_js
Introduction to react_js
 
JavaScript, React Native and Performance at react-europe 2016
JavaScript, React Native and Performance at react-europe 2016JavaScript, React Native and Performance at react-europe 2016
JavaScript, React Native and Performance at react-europe 2016
 
Creating a WYSIWYG Editor with React
Creating a WYSIWYG Editor with ReactCreating a WYSIWYG Editor with React
Creating a WYSIWYG Editor with React
 
React on es6+
React on es6+React on es6+
React on es6+
 
React & Redux
React & ReduxReact & Redux
React & Redux
 
React.js and Redux overview
React.js and Redux overviewReact.js and Redux overview
React.js and Redux overview
 
React vs Angular: ups & downs (speaker Oleksandr Kovalov, Binary Studio)
React vs Angular: ups & downs (speaker Oleksandr Kovalov, Binary Studio)React vs Angular: ups & downs (speaker Oleksandr Kovalov, Binary Studio)
React vs Angular: ups & downs (speaker Oleksandr Kovalov, Binary Studio)
 
ReactJS presentation
ReactJS presentationReactJS presentation
ReactJS presentation
 
React state managmenet with Redux
React state managmenet with ReduxReact state managmenet with Redux
React state managmenet with Redux
 
Introduction to React & Redux
Introduction to React & ReduxIntroduction to React & Redux
Introduction to React & Redux
 
A Closer Look At React Native
A Closer Look At React NativeA Closer Look At React Native
A Closer Look At React Native
 

Similar to Introduction to ReactJS

Getting Started with React v16
Getting Started with React v16Getting Started with React v16
Getting Started with React v16Benny Neugebauer
 
Build web apps with react js
Build web apps with react jsBuild web apps with react js
Build web apps with react jsdhanushkacnd
 
How to create components in react js
How to create components in react jsHow to create components in react js
How to create components in react jsBOSC Tech Labs
 
React - Start learning today
React - Start learning today React - Start learning today
React - Start learning today Nitin Tyagi
 
React && React Native workshop
React && React Native workshopReact && React Native workshop
React && React Native workshopStacy Goh
 
Connect.js - Exploring React.Native
Connect.js - Exploring React.NativeConnect.js - Exploring React.Native
Connect.js - Exploring React.Nativejoshcjensen
 
React Native Androidはなぜ動くのか
React Native Androidはなぜ動くのかReact Native Androidはなぜ動くのか
React Native Androidはなぜ動くのかYukiya Nakagawa
 
Server side rendering with React and Symfony
Server side rendering with React and SymfonyServer side rendering with React and Symfony
Server side rendering with React and SymfonyIgnacio Martín
 
Introduction to React for Frontend Developers
Introduction to React for Frontend DevelopersIntroduction to React for Frontend Developers
Introduction to React for Frontend DevelopersSergio Nakamura
 
How To Integrate Native Android App With React Native.
How To Integrate Native Android App With React Native.How To Integrate Native Android App With React Native.
How To Integrate Native Android App With React Native.Techugo
 
Introduction to ReactJS
Introduction to ReactJSIntroduction to ReactJS
Introduction to ReactJSKnoldus Inc.
 
An Emoji Introduction to React Native (Panagiotis Vourtsis, Senior Front End ...
An Emoji Introduction to React Native (Panagiotis Vourtsis, Senior Front End ...An Emoji Introduction to React Native (Panagiotis Vourtsis, Senior Front End ...
An Emoji Introduction to React Native (Panagiotis Vourtsis, Senior Front End ...GreeceJS
 

Similar to Introduction to ReactJS (20)

Getting Started with React v16
Getting Started with React v16Getting Started with React v16
Getting Started with React v16
 
Build web apps with react js
Build web apps with react jsBuild web apps with react js
Build web apps with react js
 
How to create components in react js
How to create components in react jsHow to create components in react js
How to create components in react js
 
Let's react - Meetup
Let's react - MeetupLet's react - Meetup
Let's react - Meetup
 
React - Start learning today
React - Start learning today React - Start learning today
React - Start learning today
 
React && React Native workshop
React && React Native workshopReact && React Native workshop
React && React Native workshop
 
Connect.js - Exploring React.Native
Connect.js - Exploring React.NativeConnect.js - Exploring React.Native
Connect.js - Exploring React.Native
 
React Native Androidはなぜ動くのか
React Native Androidはなぜ動くのかReact Native Androidはなぜ動くのか
React Native Androidはなぜ動くのか
 
React native by example by Vadim Ruban
React native by example by Vadim RubanReact native by example by Vadim Ruban
React native by example by Vadim Ruban
 
Intro to React
Intro to ReactIntro to React
Intro to React
 
Server side rendering with React and Symfony
Server side rendering with React and SymfonyServer side rendering with React and Symfony
Server side rendering with React and Symfony
 
Introduction to React for Frontend Developers
Introduction to React for Frontend DevelopersIntroduction to React for Frontend Developers
Introduction to React for Frontend Developers
 
React outbox
React outboxReact outbox
React outbox
 
React js
React jsReact js
React js
 
How To Integrate Native Android App With React Native.
How To Integrate Native Android App With React Native.How To Integrate Native Android App With React Native.
How To Integrate Native Android App With React Native.
 
Introduction to ReactJS
Introduction to ReactJSIntroduction to ReactJS
Introduction to ReactJS
 
ReactJS.ppt
ReactJS.pptReactJS.ppt
ReactJS.ppt
 
React native
React nativeReact native
React native
 
React JS - Introduction
React JS - IntroductionReact JS - Introduction
React JS - Introduction
 
An Emoji Introduction to React Native (Panagiotis Vourtsis, Senior Front End ...
An Emoji Introduction to React Native (Panagiotis Vourtsis, Senior Front End ...An Emoji Introduction to React Native (Panagiotis Vourtsis, Senior Front End ...
An Emoji Introduction to React Native (Panagiotis Vourtsis, Senior Front End ...
 

More from AdroitLogic

AdroitLogic Integration Platform Server (IPS) Whitepaper
AdroitLogic Integration Platform Server (IPS) WhitepaperAdroitLogic Integration Platform Server (IPS) Whitepaper
AdroitLogic Integration Platform Server (IPS) WhitepaperAdroitLogic
 
Software Testing
Software TestingSoftware Testing
Software TestingAdroitLogic
 
AdroitLogic UltraESB
AdroitLogic UltraESBAdroitLogic UltraESB
AdroitLogic UltraESBAdroitLogic
 
AdroitLogic UltraESB-X
AdroitLogic UltraESB-XAdroitLogic UltraESB-X
AdroitLogic UltraESB-XAdroitLogic
 
AS2Gateway and AS2Station
AS2Gateway and AS2StationAS2Gateway and AS2Station
AS2Gateway and AS2StationAdroitLogic
 
AdroitLogic Product Portfolio
AdroitLogic Product PortfolioAdroitLogic Product Portfolio
AdroitLogic Product PortfolioAdroitLogic
 
System Configuration for UltraESB
System Configuration for UltraESBSystem Configuration for UltraESB
System Configuration for UltraESBAdroitLogic
 
Administration and Management with UltraESB
Administration and Management with UltraESBAdministration and Management with UltraESB
Administration and Management with UltraESBAdroitLogic
 
Systems management - UltraESB
Systems management - UltraESBSystems management - UltraESB
Systems management - UltraESBAdroitLogic
 
Getting hands on-experience with UltraESB
Getting hands on-experience with UltraESBGetting hands on-experience with UltraESB
Getting hands on-experience with UltraESBAdroitLogic
 
ESB vs API management
ESB vs API managementESB vs API management
ESB vs API managementAdroitLogic
 
UltraESB - Advanced services
UltraESB - Advanced servicesUltraESB - Advanced services
UltraESB - Advanced servicesAdroitLogic
 
UltraESB - Installation and Configuration
UltraESB - Installation and ConfigurationUltraESB - Installation and Configuration
UltraESB - Installation and ConfigurationAdroitLogic
 
UltraESB - an introduction
UltraESB - an introductionUltraESB - an introduction
UltraESB - an introductionAdroitLogic
 
Introduction to AdroitLogic and UltraESB
Introduction to AdroitLogic and UltraESBIntroduction to AdroitLogic and UltraESB
Introduction to AdroitLogic and UltraESBAdroitLogic
 
WADL support for UltraESB
WADL support for UltraESBWADL support for UltraESB
WADL support for UltraESBAdroitLogic
 
Monitoring multiple UltraESB instances with UConsole
Monitoring multiple UltraESB instances with UConsoleMonitoring multiple UltraESB instances with UConsole
Monitoring multiple UltraESB instances with UConsoleAdroitLogic
 

More from AdroitLogic (17)

AdroitLogic Integration Platform Server (IPS) Whitepaper
AdroitLogic Integration Platform Server (IPS) WhitepaperAdroitLogic Integration Platform Server (IPS) Whitepaper
AdroitLogic Integration Platform Server (IPS) Whitepaper
 
Software Testing
Software TestingSoftware Testing
Software Testing
 
AdroitLogic UltraESB
AdroitLogic UltraESBAdroitLogic UltraESB
AdroitLogic UltraESB
 
AdroitLogic UltraESB-X
AdroitLogic UltraESB-XAdroitLogic UltraESB-X
AdroitLogic UltraESB-X
 
AS2Gateway and AS2Station
AS2Gateway and AS2StationAS2Gateway and AS2Station
AS2Gateway and AS2Station
 
AdroitLogic Product Portfolio
AdroitLogic Product PortfolioAdroitLogic Product Portfolio
AdroitLogic Product Portfolio
 
System Configuration for UltraESB
System Configuration for UltraESBSystem Configuration for UltraESB
System Configuration for UltraESB
 
Administration and Management with UltraESB
Administration and Management with UltraESBAdministration and Management with UltraESB
Administration and Management with UltraESB
 
Systems management - UltraESB
Systems management - UltraESBSystems management - UltraESB
Systems management - UltraESB
 
Getting hands on-experience with UltraESB
Getting hands on-experience with UltraESBGetting hands on-experience with UltraESB
Getting hands on-experience with UltraESB
 
ESB vs API management
ESB vs API managementESB vs API management
ESB vs API management
 
UltraESB - Advanced services
UltraESB - Advanced servicesUltraESB - Advanced services
UltraESB - Advanced services
 
UltraESB - Installation and Configuration
UltraESB - Installation and ConfigurationUltraESB - Installation and Configuration
UltraESB - Installation and Configuration
 
UltraESB - an introduction
UltraESB - an introductionUltraESB - an introduction
UltraESB - an introduction
 
Introduction to AdroitLogic and UltraESB
Introduction to AdroitLogic and UltraESBIntroduction to AdroitLogic and UltraESB
Introduction to AdroitLogic and UltraESB
 
WADL support for UltraESB
WADL support for UltraESBWADL support for UltraESB
WADL support for UltraESB
 
Monitoring multiple UltraESB instances with UConsole
Monitoring multiple UltraESB instances with UConsoleMonitoring multiple UltraESB instances with UConsole
Monitoring multiple UltraESB instances with UConsole
 

Recently uploaded

Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
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
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
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
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfCionsystems
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
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
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendArshad QA
 
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
 
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
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....ShaimaaMohamedGalal
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 

Recently uploaded (20)

Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
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
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
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 ...
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdf
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
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
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and Backend
 
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
 
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-...
 
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
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 

Introduction to ReactJS

  • 2. First Project $ npm install -g create-react-app $ create-react-app hello-world $ cd hello-world $ npm start
  • 3. Let’s see how it really works
  • 4. Components import React, { Component } from 'react'; class App extends Component { render() { return ( <div className="App"> <h1> Hello World </h1> </div> ); } } export default App;
  • 5. React JSXsyntactic-sugar for JS const element = ( <h1 className="greeting"> Hello, world! </h1> ); JSX Code const element = React.createElement( 'h1', {className: 'greeting'}, 'Hello, world!' ); Compiled JS Code • Template Language with full power of JS • Prevents injection attacks https://facebook.github.io/react/docs/introducing-jsx.html more… https://facebook.github.io/react/docs/jsx-in-depth.html
  • 6. State vs.Props •STATE - Specific to a particular component (to track the changes of the component •PROPS - Passed from the parent Component.Inputs to the child component Features STATE PROPS Can get initial value from parent component? Yes Yes Can be directly changed by parent component? No Yes Can set default values inside component? Yes Yes Can change inside component? Yes No Can set initial value for child component? Yes Yes Can change in child component? Yes No
  • 7. Component Events - Mounting • constructor() • componentWillMount() • render() • componentDidMount()
  • 8. Component Events - Updating • componentWillReceiveProps(nextProps) • shouldComponentUpdate(nextProps,nextState) • componentWillUpdate(nextProps,nextState) • render() • componentDidUpdate(prevProps,prevState)
  • 9. Component Events - Unmounting • componentWillUnmount() Instance Properties,API • props • state • setState() • forceUpdate()
  • 10. Virtual DOM User’s View (Real DOM) Background JS Process (Virtual DOM) Initial State
  • 11. Virtual DOM User’s View (Real DOM) Background JS Process (Virtual DOM) First Render <html> <div> <h1>Sajith</h1> </div> </html>
  • 12. Virtual DOM User’s View (Real DOM) Background JS Process (Virtual DOM) Real DOM populated and Virtual DOM cleared <html> <div> <h1>Sajith</h1> </div> </html> <html> <div> <h1>Sajith</h1> </div> </html>
  • 13. Virtual DOM User’s View (Real DOM) Background JS Process (Virtual DOM) Click on Change Me <html> <div> <h1>Sajith</h1> </div> </html> <html> <div> <h1>Dilshan</h1> </div> </html>
  • 14. Virtual DOM User’s View (Real DOM) Background JS Process (Virtual DOM) Only modified section is updated in Real DOM and Virtual DOM is cleared <html> <div> <h1>Dilshan</h1> </div> </html> <html> <div> <h1>Dilshan</h1> </div> </html> <html> <div> <h1>Sajith</h1> </div> </html>
  • 15. Reconciliation • Use “diffing” algorithm • the state of the art algorithms have a complexity in the order of O(n3) where n is the number of elements in the tree. • React implements a heuristic O(n) algorithm https://facebook.github.io/react/docs/reconciliation.html
  • 20. Let’s see how it used in UltraStudio
  • 21. Q&A