SlideShare a Scribd company logo
500TECH - AngularJS Consultancy
ReactJS & AngularJSReactJS & AngularJS
Chuck Norris doesn't need a framework - he updates the DOM directly, in C.
(not vs !)
Boris Dinkevich
500TECH - AngularJS Consultancy
Boris DinkevichBoris Dinkevich
CEO @ 500TECHCEO @ 500TECH
Cats, good weather and Ruby
500TECH - AngularJS Consultancy
What is ReactJS ?What is ReactJS ?
Component framework
Virtual DOM
Adding React to AngularAdding React to Angular
500TECH - AngularJS Consultancy
500TECH - AngularJS Consultancy
angular.module("sampleapp", [])
.directive("sampleDirective", function() {
return {
template: "<h2>Angular directive</h2>"
}
});
<body>
<sample-directive></sample-directive>
</body>
Example code
var MyComponent = React.createClass({
render: function() {
return <h2>React Component</h2>;
}
});
The basicsThe basics
angular.module("sampleapp")
.directive("reactContainer", function() {
return {
template: '<div></div>',
link: function(scope, element, attrs) {
return React.render(React.createElement(MyComponent, null), element[0]);
}
}
});
500TECH - AngularJS Consultancy
<body>
<sample-directive></sample-directive>
<react-container></react-container>
</body>
var MyComponent = React.createClass({
render: function() {
return <h2>React Component</h2>;
}
});
Directive to render a ComponentDirective to render a Component
500TECH - AngularJS Consultancy
angular.module("sampleapp")
.directive("reactContainer", function() {
return {
template: '<div></div>',
link: function(scope, element, attrs) {
return React.render(
React.createElement(MyComponent, null),
element[0]);
}
}
});
Directive to render a ComponentDirective to render a Component
500TECH - AngularJS Consultancy
ngReactngReact
https://github.com/davidchang/ngReact
500TECH - AngularJS Consultancy
Thank you, buh bye !Thank you, buh bye !
500TECH - AngularJS Consultancy
Dependency Injection - IDependency Injection - I
Example code
return React.createClass({
render: function() {
return React.createElement("h2", null, "React Component");
}
});
angular.module("sampleapp")
.factory("ReactComponent", function() {
return React.createClass({
render: function() {
return React.createElement("h2", null, "React Component");
}
});
})
500TECH - AngularJS Consultancy
Dependency Injection - IIDependency Injection - II
Example code
angular.module("sampleapp")
.factory("ReactComponent", function() {
return React.createClass({
render: function() {
return React.createElement("h2", null, "React Component");
}
});
})
angular.module("sampleapp")
.factory("ReactComponent", function(DataService) {
return React.createClass({
render: function() {
return React.createElement("h2", null, "React Component: ", DataService.data());
}
});
})
500TECH - AngularJS Consultancy
Dependency Injection - IIIDependency Injection - III
Example code
// ReactComponent = ....
angular.module("sampleapp")
.directive("reactContainer", function() {
return {
template: '<div></div>',
link: function(scope, element, attrs) {
return React.render(
React.createElement(ReactComponent, null), element[0]
);
}
}
});
angular.module("sampleapp")
.directive("reactContainer", function(ReactComponent) {
return {
template: '<div></div>',
link: function(scope, element, attrs) {
return React.render(
React.createElement(ReactComponent, null), element[0]
);
}
}
});
500TECH - AngularJS Consultancy
Dependency Injection - IVDependency Injection - IV
angular.module("sampleapp")
.factory("HeaderComponent", function(DataService) {
return React.createClass({
render: function() {
return React.createElement("h2", null, "React Component: ", DataService.data());
}
});
})
angular.module("sampleapp")
.factory("ComplexComponent", function(HeaderComponent, FooterComponent) {
return React.createClass({
render: function() {
React.createElement("div", null,
React.createElement(HeaderComponent, null),
React.createElement("div", null, "Some nice graphics"),
React.createElement(FooterComponent, null)
)}
});
})
500TECH - AngularJS Consultancy
Going crazyGoing crazy
Angular in React in Angular in React in Angular
Example code
angular.module("sampleapp")
.factory("ComplexComponent", function(HeaderComponent, FooterComponent) {
return React.createClass({
render: function() {
return
React.createElement("div", null,
React.createElement(HeaderComponent, null),
React.createElement("div", null, "Some nice graphics"),
React.createElement(FooterComponent, null)
);
}
});
})
500TECH - AngularJS Consultancy
angular.module("sampleapp")
.factory("ComplexComponent", function(HeaderComponent, FooterComponent) {
return React.createClass({
render: function() {
return (
<div>
<HeaderComponent />
<div>Some nice graphics</div>
<FooterComponent />
</div>
);
}
});
})
JSXJSX
Babel
JSX-transpiler
Works with Webpack/Gulp/Grunt/etc
500TECH - AngularJS Consultancy
Directory structureDirectory structure
App
|
|- directives
|- services
|- components
|
.
.
.
500TECH - AngularJS Consultancy
But wait..But wait..
return React.createElement(
"h2",
null,
"React Component: ",
DataService.data()
);
DataServices.data() ?
500TECH - AngularJS Consultancy
There is no $watchThere is no $watch
If you want data binding, you can either use
Angular's or roll out your own (flux).
Example code
“ $broadcast makes more sense there
500TECH - AngularJS Consultancy
The Angular wayThe Angular way
We have Dependency Injection...
We have $rootScope or container's Isolated Scope
We have $on & $watch
We can use digest !
“ Uh oh..
500TECH - AngularJS Consultancy
How does Angular renderHow does Angular render
Digest cycleDigest cycle
500TECH - AngularJS Consultancy
How does React renderHow does React render
Data modeling - NOT Virtual DOMData modeling - NOT Virtual DOM
500TECH - AngularJS Consultancy
-- ProfileComponent
<div class="row">
<div class="col-sm-6">
<div class="profile-pic">
<img src="/images/51233221.jpg" />
</div>
</div>
<div class="col-sm-6">
<div class="data-container">
<span>
<i class="icon-name"></i>
Boris Dinkevich
</span>
</div>
<div class="data-container">
<span>
<i class="icon-age"></i>
33
</span>
</div>
</div>
So what is this Virtual DOM ?So what is this Virtual DOM ?
500TECH - AngularJS Consultancy
So what is this Virtual DOM ?So what is this Virtual DOM ?
-- ProfileComponent
<div class="row">
<div class="col-sm-6">
<div class="profile-pic">
<img src="/images/51233221.jpg" />
</div>
</div>
<div class="col-sm-6">
<div class="data-container">
<span>
<i class="icon-name"></i>
Boris Dinkevich
</span>
</div>
<div class="data-container">
<span>
<i class="icon-age"></i>
34
</span>
</div>
</div>
-- ProfileComponent
<div class="row">
<div class="col-sm-6">
<div class="profile-pic">
<img src="/images/51233221.jpg" />
</div>
</div>
<div class="col-sm-6">
<div class="data-container">
<span>
<i class="icon-name"></i>
Boris Dinkevich
</span>
</div>
<div class="data-container">
<span>
<i class="icon-age"></i>
33
</span>
</div>
</div>
500TECH - AngularJS Consultancy
Wow right ?Wow right ?
ReactJS saved DOM manipulations by
calculating the diff itself.
.. in JavaScript ..
React.js Conf 2015 - Hype!
Angular + React = Speed Dave Smith
500TECH - AngularJS Consultancy
500TECH - AngularJS Consultancy
"Speed" comparison"Speed" comparison
If you look carefuly, most samples of AngularJS vs ReactJS either:
Unoptimized Angular side
React.js Conf 2015 - Hype!
Fixed github demo PR (Angular is 2x faster than React)
Compares data binding ($digest), not rendering.
Angular + React = Speed Dave Smith
Fixed github demo PR (Angular and React same speed)
“ "In theory, there ought to be no difference between theory and practice. In practice, there is."
500TECH - AngularJS Consultancy
So why React ?So why React ?
Components life cycle
Clear state management
Break away from $digest
Server side rendering !
Buzz
500TECH - AngularJS Consultancy
So why React ?So why React ?
Total results: {{ ? }}
Available ?
Isolated scope digest
Isolated scope digest
Isolated scope digest
500TECH - AngularJS Consultancy
Server RenderingServer Rendering
SEO
Fast page load (bind later)
Embed in page before Angular even runs
["hip","hip"]
500TECH - AngularJS Consultancy
Life cycleLife cycle
“ You can simulate everything in
AngularJS, but then its not AngularJS.
500TECH - AngularJS Consultancy
JSX ?JSX ?
React.createElement("div", null,
React.createElement(HeaderComponent, null),
React.createElement("div", null, "Some nice graphics"),
React.createElement(FooterComponent, null)
)}
500TECH - AngularJS Consultancy
Directive TemplateDirective Template
<div class="row">
<div class="controls" ng-class={ visible: ctrl.canAdd}>
<button ng-click="ctrl.addRow">New row</button>
<a class="back-button" href="">Go back</a>
</div>
<div ng-repeat="row in ctrl.rows" class="item">{{ row.name }}</div>
<HelpMessage type="addRow" ng-if="ctrl.canAdd"></HelpMessage>
</div>
500TECH - AngularJS Consultancy
JSXJSX
render: function() {
var className = cx({
'visible': this.state.canAdd,
'controls': true
});
var renderRow = function(row) {
return (<div className="item">{ row.name }</div>);
}
return (
<div className="row">
<div className={ className }>
<button onClick={ this.addRow }>New row</button>
<a className="back-button" href="">Go back</a>
</div>
{ this.state.rows.map(renderRow) }
{ this.state.canAdd ? <HelpMessage type="addRow" /> : null }
</div>
);
}
500TECH - AngularJS Consultancy
JSXJSX
Interesting solution from Wix ( )
Work directly with final result
Splitting to very large of mini components
react-templates
500TECH - AngularJS Consultancy
Data ModelingData Modeling
500TECH - AngularJS Consultancy
Angular / MVVMAngular / MVVM
Data flowData flow
500TECH - AngularJS Consultancy
FluxFlux
A Pattern - Not a libraryA Pattern - Not a library
“ All arrows go one way
500TECH - AngularJS Consultancy
Flux librariesFlux libraries
Facebook Flux
Fluxible by Yahoo
Reflux
Alt
Flummox
Marty
McFly
Lux
Material Flux
Delorean
500TECH - AngularJS Consultancy
Flux in AngularFlux in Angular
Regular services
EventEmitter / $broadcast
ReactJS Flux libraries
500TECH - AngularJS Consultancy
Angular 2.0Angular 2.0
500TECH - AngularJS Consultancy
Questions ?Questions ?
Thank you !
Boris@500Tech.com
Amazing AngularJS / NodeJS / ReactJS Dev ?
Want to hone your skills on projects of all size and shape ?
Work in Israel & NYC ?
- Talk to me at the break
Our next AngularJS Course
starts this Wedensday

