SlideShare a Scribd company logo
April 10th 2016
Working with AngularJs 1.x and React togethe
Sebastian Pederiva
sebastianp@sela.co.il
@spederiva
Don’t compare React to Angular
Don’t compare React to Angular
What is AngularJs?
Framework for dynamic web apps
Controllers (scope)
Views/Templates
Services (service/factory/provider)
Filters
Binding
Watchers/$Digest
Events
Directives
What is React?
A library for creating user interfaces
React does one thing and does it well
Renders your UI and responds to events
Virtual DOM
Develop real components
Can Work Together
Build components
Encapsulated and interoperable custom elements that extend
HTML itself
A component should ideally only do one thing
Use components to separate your concerns
class PageTitle extends React.Component {
render() {
return (<h1>Hello World!</h1>);
}
}
Intro to React
JSX
JSX lets you create JavaScript objects using HTML syntax
Optional
Combines ease-of-use of templates with power of JavaScript
http://facebook.github.io/jsx
Need to be “transpiled”
https://facebook.github.io/react/docs/getting-started.html
Improve performance with Babel
https://goo.gl/Tu9eTx
Props are select pieces of data that are passed to child
components from a parent and are immutable by the child
var HelloWorld = React.createClass({
function render() {
return (<div>Hello {this.props.name}!!</div>);
}
});
ReactDOM.render(
<HelloWorld name="Sebastian" />,
document.getElementById("example")
);
Props
States are component data that the component sets itself via:
getInitialState
setState
State and UI always must be synced
var HelloWorld = React.createClass({
getInitialState(){
return{
name: ""
}
},
handleOnChange(e){
this.setState({
name: e.target.value
});
},
render() {
return (<input value={this.state.name} onChange={this.handleOnChange} />);
}
});
State
Life Cycle
Mounting/Unmounting Update
getInitialState()
getDefaultProps()
componentWillMount()
render()
componentWillReceiveProps()
shouldComponentUpdate()
componentWillUpdate()
render()
componentDidMount()
componentWillUnmount()
componentDidUpdate()
* State before and after DOM manipulations
Virtual DOM
Abstract JavaScript version of the DOM
Optimized for performance and memory footprint
Re-Render All The Things
Batch execute all updates
Demo
TODO
Why Angular+React?
WeY AngularJs Y
Want to use ”Components”
Don’t want to think about $digest
React is very cool!
Directives are powerful but not easy to write
Directives – Need to be an expert
No real ‘one
way’ binding
attribute.
$observe
Compile/Link
functions
‘ng-repeat’
’track by’
Controller/
Link
Compile
Pre-Link
Post-Link
Why Angular+React?
WeY AngularJs Y
Want to use ”Components”
Don’t want to think about $digest
React is very cool!
Directives are powerful but not easy to write
Performance
Performance – AngularJs vs. React
0
1000
2000
3000
4000
5000
6000
7000
8000
9000
10000
100 500 1000 5000 10000 15000 50000
Rendering Comparison
Angular React
Demo
Angular/React/Angular + React
Ng-React
ngReact is an AngularJs module that allows React Components
to be used in AngularJs applications
Very easy to use
Most of the cases is enough
https://github.com/ngReact/ngReact
Demo
Ng-React
Demo
Ng-React - Bindings
Use case
Rendering a really long list (ng-repeat)
Very dynamic layout
Performance problems
Really separation of concerns
Links
http://blog.500tech.com/using-reactjs-with-angularjs
https://www.bimeanalytics.com/engineering-blog/you-put-your-
react-into-my-angular
http://www.bennadel.com/blog/2902-rendering-reactjs-
components-in-angularjs-using-angularjs-directives.htm
Summary
Overview React
Why AngularJs + React
The “glue” directive between AngularJs and React
Ng-React
Questions
Ad

Recommended

Using ReactJS in AngularJS
Using ReactJS in AngularJS
Boris Dinkevich
 
React Vs AnagularJS
React Vs AnagularJS
deepakpatil84
 
React vs Angular2
React vs Angular2
Corley S.r.l.
 
Angular js vs. Facebook react
Angular js vs. Facebook react
Keyup
 
AngularJS + React
AngularJS + React
justvamp
 
