SlideShare a Scribd company logo
Introduction to React
About Me
● Solutions integrator
at Jumping Bean
– Developer & Trainer
– Social Media
● Twitter @mxc4
● Twitter
@jumpingbeansa
● LinkedIn
Application Architecture
Which Front-End Technology to Use?
What Front-End Technology To
Use?
● Mobile?
– Native vs HTML5
● Desktop?
– Thin Client/Fat Client
● Swing
● Web?
– HTML5,
– ECMAScript 5,6,7
– Frameworks
● HTML5/JavaScript
– Pros:
● Largest coverage,
– Cons:
● Not as fast, slick or
integrated as native
apps
The State of JavaScript
Frameworks
What to use for JS Front-End?
● Needed to redo a front-end
– Angular – Seemed to be the
emerging winner,
● Angular 1 versus Angular 2
– Others
● BackBone,
● Ember
● Where to go?
● I am Morpheus - Had to go
find “The One”
Is React the One?
What is React?
● JavaScript library from
– FaceBook
– Instagram
● “A JavaScript library for building user
interfaces”
● Originally built for Single Page Apps,
● Only the View part of an MVC framework
How is React Different?
● Existing frameworks
– add complexity,
– Introduce JavaScript meta-languages,
– Can be slow when number of interactive
components increase
● One way data-binding
● Two way data-binding is expensive and slow
React – A New Approach
● Declarative not imperative,
● UI built out of JavaScript defined components,
● One way data binding,
– Immutable UI
● Build components not templates
● Major innovation
– Virtual DOM
– Generates
Virtual DOM
● Abstracts away browser DOM,
● Translates from abstract DOM to concrete browser
DOM,
● Power behind one-way binding and UI updates
● Write to Virtual DOM and then “compile” to JavaScript
● On state change generate entire html page and then
generate differences and update
Virtual DOM – Update Flow
1)Calculate old and new tree,
2)Diff them:
– Two components of the same class will generate similar trees
– two components of different classes will generate different
trees.
– It is possible to provide a unique key for elements that is
stable across different renders
3) Update changed part of browser DOM
Simplified Explanation of React
● Create Virtual DOM components in JavaScript,
● Everything with interactivity is a React
component,
● State, i.e. changes propagate down component
hierarchy,
● Basic approach – file per component
React Component Creation - ES6
● Create components extending
React.Component,
● Implement render function,
● Return UI virtual DOM
Creating a React Component
JSX
● Optional HTML-like mark-up
● Declarative description of the UI inlined in JS code
● Combines ease-of-use of templates with power of
JavaScript
● Preprocessor translates to plain JavaScript:
● On the fly (suitable during development)
● Offline using the React CLI
Component Composition
How is Data/Model Provided to
Components?
● One way data binding means data change in one place,
– i.e only a component responsible for the data can change it,
– All other sub-components can only read it,
– If data is shared between components it is maintained in the
common ancestor
● Props way to pass data from parent to child,→
● State never leaves its containing component→
Component Hierarchies
● Breaking your app
into components
hierarchies is key,
● Understanding data
needs of components
determine where
state is kept
Data Flow – Data is immutable
● Data passed down hierarchy via
– this.props, properties are immutable,→
– this.state state should be held at the appropriate level in→
component hierarchy
● Parent components maintain state,
● How do child component changes to state propagate to
parent?
– Data passed up the hierarchy via parent event handlers being
called by child components
Data Flows Down Hierarchy via
Properties
Data Flow From Child to Parent
Declare Handler in Parent
Data Flow From Child To Parent
Fire Handler in Child
API Methods
● render()
– Return single child element,
– Can return null or false,
– Should not do read or write to the DOM,
– Best for server side rendering
● getInitialState() -
– Used to set the state before component is mounted,
API Methods
● getDefaultProps()
– Invoked on class creation then cached,
– Sets default values on missing props
● propTypes
– Used to validate props passed to component,
● statics
– Defines static methods for component
Component Life Cycle Events
● componentWillMount
– Invoked on client and server,
– Can be used to set state before render is called,
– Invoked on client and server before rendering
● componentDidMount
– Invoked only on client after rendering,
– Can access refs
● componentWillReceiveProps
– Not called for initial render,
– Used to setState
Component Life Cycle Events
● shouldComponentUpdate
– Return false to prevent updating
● componentWillUpdate
● componentDidUpdate,
● componentWillUnmount
Challenges to React?
● HTML 5 Web Components
– Custom components in HTML 5,
– Tied to Web browser DOM Model,
– Lots of reusable components will be available?
– How to integrate with React components
● Possible but do you want this?
● If you don't do it will anyone use your framework?
Mark Clarke @mxc4
Jumping Bean @jumpingbeansa
WWW: www.JumpingBean.co.za
Ad