More Related Content

What's hot (20)

AngularJS - Overcoming performance issues. Limits.
AngularJS - Overcoming performance issues. Limits.AngularJS - Overcoming performance issues. Limits.
AngularJS - Overcoming performance issues. Limits.
Dragos Mihai Rusu
 
Advanced Tips & Tricks for using Angular JS
Advanced Tips & Tricks for using Angular JSAdvanced Tips & Tricks for using Angular JS
Advanced Tips & Tricks for using Angular JS
Simon Guest
 
Learn react-js
Learn react-jsLearn react-js
Learn react-js
C...L, NESPRESSO, WAFAASSURANCE, SOFRECOM ORANGE
 
Overview of the AngularJS framework
Overview of the AngularJS framework Overview of the AngularJS framework
Overview of the AngularJS framework
Yakov Fain
 
The Art of AngularJS - DeRailed 2014
The Art of AngularJS - DeRailed 2014The Art of AngularJS - DeRailed 2014
The Art of AngularJS - DeRailed 2014
Matt Raible
 
AngularJS best-practices
AngularJS best-practicesAngularJS best-practices
AngularJS best-practices
Henry Tao
 
A gently introduction to AngularJS
A gently introduction to AngularJSA gently introduction to AngularJS
A gently introduction to AngularJS
Gregor Woiwode
 