ReactJS vs AngularJS - Head to Head comparison
ReactJS vs AngularJS - Head to Head comparison
500Tech
 
React vs Angular: ups & downs (speaker Oleksandr Kovalov, Binary Studio)
React vs Angular: ups & downs (speaker Oleksandr Kovalov, Binary Studio)
Binary Studio
 
Angular 2 overview
Angular 2 overview
Jesse Warden
 
AngularJS One Day Workshop
AngularJS One Day Workshop
Shyam Seshadri
 
The evolution of Angular 2 @ AngularJS Munich Meetup #5
The evolution of Angular 2 @ AngularJS Munich Meetup #5
Johannes Weber
 
Gettings started with the superheroic JavaScript library AngularJS
Gettings started with the superheroic JavaScript library AngularJS
Armin Vieweg
 
AngularJS - What is it & Why is it awesome ? (with demos)
AngularJS - What is it & Why is it awesome ? (with demos)
Gary Arora
 
Angular js tutorial slides
Angular js tutorial slides
samhelman
 
React js Online Training
React js Online Training
Learntek1
 
Angular1x and Angular 2 for Beginners
Angular1x and Angular 2 for Beginners
Oswald Campesato
 
Angular 2 - Core Concepts
Angular 2 - Core Concepts
Fabio Biondi
 
Introduction to Angularjs
Introduction to Angularjs
Manish Shekhawat
 
AngularJS with RequireJS
AngularJS with RequireJS
Johannes Weber
 
Introduction to ReactJs & fundamentals
Introduction to ReactJs & fundamentals
websyndicate
 
Overview about AngularJS Framework
Overview about AngularJS Framework
Camilo Lopes
 
Angular2 intro
Angular2 intro
Shawn McKay
 
AngularJS Basics
AngularJS Basics
Ravi Mone
 
Reactjs
Reactjs
Neha Sharma
 
Introduction to Angular js 2.0
Introduction to Angular js 2.0
Nagaraju Sangam
 
Introduction to AngularJS
Introduction to AngularJS
Aldo Pizzagalli
 
AngularJS best-practices
AngularJS best-practices
Henry Tao
 
Introduction to react_js
Introduction to react_js
MicroPyramid .
 
Angular 2 vs React. What to chose in 2017?
Angular 2 vs React. What to chose in 2017?
TechMagic
 
Kế hoạch thi HK2 2015-2016
Kế hoạch thi HK2 2015-2016
Mãi Mãi Yêu
 
Jquery react angular
Jquery react angular
Rafa D. Latorre López Villalta
 

More Related Content

What's hot (20)

AngularJS One Day Workshop
AngularJS One Day Workshop
Shyam Seshadri
 
The evolution of Angular 2 @ AngularJS Munich Meetup #5
The evolution of Angular 2 @ AngularJS Munich Meetup #5
Johannes Weber
 
Gettings started with the superheroic JavaScript library AngularJS
Gettings started with the superheroic JavaScript library AngularJS
Armin Vieweg
 
AngularJS - What is it & Why is it awesome ? (with demos)
AngularJS - What is it & Why is it awesome ? (with demos)
Gary Arora
 
Angular js tutorial slides
Angular js tutorial slides
samhelman
 
React js Online Training
React js Online Training
Learntek1
 
Angular1x and Angular 2 for Beginners
Angular1x and Angular 2 for Beginners
Oswald Campesato
 
Angular 2 - Core Concepts
Angular 2 - Core Concepts
Fabio Biondi
 
Introduction to Angularjs
Introduction to Angularjs
Manish Shekhawat
 
AngularJS with RequireJS
AngularJS with RequireJS
Johannes Weber
 
Introduction to ReactJs & fundamentals
Introduction to ReactJs & fundamentals
websyndicate
 
Overview about AngularJS Framework
Overview about AngularJS Framework
Camilo Lopes
 
Angular2 intro
Angular2 intro
Shawn McKay
 
AngularJS Basics
AngularJS Basics
Ravi Mone
 
Reactjs
Reactjs
Neha Sharma
 
Introduction to Angular js 2.0
Introduction to Angular js 2.0
Nagaraju Sangam
 
Introduction to AngularJS
Introduction to AngularJS
Aldo Pizzagalli
 