Recommended

Introduction to Reactjs
Introduction to Reactjs
NodeXperts
 
Robust UI development with ClojureScript
Robust UI development with ClojureScript
Sandilya Jandhyala
 
Jsp + My Sql
Jsp + My Sql
Ashwin K
 
React more than just components
React more than just components
Chen Feldman
 
Web development basics (Part-7)
Web development basics (Part-7)
Rajat Pratap Singh
 
Modern APIs with GraphQL
Modern APIs with GraphQL
Taikai
 
Introduction to React by Ebowe Blessing
Introduction to React by Ebowe Blessing
Blessing Ebowe
 
RESTful with Drupal - in-s and out-s
RESTful with Drupal - in-s and out-s
Kalin Chernev
 
Apache Any23 - Anything to Triples
Apache Any23 - Anything to Triples
Michele Mostarda
 
Performance (browser)
Performance (browser)
aquarius070287
 
AngularJS
AngularJS
Yogesh L
 
Javascripts. pptt
Javascripts. pptt
RaviShankarSinghal
 
Experiences with Evangelizing Java Within the Database
Experiences with Evangelizing Java Within the Database
Marcelo Ochoa
 
Websocket,JSON in JEE7
Websocket,JSON in JEE7
PrasannaKumar Sathyanarayanan
 
Javascript
Javascript
Mozxai
 
GraphQL is actually rest
GraphQL is actually rest
Jakub Riedl
 
Lokijs
Lokijs
Joe Minichino
 
Writing Scalable React Applications: Introduction
Writing Scalable React Applications: Introduction
Klika Tech, Inc
 
Asynchronous Processing in Java/JEE/Spring
Asynchronous Processing in Java/JEE/Spring
Naresh Chintalcheru
 
How to add Fixtures into your Django app with Mixer
How to add Fixtures into your Django app with Mixer
Guinsly Mondesir
 
Robust web apps with React.js
Robust web apps with React.js
Max Klymyshyn
 
Web development basics (Part-5)
Web development basics (Part-5)
Rajat Pratap Singh
 
Using NoSQL MongoDB with ColdFusion
Using NoSQL MongoDB with ColdFusion
indiver
 
3rd Generation Web Application Platforms
3rd Generation Web Application Platforms
Naresh Chintalcheru
 
Java Web services
Java Web services
Sujit Kumar
 
Postgrtesql as a NoSQL Document Store - The JSON/JSONB data type
Postgrtesql as a NoSQL Document Store - The JSON/JSONB data type
Jumping Bean
 
Akka - young fighter course
Akka - young fighter course
Dmitriy Gutman
 
The Creative Economy
The Creative Economy
The_IPA
 
Updated CV 012116
Updated CV 012116
Maria Basconcillo
 
Syd Uni professional learning
Syd Uni professional learning
Cameron Paterson
 

More Related Content

What's hot (19)

Apache Any23 - Anything to Triples
Apache Any23 - Anything to Triples
Michele Mostarda
 
Performance (browser)
Performance (browser)
aquarius070287
 
AngularJS
AngularJS
Yogesh L
 
Javascripts. pptt
Javascripts. pptt
RaviShankarSinghal
 
Experiences with Evangelizing Java Within the Database
Experiences with Evangelizing Java Within the Database
Marcelo Ochoa
 