Angular2 for Beginners
Angular2 for BeginnersAngular2 for Beginners
Angular2 for Beginners
Oswald Campesato
 
AngularJS One Day Workshop
AngularJS One Day WorkshopAngularJS One Day Workshop
AngularJS One Day Workshop
Shyam Seshadri
 
React vs-angular-mobile
React vs-angular-mobileReact vs-angular-mobile
React vs-angular-mobile
Michael Haberman
 
AngularJS application architecture
AngularJS application architectureAngularJS application architecture
AngularJS application architecture
Gabriele Falace
 
AngularJS - What is it & Why is it awesome ? (with demos)
AngularJS - What is it & Why is it awesome ? (with demos)AngularJS - What is it & Why is it awesome ? (with demos)
AngularJS - What is it & Why is it awesome ? (with demos)
Gary Arora
 
AngularJS Basics
AngularJS BasicsAngularJS Basics
AngularJS Basics
Ravi Mone
 
React Facebook JavaScript Library
React Facebook JavaScript LibraryReact Facebook JavaScript Library
React Facebook JavaScript Library
Takami Kazuya
 
AngularJS for Java Developers
AngularJS for Java DevelopersAngularJS for Java Developers
AngularJS for Java Developers
Loc Nguyen
 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJS
Jussi Pohjolainen
 
Gettings started with the superheroic JavaScript library AngularJS
Gettings started with the superheroic JavaScript library AngularJSGettings started with the superheroic JavaScript library AngularJS
Gettings started with the superheroic JavaScript library AngularJS
Armin Vieweg
 
A Brief Introduction to React.js
A Brief Introduction to React.jsA Brief Introduction to React.js
A Brief Introduction to React.js
Doug Neiner
 
20180518 QNAP Seminar - Introduction to React Native
20180518 QNAP Seminar - Introduction to React Native20180518 QNAP Seminar - Introduction to React Native
20180518 QNAP Seminar - Introduction to React Native
Eric Deng
 
AngularJs presentation
AngularJs presentation AngularJs presentation
AngularJs presentation
Phan Tuan
 
AngularJS - Overcoming performance issues. Limits.
AngularJS - Overcoming performance issues. Limits.AngularJS - Overcoming performance issues. Limits.
AngularJS - Overcoming performance issues. Limits.
Dragos Mihai Rusu
 
Advanced Tips & Tricks for using Angular JS
Advanced Tips & Tricks for using Angular JSAdvanced Tips & Tricks for using Angular JS
Advanced Tips & Tricks for using Angular JS
Simon Guest
 
Overview of the AngularJS framework
Overview of the AngularJS framework Overview of the AngularJS framework
Overview of the AngularJS framework
Yakov Fain
 
The Art of AngularJS - DeRailed 2014
The Art of AngularJS - DeRailed 2014The Art of AngularJS - DeRailed 2014
The Art of AngularJS - DeRailed 2014
Matt Raible
 
AngularJS best-practices
AngularJS best-practicesAngularJS best-practices
AngularJS best-practices
Henry Tao
 
A gently introduction to AngularJS
A gently introduction to AngularJSA gently introduction to AngularJS
A gently introduction to AngularJS
Gregor Woiwode
 
AngularJS One Day Workshop
AngularJS One Day WorkshopAngularJS One Day Workshop
AngularJS One Day Workshop
Shyam Seshadri
 
AngularJS application architecture
AngularJS application architectureAngularJS application architecture
AngularJS application architecture
Gabriele Falace
 