AngularJS best-practices
AngularJS best-practices
Henry Tao
 
Introduction to react_js
Introduction to react_js
MicroPyramid .
 
Angular 2 vs React. What to chose in 2017?
Angular 2 vs React. What to chose in 2017?
TechMagic
 
AngularJS One Day Workshop
AngularJS One Day Workshop
Shyam Seshadri
 
The evolution of Angular 2 @ AngularJS Munich Meetup #5
The evolution of Angular 2 @ AngularJS Munich Meetup #5
Johannes Weber
 
Gettings started with the superheroic JavaScript library AngularJS
Gettings started with the superheroic JavaScript library AngularJS
Armin Vieweg
 
AngularJS - What is it & Why is it awesome ? (with demos)
AngularJS - What is it & Why is it awesome ? (with demos)
Gary Arora
 
Angular js tutorial slides
Angular js tutorial slides
samhelman
 
React js Online Training
React js Online Training
Learntek1
 
Angular1x and Angular 2 for Beginners
Angular1x and Angular 2 for Beginners
Oswald Campesato
 
Angular 2 - Core Concepts
Angular 2 - Core Concepts
Fabio Biondi
 
AngularJS with RequireJS
AngularJS with RequireJS
Johannes Weber
 
Introduction to ReactJs & fundamentals
Introduction to ReactJs & fundamentals
websyndicate
 
Overview about AngularJS Framework
Overview about AngularJS Framework
Camilo Lopes
 
AngularJS Basics
AngularJS Basics
Ravi Mone
 
Introduction to Angular js 2.0
Introduction to Angular js 2.0
Nagaraju Sangam
 
Introduction to AngularJS
Introduction to AngularJS
Aldo Pizzagalli
 
AngularJS best-practices
AngularJS best-practices
Henry Tao
 
Introduction to react_js
Introduction to react_js
MicroPyramid .
 
Angular 2 vs React. What to chose in 2017?
Angular 2 vs React. What to chose in 2017?
TechMagic
 

Viewers also liked (20)

Kế hoạch thi HK2 2015-2016
Kế hoạch thi HK2 2015-2016
Mãi Mãi Yêu
 
Jquery react angular
Jquery react angular
Rafa D. Latorre López Villalta
 
Building a dashboard using AngularJS
Building a dashboard using AngularJS
RajthilakMCA
 
Codemotion 2014 - Hackathones - de 0 a produccion en 24 horas
Codemotion 2014 - Hackathones - de 0 a produccion en 24 horas
Adolfo Sanz De Diego
 
Mejora tus retrospectivas (codemotion 2014)
Mejora tus retrospectivas (codemotion 2014)
Juanma Gómez
 
Understanding Native, Hybrid, and Web Mobile Architectures
Understanding Native, Hybrid, and Web Mobile Architectures
Salesforce Developers
 
Angular js o React? Spunti e idee per la scelta di un framework
Angular js o React? Spunti e idee per la scelta di un framework
Giovanni Buffa
 
Pieter De Baets - An introduction to React Native
Pieter De Baets - An introduction to React Native
tlv-ios-dev
 
Stateless token-based authentication for pure front-end applications
Stateless token-based authentication for pure front-end applications
Alvaro Sanchez-Mariscal
 
Back to the future: Isomorphic javascript applications
Back to the future: Isomorphic javascript applications
Luciano Colosio
 
Getting Started with Angular JS
Getting Started with Angular JS
Akshay Mathur
 
AngularJS performance & production tips
AngularJS performance & production tips
Nir Kaufman
 
Understanding angular js
Understanding angular js
Aayush Shrestha
 
Scrum bad smells (codemotion 2014)
Scrum bad smells (codemotion 2014)
Juanma Gómez
 
#PlatziConf - El camino para ser un Pro en JavaScript
#PlatziConf - El camino para ser un Pro en JavaScript
Carlos Azaustre
 
React + Redux Introduction
React + Redux Introduction
Nikolaus Graf
 
React JS and why it's awesome
React JS and why it's awesome
Andrew Hull
 
Atomic design
Atomic design
Brad Frost
 
2015 Upload Campaigns Calendar - SlideShare
2015 Upload Campaigns Calendar - SlideShare
SlideShare
 