Websocket,JSON in JEE7
Websocket,JSON in JEE7
PrasannaKumar Sathyanarayanan
 
Javascript
Javascript
Mozxai
 
GraphQL is actually rest
GraphQL is actually rest
Jakub Riedl
 
Lokijs
Lokijs
Joe Minichino
 
Writing Scalable React Applications: Introduction
Writing Scalable React Applications: Introduction
Klika Tech, Inc
 
Asynchronous Processing in Java/JEE/Spring
Asynchronous Processing in Java/JEE/Spring
Naresh Chintalcheru
 
How to add Fixtures into your Django app with Mixer
How to add Fixtures into your Django app with Mixer
Guinsly Mondesir
 
Robust web apps with React.js
Robust web apps with React.js
Max Klymyshyn
 
Web development basics (Part-5)
Web development basics (Part-5)
Rajat Pratap Singh
 
Using NoSQL MongoDB with ColdFusion
Using NoSQL MongoDB with ColdFusion
indiver
 
3rd Generation Web Application Platforms
3rd Generation Web Application Platforms
Naresh Chintalcheru
 
Java Web services
Java Web services
Sujit Kumar
 
Postgrtesql as a NoSQL Document Store - The JSON/JSONB data type
Postgrtesql as a NoSQL Document Store - The JSON/JSONB data type
Jumping Bean
 
Akka - young fighter course
Akka - young fighter course
Dmitriy Gutman
 
Apache Any23 - Anything to Triples
Apache Any23 - Anything to Triples
Michele Mostarda
 
Experiences with Evangelizing Java Within the Database
Experiences with Evangelizing Java Within the Database
Marcelo Ochoa
 
Javascript
Javascript
Mozxai
 
GraphQL is actually rest
GraphQL is actually rest
Jakub Riedl
 
Writing Scalable React Applications: Introduction
Writing Scalable React Applications: Introduction
Klika Tech, Inc
 
Asynchronous Processing in Java/JEE/Spring
Asynchronous Processing in Java/JEE/Spring
Naresh Chintalcheru
 
How to add Fixtures into your Django app with Mixer
How to add Fixtures into your Django app with Mixer
Guinsly Mondesir
 
Robust web apps with React.js
Robust web apps with React.js
Max Klymyshyn
 
Web development basics (Part-5)
Web development basics (Part-5)
Rajat Pratap Singh
 
Using NoSQL MongoDB with ColdFusion
Using NoSQL MongoDB with ColdFusion
indiver
 
3rd Generation Web Application Platforms
3rd Generation Web Application Platforms
Naresh Chintalcheru
 
Java Web services
Java Web services
Sujit Kumar
 
Postgrtesql as a NoSQL Document Store - The JSON/JSONB data type
Postgrtesql as a NoSQL Document Store - The JSON/JSONB data type
Jumping Bean
 
Akka - young fighter course
Akka - young fighter course
Dmitriy Gutman
 

Viewers also liked (19)

The Creative Economy
The Creative Economy
The_IPA
 
Updated CV 012116
Updated CV 012116
Maria Basconcillo
 
Syd Uni professional learning
Syd Uni professional learning
Cameron Paterson
 
Blogging and podcasting
Blogging and podcasting
Alek Davis
 
t30.10
t30.10
Alexander Philipatos
 
Snapshot
Snapshot
MA3 Arriaga Arriaga
 
How it works under the hood with visual cobol
How it works under the hood with visual cobol
Micro Focus
 
Building intranet applications with ASP.NET AJAX and jQuery
Building intranet applications with ASP.NET AJAX and jQuery
Alek Davis
 
Creative Economy
Creative Economy
Phil McKinney
 
Visual COBOL Development for Unix and Java
Visual COBOL Development for Unix and Java
Micro Focus
 
Menú Comedor Escolar
Menú Comedor Escolar
cpramonlaza
 
Treatment 1 Naomi
Treatment 1 Naomi
Oliver Christensen
 