AngularJS - What is it & Why is it awesome ? (with demos)
AngularJS - What is it & Why is it awesome ? (with demos)AngularJS - What is it & Why is it awesome ? (with demos)
AngularJS - What is it & Why is it awesome ? (with demos)
Gary Arora
 
AngularJS Basics
AngularJS BasicsAngularJS Basics
AngularJS Basics
Ravi Mone
 
React Facebook JavaScript Library
React Facebook JavaScript LibraryReact Facebook JavaScript Library
React Facebook JavaScript Library
Takami Kazuya
 
AngularJS for Java Developers
AngularJS for Java DevelopersAngularJS for Java Developers
AngularJS for Java Developers
Loc Nguyen
 
Gettings started with the superheroic JavaScript library AngularJS
Gettings started with the superheroic JavaScript library AngularJSGettings started with the superheroic JavaScript library AngularJS
Gettings started with the superheroic JavaScript library AngularJS
Armin Vieweg
 
A Brief Introduction to React.js
A Brief Introduction to React.jsA Brief Introduction to React.js
A Brief Introduction to React.js
Doug Neiner
 
20180518 QNAP Seminar - Introduction to React Native
20180518 QNAP Seminar - Introduction to React Native20180518 QNAP Seminar - Introduction to React Native
20180518 QNAP Seminar - Introduction to React Native
Eric Deng
 
AngularJs presentation
AngularJs presentation AngularJs presentation
AngularJs presentation
Phan Tuan
 

Similar to Using ReactJS in AngularJS (20)

Getting Started with React, When You’re an Angular Developer
Getting Started with React, When You’re an Angular DeveloperGetting Started with React, When You’re an Angular Developer
Getting Started with React, When You’re an Angular Developer
Fabrit Global
 
React js - The Core Concepts
React js - The Core ConceptsReact js - The Core Concepts
React js - The Core Concepts
Divyang Bhambhani
 
The State of Front-end At CrowdTwist
The State of Front-end At CrowdTwistThe State of Front-end At CrowdTwist
The State of Front-end At CrowdTwist
Mark Fayngersh
 
Comparing Angular and React JS for SPAs
Comparing Angular and React JS for SPAsComparing Angular and React JS for SPAs
Comparing Angular and React JS for SPAs
Jennifer Estrada
 
Tech Talk on ReactJS
Tech Talk on ReactJSTech Talk on ReactJS
Tech Talk on ReactJS
Atlogys Technical Consulting
 
React vs Angular, Head-to-head Comparison
React vs Angular, Head-to-head ComparisonReact vs Angular, Head-to-head Comparison
React vs Angular, Head-to-head Comparison
The Tech Clouds
 
Up and Running with ReactJS
Up and Running with ReactJSUp and Running with ReactJS
Up and Running with ReactJS
Loc Nguyen
 
Incremental DOM and Recent Trend of Frontend Development
Incremental DOM and Recent Trend of Frontend DevelopmentIncremental DOM and Recent Trend of Frontend Development
Incremental DOM and Recent Trend of Frontend Development
Akihiro Ikezoe
 
AngularJS vs ReactJS: Which One is Best for Next Front-end Development
 AngularJS vs ReactJS: Which One is Best for Next Front-end Development AngularJS vs ReactJS: Which One is Best for Next Front-end Development
AngularJS vs ReactJS: Which One is Best for Next Front-end Development
Andolasoft Inc
 
Angularjs
AngularjsAngularjs
Angularjs
Ynon Perek
 
React js
React jsReact js
React js
Rajesh Kolla
 
[Final] ReactJS presentation
[Final] ReactJS presentation[Final] ReactJS presentation
[Final] ReactJS presentation
洪 鹏发
 
Frontin like-a-backer
Frontin like-a-backerFrontin like-a-backer
Frontin like-a-backer
Frank de Jonge
 
Reactjs notes.pptx for web development- tutorial and theory
Reactjs  notes.pptx for web development- tutorial and theoryReactjs  notes.pptx for web development- tutorial and theory
Reactjs notes.pptx for web development- tutorial and theory
jobinThomas54
 
Intro to React.js
Intro to React.jsIntro to React.js
Intro to React.js
Smita Prasad
 
Web technologies-course 12.pptx
Web technologies-course 12.pptxWeb technologies-course 12.pptx
Web technologies-course 12.pptx
Stefan Oprea
 
React JS .NET
React JS .NETReact JS .NET
React JS .NET
Jennifer Estrada
 
React Development with the MERN Stack
React Development with the MERN StackReact Development with the MERN Stack
React Development with the MERN Stack
Troy Miles
 
Review on React JS
Review on React JSReview on React JS
Review on React JS
ijtsrd
 
Fly High With Angular - How to build an app using Angular
Fly High With Angular - How to build an app using AngularFly High With Angular - How to build an app using Angular
Fly High With Angular - How to build an app using Angular
Vacation Labs
 
Getting Started with React, When You’re an Angular Developer
Getting Started with React, When You’re an Angular DeveloperGetting Started with React, When You’re an Angular Developer
Getting Started with React, When You’re an Angular Developer
Fabrit Global
 
React js - The Core Concepts
React js - The Core ConceptsReact js - The Core Concepts
React js - The Core Concepts
Divyang Bhambhani
 