What to Upload to SlideShare
What to Upload to SlideShare
SlideShare
 
Kế hoạch thi HK2 2015-2016
Kế hoạch thi HK2 2015-2016
Mãi Mãi Yêu
 
Building a dashboard using AngularJS
Building a dashboard using AngularJS
RajthilakMCA
 
Codemotion 2014 - Hackathones - de 0 a produccion en 24 horas
Codemotion 2014 - Hackathones - de 0 a produccion en 24 horas
Adolfo Sanz De Diego
 
Mejora tus retrospectivas (codemotion 2014)
Mejora tus retrospectivas (codemotion 2014)
Juanma Gómez
 
Understanding Native, Hybrid, and Web Mobile Architectures
Understanding Native, Hybrid, and Web Mobile Architectures
Salesforce Developers
 
Angular js o React? Spunti e idee per la scelta di un framework
Angular js o React? Spunti e idee per la scelta di un framework
Giovanni Buffa
 
Pieter De Baets - An introduction to React Native
Pieter De Baets - An introduction to React Native
tlv-ios-dev
 
Stateless token-based authentication for pure front-end applications
Stateless token-based authentication for pure front-end applications
Alvaro Sanchez-Mariscal
 
Back to the future: Isomorphic javascript applications
Back to the future: Isomorphic javascript applications
Luciano Colosio
 
Getting Started with Angular JS
Getting Started with Angular JS
Akshay Mathur
 
AngularJS performance & production tips
AngularJS performance & production tips
Nir Kaufman
 
Understanding angular js
Understanding angular js
Aayush Shrestha
 
Scrum bad smells (codemotion 2014)
Scrum bad smells (codemotion 2014)
Juanma Gómez
 
#PlatziConf - El camino para ser un Pro en JavaScript
#PlatziConf - El camino para ser un Pro en JavaScript
Carlos Azaustre
 
React + Redux Introduction
React + Redux Introduction
Nikolaus Graf
 
React JS and why it's awesome
React JS and why it's awesome
Andrew Hull
 
2015 Upload Campaigns Calendar - SlideShare
2015 Upload Campaigns Calendar - SlideShare
SlideShare
 
What to Upload to SlideShare
What to Upload to SlideShare
SlideShare
 
Ad

Similar to Combining Angular and React Together (20)

Comparing Angular and React JS for SPAs
Comparing Angular and React JS for SPAs
Jennifer Estrada
 
Getting Started with React, When You’re an Angular Developer
Getting Started with React, When You’re an Angular Developer
Fabrit Global
 
React vs. angular a comprehensive guideline for choosing right front-end fr...
React vs. angular a comprehensive guideline for choosing right front-end fr...
Katy Slemon
 
React.js vs angular.js a comparison
React.js vs angular.js a comparison
Narola Infotech
 
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 Vs ReactJS_ What’s The Difference_.pdf
AngularJS Vs ReactJS_ What’s The Difference_.pdf
Onviqa Pvt. Ltd.
 
Angular vs React: Making an Informed Decision for Your Web Development
Angular vs React: Making an Informed Decision for Your Web Development
FredReynolds2
 
Angular vs.pdf
Angular vs.pdf
SophiaJasper
 
Angular vs react comparison in 2022 which is better and why
Angular vs react comparison in 2022 which is better and why
Noman Shaikh
 
React vs angular which front end framework should you choose and why
React vs angular which front end framework should you choose and why
Katy Slemon
 
React js vs angularjs which framework to choose in 2022_
React js vs angularjs which framework to choose in 2022_
Moon Technolabs Pvt. Ltd.
 
React vs Angular - Unleashing the Ultimate Framework Showdown - AppsDevPro
React vs Angular - Unleashing the Ultimate Framework Showdown - AppsDevPro
SofiaCarter4
 
[Final] ReactJS presentation
[Final] ReactJS presentation
洪 鹏发
 
Angular vs react
Angular vs react
Infinijith Technologies
 
React VS Angular- Which is Best for You in 2023?
React VS Angular- Which is Best for You in 2023?
CMARIX TechnoLabs
 