Lip Reconstruction Following Traumatic Lip Injuries | Dr. Alfred Khallouf
Lip Reconstruction Following Traumatic Lip Injuries | Dr. Alfred Khallouf
Alfred Khallouf
 
Comprehensive Care Treatment Plan Presentation, Part II | Dr. Alfred Khallouf
Comprehensive Care Treatment Plan Presentation, Part II | Dr. Alfred Khallouf
Alfred Khallouf
 
BIOETHICS INVOLVED IN CLONING
BIOETHICS INVOLVED IN CLONING
Mohsin Shad
 
Medtech (bmls) laws & bioethics intro
Medtech (bmls) laws & bioethics intro
MEI MEI
 
'Documents.tips panduan penulisan-laporan-akhir-ptss.pdf'
'Documents.tips panduan penulisan-laporan-akhir-ptss.pdf'
Afina Karim
 
Velocity 2015 linux perf tools
Velocity 2015 linux perf tools
Brendan Gregg
 
La ciudad un escenario para el desarrollo de com petencias cientificas y ciud...
La ciudad un escenario para el desarrollo de com petencias cientificas y ciud...
Bibiana Villa Vargas
 
The Creative Economy
The Creative Economy
The_IPA
 
Syd Uni professional learning
Syd Uni professional learning
Cameron Paterson
 
Blogging and podcasting
Blogging and podcasting
Alek Davis
 
How it works under the hood with visual cobol
How it works under the hood with visual cobol
Micro Focus
 
Building intranet applications with ASP.NET AJAX and jQuery
Building intranet applications with ASP.NET AJAX and jQuery
Alek Davis
 
Visual COBOL Development for Unix and Java
Visual COBOL Development for Unix and Java
Micro Focus
 
Menú Comedor Escolar
Menú Comedor Escolar
cpramonlaza
 
Lip Reconstruction Following Traumatic Lip Injuries | Dr. Alfred Khallouf
Lip Reconstruction Following Traumatic Lip Injuries | Dr. Alfred Khallouf
Alfred Khallouf
 
Comprehensive Care Treatment Plan Presentation, Part II | Dr. Alfred Khallouf
Comprehensive Care Treatment Plan Presentation, Part II | Dr. Alfred Khallouf
Alfred Khallouf
 
BIOETHICS INVOLVED IN CLONING
BIOETHICS INVOLVED IN CLONING
Mohsin Shad
 
Medtech (bmls) laws & bioethics intro
Medtech (bmls) laws & bioethics intro
MEI MEI
 
'Documents.tips panduan penulisan-laporan-akhir-ptss.pdf'
'Documents.tips panduan penulisan-laporan-akhir-ptss.pdf'
Afina Karim
 
Velocity 2015 linux perf tools
Velocity 2015 linux perf tools
Brendan Gregg
 
La ciudad un escenario para el desarrollo de com petencias cientificas y ciud...
La ciudad un escenario para el desarrollo de com petencias cientificas y ciud...
Bibiana Villa Vargas
 
Ad

Similar to React - The JavaScript Library for User Interfaces (20)

Intro to react_v2
Intro to react_v2
Feather Knee
 
React JS and why it's awesome
React JS and why it's awesome
Andrew Hull
 
FRONTEND DEVELOPMENT WITH REACT.JS
FRONTEND DEVELOPMENT WITH REACT.JS
IRJET Journal
 
React & Flux Workshop
React & Flux Workshop
Christian Lilley
 
React.js at Cortex
React.js at Cortex
Geoff Harcourt
 
ReactJS Code Impact
ReactJS Code Impact
Raymond McDermott
 
reactJS
reactJS
Syam Santhosh
 
Reactjs notes.pptx for web development- tutorial and theory
Reactjs notes.pptx for web development- tutorial and theory
jobinThomas54
 
Getting Started with React, When You’re an Angular Developer
Getting Started with React, When You’re an Angular Developer
Fabrit Global
 
Tech Talk on ReactJS
Tech Talk on ReactJS
Atlogys Technical Consulting
 