The State of Front-end At CrowdTwist
The State of Front-end At CrowdTwistThe State of Front-end At CrowdTwist
The State of Front-end At CrowdTwist
Mark Fayngersh
 
Comparing Angular and React JS for SPAs
Comparing Angular and React JS for SPAsComparing Angular and React JS for SPAs
Comparing Angular and React JS for SPAs
Jennifer Estrada
 
React vs Angular, Head-to-head Comparison
React vs Angular, Head-to-head ComparisonReact vs Angular, Head-to-head Comparison
React vs Angular, Head-to-head Comparison
The Tech Clouds
 
Up and Running with ReactJS
Up and Running with ReactJSUp and Running with ReactJS
Up and Running with ReactJS
Loc Nguyen
 
Incremental DOM and Recent Trend of Frontend Development
Incremental DOM and Recent Trend of Frontend DevelopmentIncremental DOM and Recent Trend of Frontend Development
Incremental DOM and Recent Trend of Frontend Development
Akihiro Ikezoe
 
AngularJS vs ReactJS: Which One is Best for Next Front-end Development
 AngularJS vs ReactJS: Which One is Best for Next Front-end Development AngularJS vs ReactJS: Which One is Best for Next Front-end Development
AngularJS vs ReactJS: Which One is Best for Next Front-end Development
Andolasoft Inc
 
[Final] ReactJS presentation
[Final] ReactJS presentation[Final] ReactJS presentation
[Final] ReactJS presentation
洪 鹏发
 
Reactjs notes.pptx for web development- tutorial and theory
Reactjs  notes.pptx for web development- tutorial and theoryReactjs  notes.pptx for web development- tutorial and theory
Reactjs notes.pptx for web development- tutorial and theory
jobinThomas54
 
Web technologies-course 12.pptx
Web technologies-course 12.pptxWeb technologies-course 12.pptx
Web technologies-course 12.pptx
Stefan Oprea
 
React Development with the MERN Stack
React Development with the MERN StackReact Development with the MERN Stack
React Development with the MERN Stack
Troy Miles
 
Review on React JS
Review on React JSReview on React JS
Review on React JS
ijtsrd
 
Fly High With Angular - How to build an app using Angular
Fly High With Angular - How to build an app using AngularFly High With Angular - How to build an app using Angular
Fly High With Angular - How to build an app using Angular
Vacation Labs
 
Ad

More from Boris Dinkevich (6)

Advanced redux
Advanced reduxAdvanced redux
Advanced redux
Boris Dinkevich
 
Reduxing like a pro
Reduxing like a proReduxing like a pro
Reduxing like a pro
Boris Dinkevich
 
Introduction to ReactJS and Redux
Introduction to ReactJS and ReduxIntroduction to ReactJS and Redux
Introduction to ReactJS and Redux
Boris Dinkevich
 
From render() to DOM
From render() to DOMFrom render() to DOM
From render() to DOM
Boris Dinkevich
 
Introduction to React & Redux
Introduction to React & ReduxIntroduction to React & Redux
Introduction to React & Redux
Boris Dinkevich
 
Why ruby on rails
Why ruby on railsWhy ruby on rails
Why ruby on rails
Boris Dinkevich
 
Ad

Recently uploaded (20)

War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdfWar_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
biswajitbanerjee38
 
vertical-cnc-processing-centers-drillteq-v-200-en.pdf
vertical-cnc-processing-centers-drillteq-v-200-en.pdfvertical-cnc-processing-centers-drillteq-v-200-en.pdf
vertical-cnc-processing-centers-drillteq-v-200-en.pdf
AmirStern2
 
Crypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdfCrypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdf
Stephen Perrenod
 
Data Validation and System Interoperability
Data Validation and System InteroperabilityData Validation and System Interoperability
Data Validation and System Interoperability
Safe Software
 
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdfcnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
AmirStern2
 
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Anish Kumar
 
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven InfrastructureNo-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
Safe Software
 
Bridging the divide: A conversation on tariffs today in the book industry - T...
Bridging the divide: A conversation on tariffs today in the book industry - T...Bridging the divide: A conversation on tariffs today in the book industry - T...
Bridging the divide: A conversation on tariffs today in the book industry - T...
BookNet Canada
 
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptxFIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Alliance
 
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
Safe Software
 
Supporting the NextGen 911 Digital Transformation with FME
Supporting the NextGen 911 Digital Transformation with FMESupporting the NextGen 911 Digital Transformation with FME
Supporting the NextGen 911 Digital Transformation with FME
Safe Software
 
Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Safe Software
 
Enabling BIM / GIS integrations with Other Systems with FME
Enabling BIM / GIS integrations with Other Systems with FMEEnabling BIM / GIS integrations with Other Systems with FME
Enabling BIM / GIS integrations with Other Systems with FME
Safe Software
 
AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...
AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...
AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...
SOFTTECHHUB
 
Oracle Cloud and AI Specialization Program
Oracle Cloud and AI Specialization ProgramOracle Cloud and AI Specialization Program
Oracle Cloud and AI Specialization Program
VICTOR MAESTRE RAMIREZ
 
Mastering AI Workflows with FME - Peak of Data & AI 2025
Mastering AI Workflows with FME - Peak of Data & AI 2025Mastering AI Workflows with FME - Peak of Data & AI 2025
Mastering AI Workflows with FME - Peak of Data & AI 2025
Safe Software
 