Which technology has a better future_ AngularJS or ReactJS_.pdf
Which technology has a better future_ AngularJS or ReactJS_.pdf
Moon Technolabs Pvt. Ltd.
 
ReactJs presentation
ReactJs presentation
nishasowdri
 
React vs Angular: A Comprehensive Comparison for Frontend Development
React vs Angular: A Comprehensive Comparison for Frontend Development
Sterling Technolabs
 
Angular VS React The Battle of Best Front End Frameworks.pdf
Angular VS React The Battle of Best Front End Frameworks.pdf
JS Panther
 
Angular vs React: Pick the Right Front-End in 2024
Angular vs React: Pick the Right Front-End in 2024
Consumer Sketch
 
Comparing Angular and React JS for SPAs
Comparing Angular and React JS for SPAs
Jennifer Estrada
 
Getting Started with React, When You’re an Angular Developer
Getting Started with React, When You’re an Angular Developer
Fabrit Global
 
React vs. angular a comprehensive guideline for choosing right front-end fr...
React vs. angular a comprehensive guideline for choosing right front-end fr...
Katy Slemon
 
React.js vs angular.js a comparison
React.js vs angular.js a comparison
Narola Infotech
 
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 Vs ReactJS_ What’s The Difference_.pdf
AngularJS Vs ReactJS_ What’s The Difference_.pdf
Onviqa Pvt. Ltd.
 
Angular vs React: Making an Informed Decision for Your Web Development
Angular vs React: Making an Informed Decision for Your Web Development
FredReynolds2
 
Angular vs react comparison in 2022 which is better and why
Angular vs react comparison in 2022 which is better and why
Noman Shaikh
 
React vs angular which front end framework should you choose and why
React vs angular which front end framework should you choose and why
Katy Slemon
 
React js vs angularjs which framework to choose in 2022_
React js vs angularjs which framework to choose in 2022_
Moon Technolabs Pvt. Ltd.
 
React vs Angular - Unleashing the Ultimate Framework Showdown - AppsDevPro
React vs Angular - Unleashing the Ultimate Framework Showdown - AppsDevPro
SofiaCarter4
 
[Final] ReactJS presentation
[Final] ReactJS presentation
洪 鹏发
 
React VS Angular- Which is Best for You in 2023?
React VS Angular- Which is Best for You in 2023?
CMARIX TechnoLabs
 
Which technology has a better future_ AngularJS or ReactJS_.pdf
Which technology has a better future_ AngularJS or ReactJS_.pdf
Moon Technolabs Pvt. Ltd.
 
ReactJs presentation
ReactJs presentation
nishasowdri
 
React vs Angular: A Comprehensive Comparison for Frontend Development
React vs Angular: A Comprehensive Comparison for Frontend Development
Sterling Technolabs
 
Angular VS React The Battle of Best Front End Frameworks.pdf
Angular VS React The Battle of Best Front End Frameworks.pdf
JS Panther
 
Angular vs React: Pick the Right Front-End in 2024
Angular vs React: Pick the Right Front-End in 2024
Consumer Sketch
 
Ad

Recently uploaded (20)

PROCESS FOR CREATION OF BUSINESS PARTNER IN SAP
PROCESS FOR CREATION OF BUSINESS PARTNER IN SAP
AhmadAli716831
 
最新版美国特拉华大学毕业证(UDel毕业证书)原版定制
最新版美国特拉华大学毕业证(UDel毕业证书)原版定制
taqyea
 
Make DDoS expensive for the threat actors
Make DDoS expensive for the threat actors
APNIC
 
3 years of Quarkus in production, what have we learned - Devoxx Polen
3 years of Quarkus in production, what have we learned - Devoxx Polen
Jago de Vreede
 
Dark Web Presentation - 1.pdf about internet which will help you to get to kn...
Dark Web Presentation - 1.pdf about internet which will help you to get to kn...
ragnaralpha7199
 
Transmission Control Protocol (TCP) and Starlink
Transmission Control Protocol (TCP) and Starlink
APNIC
 
最新版美国威斯康星大学绿湾分校毕业证(UWGB毕业证书)原版定制
最新版美国威斯康星大学绿湾分校毕业证(UWGB毕业证书)原版定制
Taqyea
 