Content-Driven Apps with React
Content-Driven Apps with React
Netcetera
 
ReactJS
ReactJS
Ram Murat Sharma
 
An Overview of the React Ecosystem
An Overview of the React Ecosystem
FITC
 
React introduction
React introduction
Kashyap Parmar
 
Reactjs
Reactjs
Neha Sharma
 
theory-slides-vueh3urh4ur4ur4r44oirj4riu4ri
theory-slides-vueh3urh4ur4ur4r44oirj4riu4ri
paridhiagarwal129
 
ReactJS.NET - Fast and Scalable Single Page Applications
ReactJS.NET - Fast and Scalable Single Page Applications
Rick Beerendonk
 
React Tech Salon
React Tech Salon
Chenguang ZHANG
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
Karmanjay Verma
 
React in Action ( PDFDrive ).pdf
React in Action ( PDFDrive ).pdf
almako2
 
React JS and why it's awesome
React JS and why it's awesome
Andrew Hull
 
FRONTEND DEVELOPMENT WITH REACT.JS
FRONTEND DEVELOPMENT WITH REACT.JS
IRJET Journal
 
Reactjs notes.pptx for web development- tutorial and theory
Reactjs notes.pptx for web development- tutorial and theory
jobinThomas54
 
Getting Started with React, When You’re an Angular Developer
Getting Started with React, When You’re an Angular Developer
Fabrit Global
 
Content-Driven Apps with React
Content-Driven Apps with React
Netcetera
 
An Overview of the React Ecosystem
An Overview of the React Ecosystem
FITC
 
theory-slides-vueh3urh4ur4ur4r44oirj4riu4ri
theory-slides-vueh3urh4ur4ur4r44oirj4riu4ri
paridhiagarwal129
 
ReactJS.NET - Fast and Scalable Single Page Applications
ReactJS.NET - Fast and Scalable Single Page Applications
Rick Beerendonk
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
Karmanjay Verma
 
React in Action ( PDFDrive ).pdf
React in Action ( PDFDrive ).pdf
almako2
 
Ad

More from Jumping Bean (14)

DevOpsDaysCPT Ansible Infrastrucutre as Code 2017
DevOpsDaysCPT Ansible Infrastrucutre as Code 2017
Jumping Bean
 
IPv6 How To Set Up a Linux IPv6 Lan
IPv6 How To Set Up a Linux IPv6 Lan
Jumping Bean
 
HTML 5 & The Modern Web
HTML 5 & The Modern Web
Jumping Bean
 
Building games-with-libgdx
Building games-with-libgdx
Jumping Bean
 
Linux Containers & Docker
Linux Containers & Docker
Jumping Bean
 
Introduction to Web Sockets
Introduction to Web Sockets
Jumping Bean
 
Secrets of a linux ninja Software Freedom Day 2013 Johannesburg, South Africa
Secrets of a linux ninja Software Freedom Day 2013 Johannesburg, South Africa
Jumping Bean
 
M-Learning application development with open source
M-Learning application development with open source
Jumping Bean
 
Introduction to AngularJS
Introduction to AngularJS
Jumping Bean
 
Introduction to Android Development
Introduction to Android Development
Jumping Bean
 
Glassfish An Introduction
Glassfish An Introduction
Jumping Bean
 
Java logging
Java logging
Jumping Bean
 
IPv6 - Jozi Linux User Group Presentation
IPv6 - Jozi Linux User Group Presentation
Jumping Bean
 
SELinux Johannesburg Linux User Group (JoziJUg)
SELinux Johannesburg Linux User Group (JoziJUg)
Jumping Bean
 
DevOpsDaysCPT Ansible Infrastrucutre as Code 2017
DevOpsDaysCPT Ansible Infrastrucutre as Code 2017
Jumping Bean
 
IPv6 How To Set Up a Linux IPv6 Lan
IPv6 How To Set Up a Linux IPv6 Lan
Jumping Bean
 
HTML 5 & The Modern Web
HTML 5 & The Modern Web
Jumping Bean
 