Oracle Cloud Infrastructure Generative AI Professional
Oracle Cloud Infrastructure Generative AI ProfessionalOracle Cloud Infrastructure Generative AI Professional
Oracle Cloud Infrastructure Generative AI Professional
VICTOR MAESTRE RAMIREZ
 
“Addressing Evolving AI Model Challenges Through Memory and Storage,” a Prese...
“Addressing Evolving AI Model Challenges Through Memory and Storage,” a Prese...“Addressing Evolving AI Model Challenges Through Memory and Storage,” a Prese...
“Addressing Evolving AI Model Challenges Through Memory and Storage,” a Prese...
Edge AI and Vision Alliance
 
“From Enterprise to Makers: Driving Vision AI Innovation at the Extreme Edge,...
“From Enterprise to Makers: Driving Vision AI Innovation at the Extreme Edge,...“From Enterprise to Makers: Driving Vision AI Innovation at the Extreme Edge,...
“From Enterprise to Makers: Driving Vision AI Innovation at the Extreme Edge,...
Edge AI and Vision Alliance
 
Artificial Intelligence in the Nonprofit Boardroom.pdf
Artificial Intelligence in the Nonprofit Boardroom.pdfArtificial Intelligence in the Nonprofit Boardroom.pdf
Artificial Intelligence in the Nonprofit Boardroom.pdf
OnBoard
 
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdfWar_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
biswajitbanerjee38
 
vertical-cnc-processing-centers-drillteq-v-200-en.pdf
vertical-cnc-processing-centers-drillteq-v-200-en.pdfvertical-cnc-processing-centers-drillteq-v-200-en.pdf
vertical-cnc-processing-centers-drillteq-v-200-en.pdf
AmirStern2
 
Crypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdfCrypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdf
Stephen Perrenod
 
Data Validation and System Interoperability
Data Validation and System InteroperabilityData Validation and System Interoperability
Data Validation and System Interoperability
Safe Software
 
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdfcnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
AmirStern2
 
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Anish Kumar
 
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven InfrastructureNo-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
Safe Software
 
Bridging the divide: A conversation on tariffs today in the book industry - T...
Bridging the divide: A conversation on tariffs today in the book industry - T...Bridging the divide: A conversation on tariffs today in the book industry - T...
Bridging the divide: A conversation on tariffs today in the book industry - T...
BookNet Canada
 
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptxFIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Alliance
 
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
Safe Software
 
Supporting the NextGen 911 Digital Transformation with FME
Supporting the NextGen 911 Digital Transformation with FMESupporting the NextGen 911 Digital Transformation with FME
Supporting the NextGen 911 Digital Transformation with FME
Safe Software
 
Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Safe Software
 
Enabling BIM / GIS integrations with Other Systems with FME
Enabling BIM / GIS integrations with Other Systems with FMEEnabling BIM / GIS integrations with Other Systems with FME
Enabling BIM / GIS integrations with Other Systems with FME
Safe Software
 
AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...
AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...
AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...
SOFTTECHHUB
 
Oracle Cloud and AI Specialization Program
Oracle Cloud and AI Specialization ProgramOracle Cloud and AI Specialization Program
Oracle Cloud and AI Specialization Program
VICTOR MAESTRE RAMIREZ
 
Mastering AI Workflows with FME - Peak of Data & AI 2025
Mastering AI Workflows with FME - Peak of Data & AI 2025Mastering AI Workflows with FME - Peak of Data & AI 2025
Mastering AI Workflows with FME - Peak of Data & AI 2025
Safe Software
 
Oracle Cloud Infrastructure Generative AI Professional
Oracle Cloud Infrastructure Generative AI ProfessionalOracle Cloud Infrastructure Generative AI Professional
Oracle Cloud Infrastructure Generative AI Professional
VICTOR MAESTRE RAMIREZ
 
“Addressing Evolving AI Model Challenges Through Memory and Storage,” a Prese...
“Addressing Evolving AI Model Challenges Through Memory and Storage,” a Prese...“Addressing Evolving AI Model Challenges Through Memory and Storage,” a Prese...
“Addressing Evolving AI Model Challenges Through Memory and Storage,” a Prese...
Edge AI and Vision Alliance
 
“From Enterprise to Makers: Driving Vision AI Innovation at the Extreme Edge,...
“From Enterprise to Makers: Driving Vision AI Innovation at the Extreme Edge,...“From Enterprise to Makers: Driving Vision AI Innovation at the Extreme Edge,...
“From Enterprise to Makers: Driving Vision AI Innovation at the Extreme Edge,...
Edge AI and Vision Alliance
 
Artificial Intelligence in the Nonprofit Boardroom.pdf
Artificial Intelligence in the Nonprofit Boardroom.pdfArtificial Intelligence in the Nonprofit Boardroom.pdf
Artificial Intelligence in the Nonprofit Boardroom.pdf
OnBoard
 