Lecture 3.1 Analysing the Global Business Environment .pptx
Lecture 3.1 Analysing the Global Business Environment .pptx
shofalbsb
 
原版澳洲斯文本科技大学毕业证(SUT毕业证书)如何办理
原版澳洲斯文本科技大学毕业证(SUT毕业证书)如何办理
taqyed
 
ChatGPT A.I. Powered Chatbot and Popularization.pdf
ChatGPT A.I. Powered Chatbot and Popularization.pdf
StanleySamson1
 
Topic 2 - Cloud Computing Basics,,,.pptx
Topic 2 - Cloud Computing Basics,,,.pptx
oneillp100
 
IAREUOUSTPIDWHY$)CHARACTERARERWUEEJJSKWNSND
IAREUOUSTPIDWHY$)CHARACTERARERWUEEJJSKWNSND
notgachabite123
 
history of internet in nepal Class-8 (sparsha).pptx
history of internet in nepal Class-8 (sparsha).pptx
SPARSH508080
 
BroadLink Cloud Service introduction.pdf
BroadLink Cloud Service introduction.pdf
DevendraDwivdi1
 
CBUSDAW - Ash Lewis - Reducing LLM Hallucinations
CBUSDAW - Ash Lewis - Reducing LLM Hallucinations
Jason Packer
 
ChatGPT_and_Its_Uses_Presentationss.pptx
ChatGPT_and_Its_Uses_Presentationss.pptx
Neha Prakash
 
COMPUTER ETHICS AND CRIME.......................................................
COMPUTER ETHICS AND CRIME.......................................................
FOOLKUMARI
 
DDoS in India, presented at INNOG 8 by Dave Phelan
DDoS in India, presented at INNOG 8 by Dave Phelan
APNIC
 
cybercrime investigation and digital forensics
cybercrime investigation and digital forensics
goverdhankumar137300
 
最新版加拿大奎斯特大学毕业证(QUC毕业证书)原版定制
最新版加拿大奎斯特大学毕业证(QUC毕业证书)原版定制
taqyed
 
PROCESS FOR CREATION OF BUSINESS PARTNER IN SAP
PROCESS FOR CREATION OF BUSINESS PARTNER IN SAP
AhmadAli716831
 
最新版美国特拉华大学毕业证(UDel毕业证书)原版定制
最新版美国特拉华大学毕业证(UDel毕业证书)原版定制
taqyea
 
Make DDoS expensive for the threat actors
Make DDoS expensive for the threat actors
APNIC
 
3 years of Quarkus in production, what have we learned - Devoxx Polen
3 years of Quarkus in production, what have we learned - Devoxx Polen
Jago de Vreede
 
Dark Web Presentation - 1.pdf about internet which will help you to get to kn...
Dark Web Presentation - 1.pdf about internet which will help you to get to kn...
ragnaralpha7199
 
Transmission Control Protocol (TCP) and Starlink
Transmission Control Protocol (TCP) and Starlink
APNIC
 
最新版美国威斯康星大学绿湾分校毕业证(UWGB毕业证书)原版定制
最新版美国威斯康星大学绿湾分校毕业证(UWGB毕业证书)原版定制
Taqyea
 
Lecture 3.1 Analysing the Global Business Environment .pptx
Lecture 3.1 Analysing the Global Business Environment .pptx
shofalbsb
 
原版澳洲斯文本科技大学毕业证(SUT毕业证书)如何办理
原版澳洲斯文本科技大学毕业证(SUT毕业证书)如何办理
taqyed
 
ChatGPT A.I. Powered Chatbot and Popularization.pdf
ChatGPT A.I. Powered Chatbot and Popularization.pdf
StanleySamson1
 
Topic 2 - Cloud Computing Basics,,,.pptx
Topic 2 - Cloud Computing Basics,,,.pptx
oneillp100
 
IAREUOUSTPIDWHY$)CHARACTERARERWUEEJJSKWNSND
IAREUOUSTPIDWHY$)CHARACTERARERWUEEJJSKWNSND
notgachabite123
 
history of internet in nepal Class-8 (sparsha).pptx
history of internet in nepal Class-8 (sparsha).pptx
SPARSH508080
 
BroadLink Cloud Service introduction.pdf
BroadLink Cloud Service introduction.pdf
DevendraDwivdi1
 
