SlideShare une entreprise Scribd logo
1  sur  21
Télécharger pour lire hors ligne
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

Contenu connexe

Tendances

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
 

Tendances (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
 

Similaire à 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
 

Similaire à 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 ...
 

Plus de 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
 

Plus de 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
 

Dernier

How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentationvaddepallysandeep122
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Rob Geurden
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfInnovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfYashikaSharma391629
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf31events.com
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfMarharyta Nedzelska
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
How To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROHow To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROmotivationalword821
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxAndreas Kunz
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfStefano Stabellini
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 

Dernier (20)

How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentation
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfInnovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
How To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROHow To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTRO
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 

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