Using ReactJS in AngularJS

  • 1. 500TECH - AngularJS Consultancy ReactJS & AngularJSReactJS & AngularJS Chuck Norris doesn't need a framework - he updates the DOM directly, in C. (not vs !) Boris Dinkevich
  • 2. 500TECH - AngularJS Consultancy Boris DinkevichBoris Dinkevich CEO @ 500TECHCEO @ 500TECH Cats, good weather and Ruby
  • 3. 500TECH - AngularJS Consultancy What is ReactJS ?What is ReactJS ? Component framework Virtual DOM
  • 4. Adding React to AngularAdding React to Angular 500TECH - AngularJS Consultancy
  • 5. 500TECH - AngularJS Consultancy angular.module("sampleapp", []) .directive("sampleDirective", function() { return { template: "<h2>Angular directive</h2>" } }); <body> <sample-directive></sample-directive> </body> Example code var MyComponent = React.createClass({ render: function() { return <h2>React Component</h2>; } }); The basicsThe basics
  • 6. angular.module("sampleapp") .directive("reactContainer", function() { return { template: '<div></div>', link: function(scope, element, attrs) { return React.render(React.createElement(MyComponent, null), element[0]); } } }); 500TECH - AngularJS Consultancy <body> <sample-directive></sample-directive> <react-container></react-container> </body> var MyComponent = React.createClass({ render: function() { return <h2>React Component</h2>; } }); Directive to render a ComponentDirective to render a Component
  • 7. 500TECH - AngularJS Consultancy angular.module("sampleapp") .directive("reactContainer", function() { return { template: '<div></div>', link: function(scope, element, attrs) { return React.render( React.createElement(MyComponent, null), element[0]); } } }); Directive to render a ComponentDirective to render a Component
  • 8. 500TECH - AngularJS Consultancy ngReactngReact https://github.com/davidchang/ngReact
  • 9. 500TECH - AngularJS Consultancy Thank you, buh bye !Thank you, buh bye !
  • 10. 500TECH - AngularJS Consultancy Dependency Injection - IDependency Injection - I Example code return React.createClass({ render: function() { return React.createElement("h2", null, "React Component"); } }); angular.module("sampleapp") .factory("ReactComponent", function() { return React.createClass({ render: function() { return React.createElement("h2", null, "React Component"); } }); })
  • 11. 500TECH - AngularJS Consultancy Dependency Injection - IIDependency Injection - II Example code angular.module("sampleapp") .factory("ReactComponent", function() { return React.createClass({ render: function() { return React.createElement("h2", null, "React Component"); } }); }) angular.module("sampleapp") .factory("ReactComponent", function(DataService) { return React.createClass({ render: function() { return React.createElement("h2", null, "React Component: ", DataService.data()); } }); })
  • 12. 500TECH - AngularJS Consultancy Dependency Injection - IIIDependency Injection - III Example code // ReactComponent = .... angular.module("sampleapp") .directive("reactContainer", function() { return { template: '<div></div>', link: function(scope, element, attrs) { return React.render( React.createElement(ReactComponent, null), element[0] ); } } }); angular.module("sampleapp") .directive("reactContainer", function(ReactComponent) { return { template: '<div></div>', link: function(scope, element, attrs) { return React.render( React.createElement(ReactComponent, null), element[0] ); } } });
  • 13. 500TECH - AngularJS Consultancy Dependency Injection - IVDependency Injection - IV angular.module("sampleapp") .factory("HeaderComponent", function(DataService) { return React.createClass({ render: function() { return React.createElement("h2", null, "React Component: ", DataService.data()); } }); }) angular.module("sampleapp") .factory("ComplexComponent", function(HeaderComponent, FooterComponent) { return React.createClass({ render: function() { React.createElement("div", null, React.createElement(HeaderComponent, null), React.createElement("div", null, "Some nice graphics"), React.createElement(FooterComponent, null) )} }); })
  • 14. 500TECH - AngularJS Consultancy Going crazyGoing crazy Angular in React in Angular in React in Angular Example code
  • 15. angular.module("sampleapp") .factory("ComplexComponent", function(HeaderComponent, FooterComponent) { return React.createClass({ render: function() { return React.createElement("div", null, React.createElement(HeaderComponent, null), React.createElement("div", null, "Some nice graphics"), React.createElement(FooterComponent, null) ); } }); }) 500TECH - AngularJS Consultancy angular.module("sampleapp") .factory("ComplexComponent", function(HeaderComponent, FooterComponent) { return React.createClass({ render: function() { return ( <div> <HeaderComponent /> <div>Some nice graphics</div> <FooterComponent /> </div> ); } }); }) JSXJSX Babel JSX-transpiler Works with Webpack/Gulp/Grunt/etc
  • 16. 500TECH - AngularJS Consultancy Directory structureDirectory structure App | |- directives |- services |- components | . . .
  • 17. 500TECH - AngularJS Consultancy But wait..But wait.. return React.createElement( "h2", null, "React Component: ", DataService.data() ); DataServices.data() ?
  • 18. 500TECH - AngularJS Consultancy There is no $watchThere is no $watch If you want data binding, you can either use Angular's or roll out your own (flux). Example code “ $broadcast makes more sense there
  • 19. 500TECH - AngularJS Consultancy The Angular wayThe Angular way We have Dependency Injection... We have $rootScope or container's Isolated Scope We have $on & $watch We can use digest ! “ Uh oh..
  • 20. 500TECH - AngularJS Consultancy How does Angular renderHow does Angular render Digest cycleDigest cycle
  • 21. 500TECH - AngularJS Consultancy How does React renderHow does React render Data modeling - NOT Virtual DOMData modeling - NOT Virtual DOM
  • 22. 500TECH - AngularJS Consultancy -- ProfileComponent <div class="row"> <div class="col-sm-6"> <div class="profile-pic"> <img src="/images/51233221.jpg" /> </div> </div> <div class="col-sm-6"> <div class="data-container"> <span> <i class="icon-name"></i> Boris Dinkevich </span> </div> <div class="data-container"> <span> <i class="icon-age"></i> 33 </span> </div> </div> So what is this Virtual DOM ?So what is this Virtual DOM ?
  • 23. 500TECH - AngularJS Consultancy So what is this Virtual DOM ?So what is this Virtual DOM ? -- ProfileComponent <div class="row"> <div class="col-sm-6"> <div class="profile-pic"> <img src="/images/51233221.jpg" /> </div> </div> <div class="col-sm-6"> <div class="data-container"> <span> <i class="icon-name"></i> Boris Dinkevich </span> </div> <div class="data-container"> <span> <i class="icon-age"></i> 34 </span> </div> </div> -- ProfileComponent <div class="row"> <div class="col-sm-6"> <div class="profile-pic"> <img src="/images/51233221.jpg" /> </div> </div> <div class="col-sm-6"> <div class="data-container"> <span> <i class="icon-name"></i> Boris Dinkevich </span> </div> <div class="data-container"> <span> <i class="icon-age"></i> 33 </span> </div> </div>
  • 24. 500TECH - AngularJS Consultancy Wow right ?Wow right ? ReactJS saved DOM manipulations by calculating the diff itself. .. in JavaScript .. React.js Conf 2015 - Hype! Angular + React = Speed Dave Smith
  • 25. 500TECH - AngularJS Consultancy
  • 26. 500TECH - AngularJS Consultancy "Speed" comparison"Speed" comparison If you look carefuly, most samples of AngularJS vs ReactJS either: Unoptimized Angular side React.js Conf 2015 - Hype! Fixed github demo PR (Angular is 2x faster than React) Compares data binding ($digest), not rendering. Angular + React = Speed Dave Smith Fixed github demo PR (Angular and React same speed) “ "In theory, there ought to be no difference between theory and practice. In practice, there is."
  • 27. 500TECH - AngularJS Consultancy So why React ?So why React ? Components life cycle Clear state management Break away from $digest Server side rendering ! Buzz
  • 28. 500TECH - AngularJS Consultancy So why React ?So why React ? Total results: {{ ? }} Available ? Isolated scope digest Isolated scope digest Isolated scope digest
  • 29. 500TECH - AngularJS Consultancy Server RenderingServer Rendering SEO Fast page load (bind later) Embed in page before Angular even runs ["hip","hip"]
  • 30. 500TECH - AngularJS Consultancy Life cycleLife cycle “ You can simulate everything in AngularJS, but then its not AngularJS.
  • 31. 500TECH - AngularJS Consultancy JSX ?JSX ? React.createElement("div", null, React.createElement(HeaderComponent, null), React.createElement("div", null, "Some nice graphics"), React.createElement(FooterComponent, null) )}
  • 32. 500TECH - AngularJS Consultancy Directive TemplateDirective Template <div class="row"> <div class="controls" ng-class={ visible: ctrl.canAdd}> <button ng-click="ctrl.addRow">New row</button> <a class="back-button" href="">Go back</a> </div> <div ng-repeat="row in ctrl.rows" class="item">{{ row.name }}</div> <HelpMessage type="addRow" ng-if="ctrl.canAdd"></HelpMessage> </div>
  • 33. 500TECH - AngularJS Consultancy JSXJSX render: function() { var className = cx({ 'visible': this.state.canAdd, 'controls': true }); var renderRow = function(row) { return (<div className="item">{ row.name }</div>); } return ( <div className="row"> <div className={ className }> <button onClick={ this.addRow }>New row</button> <a className="back-button" href="">Go back</a> </div> { this.state.rows.map(renderRow) } { this.state.canAdd ? <HelpMessage type="addRow" /> : null } </div> ); }
  • 34. 500TECH - AngularJS Consultancy JSXJSX Interesting solution from Wix ( ) Work directly with final result Splitting to very large of mini components react-templates
  • 35. 500TECH - AngularJS Consultancy Data ModelingData Modeling
  • 36. 500TECH - AngularJS Consultancy Angular / MVVMAngular / MVVM Data flowData flow
  • 37. 500TECH - AngularJS Consultancy FluxFlux A Pattern - Not a libraryA Pattern - Not a library “ All arrows go one way
  • 38. 500TECH - AngularJS Consultancy Flux librariesFlux libraries Facebook Flux Fluxible by Yahoo Reflux Alt Flummox Marty McFly Lux Material Flux Delorean
  • 39. 500TECH - AngularJS Consultancy Flux in AngularFlux in Angular Regular services EventEmitter / $broadcast ReactJS Flux libraries
  • 40. 500TECH - AngularJS Consultancy Angular 2.0Angular 2.0
  • 41. 500TECH - AngularJS Consultancy Questions ?Questions ? Thank you ! [email protected] Amazing AngularJS / NodeJS / ReactJS Dev ? Want to hone your skills on projects of all size and shape ? Work in Israel & NYC ? - Talk to me at the break Our next AngularJS Course starts this Wedensday