CBUSDAW - Ash Lewis - Reducing LLM Hallucinations
CBUSDAW - Ash Lewis - Reducing LLM Hallucinations
Jason Packer
 
ChatGPT_and_Its_Uses_Presentationss.pptx
ChatGPT_and_Its_Uses_Presentationss.pptx
Neha Prakash
 
COMPUTER ETHICS AND CRIME.......................................................
COMPUTER ETHICS AND CRIME.......................................................
FOOLKUMARI
 
DDoS in India, presented at INNOG 8 by Dave Phelan
DDoS in India, presented at INNOG 8 by Dave Phelan
APNIC
 
cybercrime investigation and digital forensics
cybercrime investigation and digital forensics
goverdhankumar137300
 
最新版加拿大奎斯特大学毕业证(QUC毕业证书)原版定制
最新版加拿大奎斯特大学毕业证(QUC毕业证书)原版定制
taqyed
 

Combining Angular and React Together

Editor's Notes

  • #3: The V in the MVC React is just for views React don’t provide router, model and event layers
  • #4: The V in the MVC React is just for views React don’t provide router, model and event layers
  • #6: React manages a DOM in-memory, and when the state mutates and triggers any change to the DOM, mutations are first done in-memory. Then React computes the minimal set of mutations to do on the real DOM, and does them in batch
  • #7: The V in the MVC React is just for views React don’t provide router, model and event layers
  • #8: Components are reusable. Components are composable. Components are unit testable. Sample_1_HelloWorld
  • #9: JSX is a JavaScript syntax extension that looks similar to XML. You can use a simple JSX syntactic transform with React.
  • #11: Forget any of your old jQuery habits where you respond to an event and then tweak the DOM Forget about binding Any time there's a change, we will re-render the state of our app. Sample_6_State
  • #12: Very clear life-cycle
  • #13: Not confuse with ShadowDOM, which is part of WebComponent Shadow DOM provides encapsulation for the JavaScript, CSS, and templating in a Web Component. Virtual DOM is a technique and set of libraries / algorithms that allow us to improve front end performance by avoiding direct work with DOM and work only with lightweight JavaScript object that mimic the DOM tree. Re-render the whole app on every update Re-rendering on every change makes things simple. Computes minimal DOM operations React will intelligently decide what DOM elements stay and go Most of the virtual DOM can be treated like magic, and you can ignore the implementation React converts these virtual elements into real DOM elements as necessary Diff it with the old one How it works React builds a new virtual DOM subtree …diffs it with the old one …computes the minimal set of DOM mutations and puts them in a queue …and batch executes all updates
  • #15: Want to use ”Components” – Directives? $digest – bad usage of ng-repeat
  • #16: Pre-link functions are also run in priority order, but post-link functions are run in reverse order. Compile/Link Cannot exist both in the same directive – what happened if there are both? Compile can return a link function How many times compile is executed? – only one Pre-Link: we still don’t have transcluded content and the template isn’t linked to the scope because the bindings aren’t setup
  • #19: Because AngularJS doesn't know anything about ReactJS, and vice-versa, rendering ReactJS inside of AngularJS requires some sort of a "glue" layer Copy files from angular and react samples (app.js, index.html, table.jsx) Add <script src="builds/table.js"></script> Add ” this.events = new Events();” and change broadcast to “emit” Change the directive myBoard leaving only the “link”: renderDOM.render is “myBoard” live template HTML: add ”events” property events=“$ctrl.events” Wrap play method with setTimeout
  • #21: Copy files from angular-react samples (app.js, index.html, table.jsx) Add <script src="../../node_modules/ngreact/ngReact.js"></script> Add ‘react’ to app module Remove ”myBoard” directive Add (react-component) <react-component name="Table" props="$ctrl.props" ng-if="$ctrl.isDataLoaded"></react-component> Add to showTable: this.props (thisProps)
  • #22: Show onClick functionality already added in Table component Add onClick property to this.props Add this.onClick method (thisOnClick) Add (spanCellValue) <span ng-if="$ctrl.isDataLoaded && $ctrl.cellValue">Cell Clicked: {{$ctrl.cellValue}}</span>