Building games-with-libgdx
Building games-with-libgdx
Jumping Bean
 
Linux Containers & Docker
Linux Containers & Docker
Jumping Bean
 
Introduction to Web Sockets
Introduction to Web Sockets
Jumping Bean
 
Secrets of a linux ninja Software Freedom Day 2013 Johannesburg, South Africa
Secrets of a linux ninja Software Freedom Day 2013 Johannesburg, South Africa
Jumping Bean
 
M-Learning application development with open source
M-Learning application development with open source
Jumping Bean
 
Introduction to AngularJS
Introduction to AngularJS
Jumping Bean
 
Introduction to Android Development
Introduction to Android Development
Jumping Bean
 
Glassfish An Introduction
Glassfish An Introduction
Jumping Bean
 
IPv6 - Jozi Linux User Group Presentation
IPv6 - Jozi Linux User Group Presentation
Jumping Bean
 
SELinux Johannesburg Linux User Group (JoziJUg)
SELinux Johannesburg Linux User Group (JoziJUg)
Jumping Bean
 

Recently uploaded (20)

AI vs Human Writing: Can You Tell the Difference?
AI vs Human Writing: Can You Tell the Difference?
Shashi Sathyanarayana, Ph.D
 
EIS-Webinar-Engineering-Retail-Infrastructure-06-16-2025.pdf
EIS-Webinar-Engineering-Retail-Infrastructure-06-16-2025.pdf
Earley Information Science
 
2025_06_18 - OpenMetadata Community Meeting.pdf
2025_06_18 - OpenMetadata Community Meeting.pdf
OpenMetadata
 
WebdriverIO & JavaScript: The Perfect Duo for Web Automation
WebdriverIO & JavaScript: The Perfect Duo for Web Automation
digitaljignect
 
Security Tips for Enterprise Azure Solutions
Security Tips for Enterprise Azure Solutions
Michele Leroux Bustamante
 
Quantum AI: Where Impossible Becomes Probable
Quantum AI: Where Impossible Becomes Probable
Saikat Basu
 
Securing AI - There Is No Try, Only Do!.pdf
Securing AI - There Is No Try, Only Do!.pdf
Priyanka Aash
 
Cracking the Code - Unveiling Synergies Between Open Source Security and AI.pdf
Cracking the Code - Unveiling Synergies Between Open Source Security and AI.pdf
Priyanka Aash
 
AI VIDEO MAGAZINE - June 2025 - r/aivideo
AI VIDEO MAGAZINE - June 2025 - r/aivideo
1pcity Studios, Inc
 
"Scaling in space and time with Temporal", Andriy Lupa.pdf
"Scaling in space and time with Temporal", Andriy Lupa.pdf
Fwdays
 
Techniques for Automatic Device Identification and Network Assignment.pdf
Techniques for Automatic Device Identification and Network Assignment.pdf
Priyanka Aash
 
OWASP Barcelona 2025 Threat Model Library
OWASP Barcelona 2025 Threat Model Library
PetraVukmirovic
 
Curietech AI in action - Accelerate MuleSoft development
Curietech AI in action - Accelerate MuleSoft development
shyamraj55
 
Salesforce Summer '25 Release Frenchgathering.pptx.pdf
Salesforce Summer '25 Release Frenchgathering.pptx.pdf
yosra Saidani
 
cnc-processing-centers-centateq-p-110-en.pdf
cnc-processing-centers-centateq-p-110-en.pdf
AmirStern2
 
AI Agents and FME: A How-to Guide on Generating Synthetic Metadata
AI Agents and FME: A How-to Guide on Generating Synthetic Metadata
Safe Software
 
The Future of Product Management in AI ERA.pdf
The Future of Product Management in AI ERA.pdf
Alyona Owens
 
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
Priyanka Aash
 
Wenn alles versagt - IBM Tape schützt, was zählt! Und besonders mit dem neust...
Wenn alles versagt - IBM Tape schützt, was zählt! Und besonders mit dem neust...
Josef Weingand
 
9-1-1 Addressing: End-to-End Automation Using FME
9-1-1 Addressing: End-to-End Automation Using FME
Safe Software
 
AI vs Human Writing: Can You Tell the Difference?
AI vs Human Writing: Can You Tell the Difference?
Shashi Sathyanarayana, Ph.D
 
EIS-Webinar-Engineering-Retail-Infrastructure-06-16-2025.pdf
EIS-Webinar-Engineering-Retail-Infrastructure-06-16-2025.pdf
Earley Information Science
 
2025_06_18 - OpenMetadata Community Meeting.pdf
2025_06_18 - OpenMetadata Community Meeting.pdf
OpenMetadata
 
WebdriverIO & JavaScript: The Perfect Duo for Web Automation
WebdriverIO & JavaScript: The Perfect Duo for Web Automation
digitaljignect
 
Security Tips for Enterprise Azure Solutions
Security Tips for Enterprise Azure Solutions
Michele Leroux Bustamante
 
Quantum AI: Where Impossible Becomes Probable
Quantum AI: Where Impossible Becomes Probable
Saikat Basu
 
Securing AI - There Is No Try, Only Do!.pdf
Securing AI - There Is No Try, Only Do!.pdf
Priyanka Aash
 
Cracking the Code - Unveiling Synergies Between Open Source Security and AI.pdf
Cracking the Code - Unveiling Synergies Between Open Source Security and AI.pdf
Priyanka Aash
 
AI VIDEO MAGAZINE - June 2025 - r/aivideo
AI VIDEO MAGAZINE - June 2025 - r/aivideo
1pcity Studios, Inc
 
"Scaling in space and time with Temporal", Andriy Lupa.pdf
"Scaling in space and time with Temporal", Andriy Lupa.pdf
Fwdays
 
Techniques for Automatic Device Identification and Network Assignment.pdf
Techniques for Automatic Device Identification and Network Assignment.pdf
Priyanka Aash
 
OWASP Barcelona 2025 Threat Model Library
OWASP Barcelona 2025 Threat Model Library
PetraVukmirovic
 
Curietech AI in action - Accelerate MuleSoft development
Curietech AI in action - Accelerate MuleSoft development
shyamraj55
 
Salesforce Summer '25 Release Frenchgathering.pptx.pdf
Salesforce Summer '25 Release Frenchgathering.pptx.pdf
yosra Saidani
 
cnc-processing-centers-centateq-p-110-en.pdf
cnc-processing-centers-centateq-p-110-en.pdf
AmirStern2
 
AI Agents and FME: A How-to Guide on Generating Synthetic Metadata
AI Agents and FME: A How-to Guide on Generating Synthetic Metadata
Safe Software
 
The Future of Product Management in AI ERA.pdf
The Future of Product Management in AI ERA.pdf
Alyona Owens
 
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
Priyanka Aash
 
Wenn alles versagt - IBM Tape schützt, was zählt! Und besonders mit dem neust...
Wenn alles versagt - IBM Tape schützt, was zählt! Und besonders mit dem neust...
Josef Weingand
 
9-1-1 Addressing: End-to-End Automation Using FME
9-1-1 Addressing: End-to-End Automation Using FME
Safe Software
 

React - The JavaScript Library for User Interfaces

  • 2. About Me ● Solutions integrator at Jumping Bean – Developer & Trainer – Social Media ● Twitter @mxc4 ● Twitter @jumpingbeansa ● LinkedIn
  • 5. What Front-End Technology To Use? ● Mobile? – Native vs HTML5 ● Desktop? – Thin Client/Fat Client ● Swing ● Web? – HTML5, – ECMAScript 5,6,7 – Frameworks ● HTML5/JavaScript – Pros: ● Largest coverage, – Cons: ● Not as fast, slick or integrated as native apps
  • 6. The State of JavaScript Frameworks
  • 7. What to use for JS Front-End? ● Needed to redo a front-end – Angular – Seemed to be the emerging winner, ● Angular 1 versus Angular 2 – Others ● BackBone, ● Ember ● Where to go? ● I am Morpheus - Had to go find “The One”
  • 9. What is React? ● JavaScript library from – FaceBook – Instagram ● “A JavaScript library for building user interfaces” ● Originally built for Single Page Apps, ● Only the View part of an MVC framework
  • 10. How is React Different? ● Existing frameworks – add complexity, – Introduce JavaScript meta-languages, – Can be slow when number of interactive components increase ● One way data-binding ● Two way data-binding is expensive and slow
  • 11. React – A New Approach ● Declarative not imperative, ● UI built out of JavaScript defined components, ● One way data binding, – Immutable UI ● Build components not templates ● Major innovation – Virtual DOM – Generates
  • 12. Virtual DOM ● Abstracts away browser DOM, ● Translates from abstract DOM to concrete browser DOM, ● Power behind one-way binding and UI updates ● Write to Virtual DOM and then “compile” to JavaScript ● On state change generate entire html page and then generate differences and update
  • 13. Virtual DOM – Update Flow 1)Calculate old and new tree, 2)Diff them: – Two components of the same class will generate similar trees – two components of different classes will generate different trees. – It is possible to provide a unique key for elements that is stable across different renders 3) Update changed part of browser DOM
  • 14. Simplified Explanation of React ● Create Virtual DOM components in JavaScript, ● Everything with interactivity is a React component, ● State, i.e. changes propagate down component hierarchy, ● Basic approach – file per component
  • 15. React Component Creation - ES6 ● Create components extending React.Component, ● Implement render function, ● Return UI virtual DOM
  • 16. Creating a React Component
  • 17. JSX ● Optional HTML-like mark-up ● Declarative description of the UI inlined in JS code ● Combines ease-of-use of templates with power of JavaScript ● Preprocessor translates to plain JavaScript: ● On the fly (suitable during development) ● Offline using the React CLI
  • 19. How is Data/Model Provided to Components? ● One way data binding means data change in one place, – i.e only a component responsible for the data can change it, – All other sub-components can only read it, – If data is shared between components it is maintained in the common ancestor ● Props way to pass data from parent to child,→ ● State never leaves its containing component→
  • 20. Component Hierarchies ● Breaking your app into components hierarchies is key, ● Understanding data needs of components determine where state is kept
  • 21. Data Flow – Data is immutable ● Data passed down hierarchy via – this.props, properties are immutable,→ – this.state state should be held at the appropriate level in→ component hierarchy ● Parent components maintain state, ● How do child component changes to state propagate to parent? – Data passed up the hierarchy via parent event handlers being called by child components
  • 22. Data Flows Down Hierarchy via Properties
  • 23. Data Flow From Child to Parent Declare Handler in Parent
  • 24. Data Flow From Child To Parent Fire Handler in Child
  • 25. API Methods ● render() – Return single child element, – Can return null or false, – Should not do read or write to the DOM, – Best for server side rendering ● getInitialState() - – Used to set the state before component is mounted,
  • 26. API Methods ● getDefaultProps() – Invoked on class creation then cached, – Sets default values on missing props ● propTypes – Used to validate props passed to component, ● statics – Defines static methods for component
  • 27. Component Life Cycle Events ● componentWillMount – Invoked on client and server, – Can be used to set state before render is called, – Invoked on client and server before rendering ● componentDidMount – Invoked only on client after rendering, – Can access refs ● componentWillReceiveProps – Not called for initial render, – Used to setState
  • 28. Component Life Cycle Events ● shouldComponentUpdate – Return false to prevent updating ● componentWillUpdate ● componentDidUpdate, ● componentWillUnmount
  • 29. Challenges to React? ● HTML 5 Web Components – Custom components in HTML 5, – Tied to Web browser DOM Model, – Lots of reusable components will be available? – How to integrate with React components ● Possible but do you want this? ● If you don't do it will anyone use your framework?
  • 30. Mark Clarke @mxc4 Jumping Bean @jumpingbeansa WWW: www.JumpingBean.co.za