SlideShare a Scribd company logo
1 of 24
Download to read offline
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

More Related Content

What's hot

AngularJS One Day Workshop
AngularJS One Day WorkshopAngularJS One Day Workshop
AngularJS One Day WorkshopShyam Seshadri
 
The evolution of Angular 2 @ AngularJS Munich Meetup #5
The evolution of Angular 2 @ AngularJS Munich Meetup #5The evolution of Angular 2 @ AngularJS Munich Meetup #5
The evolution of Angular 2 @ AngularJS Munich Meetup #5Johannes Weber
 
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 AngularJSArmin Vieweg
 
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
 
Angular js tutorial slides
Angular js tutorial slidesAngular js tutorial slides
Angular js tutorial slidessamhelman
 
React js Online Training
React js Online TrainingReact js Online Training
React js Online TrainingLearntek1
 
Angular1x and Angular 2 for Beginners
Angular1x and Angular 2 for BeginnersAngular1x and Angular 2 for Beginners
Angular1x and Angular 2 for BeginnersOswald Campesato
 
Angular 2 - Core Concepts
Angular 2 - Core ConceptsAngular 2 - Core Concepts
Angular 2 - Core ConceptsFabio Biondi
 
AngularJS with RequireJS
AngularJS with RequireJSAngularJS with RequireJS
AngularJS with RequireJSJohannes Weber
 
Introduction to ReactJs & fundamentals
Introduction to ReactJs & fundamentalsIntroduction to ReactJs & fundamentals
Introduction to ReactJs & fundamentalswebsyndicate
 
Overview about AngularJS Framework
Overview about AngularJS Framework Overview about AngularJS Framework
Overview about AngularJS Framework Camilo Lopes
 
AngularJS Basics
AngularJS BasicsAngularJS Basics
AngularJS BasicsRavi Mone
 
Introduction to Angular js 2.0
Introduction to Angular js 2.0Introduction to Angular js 2.0
Introduction to Angular js 2.0Nagaraju Sangam
 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJSAldo Pizzagalli
 
AngularJS best-practices
AngularJS best-practicesAngularJS best-practices
AngularJS best-practicesHenry Tao
 
Introduction to react_js
Introduction to react_jsIntroduction to react_js
Introduction to react_jsMicroPyramid .
 
Angular 2 vs React. What to chose in 2017?
Angular 2 vs React. What to chose in 2017?Angular 2 vs React. What to chose in 2017?
Angular 2 vs React. What to chose in 2017?TechMagic
 

What's hot (20)

AngularJS One Day Workshop
AngularJS One Day WorkshopAngularJS One Day Workshop
AngularJS One Day Workshop
 
The evolution of Angular 2 @ AngularJS Munich Meetup #5
The evolution of Angular 2 @ AngularJS Munich Meetup #5The evolution of Angular 2 @ AngularJS Munich Meetup #5
The evolution of Angular 2 @ AngularJS Munich Meetup #5
 
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
 
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)
 
Angular js tutorial slides
Angular js tutorial slidesAngular js tutorial slides
Angular js tutorial slides
 
React js Online Training
React js Online TrainingReact js Online Training
React js Online Training
 
Angular1x and Angular 2 for Beginners
Angular1x and Angular 2 for BeginnersAngular1x and Angular 2 for Beginners
Angular1x and Angular 2 for Beginners
 
Angular 2 - Core Concepts
Angular 2 - Core ConceptsAngular 2 - Core Concepts
Angular 2 - Core Concepts
 
Introduction to Angularjs
Introduction to AngularjsIntroduction to Angularjs
Introduction to Angularjs
 
AngularJS with RequireJS
AngularJS with RequireJSAngularJS with RequireJS
AngularJS with RequireJS
 
Introduction to ReactJs & fundamentals
Introduction to ReactJs & fundamentalsIntroduction to ReactJs & fundamentals
Introduction to ReactJs & fundamentals
 
Overview about AngularJS Framework
Overview about AngularJS Framework Overview about AngularJS Framework
Overview about AngularJS Framework
 
Angular2 intro
Angular2 introAngular2 intro
Angular2 intro
 
AngularJS Basics
AngularJS BasicsAngularJS Basics
AngularJS Basics
 
Reactjs
Reactjs Reactjs
Reactjs
 
Introduction to Angular js 2.0
Introduction to Angular js 2.0Introduction to Angular js 2.0
Introduction to Angular js 2.0
 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJS
 
AngularJS best-practices
AngularJS best-practicesAngularJS best-practices
AngularJS best-practices
 
Introduction to react_js
Introduction to react_jsIntroduction to react_js
Introduction to react_js
 
Angular 2 vs React. What to chose in 2017?
Angular 2 vs React. What to chose in 2017?Angular 2 vs React. What to chose in 2017?
Angular 2 vs React. What to chose in 2017?
 

Viewers also liked

Kế hoạch thi HK2 2015-2016
Kế hoạch thi HK2 2015-2016Kế hoạch thi HK2 2015-2016
Kế hoạch thi HK2 2015-2016Mãi Mãi Yêu
 
Building a dashboard using AngularJS
Building a dashboard using AngularJSBuilding a dashboard using AngularJS
Building a dashboard using AngularJSRajthilakMCA
 
Codemotion 2014 - Hackathones - de 0 a produccion en 24 horas
Codemotion 2014 - Hackathones - de 0 a produccion en 24 horasCodemotion 2014 - Hackathones - de 0 a produccion en 24 horas
Codemotion 2014 - Hackathones - de 0 a produccion en 24 horasAdolfo Sanz De Diego
 
Mejora tus retrospectivas (codemotion 2014)
Mejora tus retrospectivas (codemotion 2014)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 ArchitecturesUnderstanding Native, Hybrid, and Web Mobile Architectures
Understanding Native, Hybrid, and Web Mobile ArchitecturesSalesforce 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 frameworkAngular js o React? Spunti e idee per la scelta di un framework
Angular js o React? Spunti e idee per la scelta di un frameworkGiovanni Buffa
 
Pieter De Baets - An introduction to React Native
Pieter De Baets - An introduction to React NativePieter De Baets - An introduction to React Native
Pieter De Baets - An introduction to React Nativetlv-ios-dev
 
Stateless token-based authentication for pure front-end applications
Stateless token-based authentication for pure front-end applicationsStateless token-based authentication for pure front-end applications
Stateless token-based authentication for pure front-end applicationsAlvaro Sanchez-Mariscal
 
Back to the future: Isomorphic javascript applications
Back to the future:  Isomorphic javascript applicationsBack to the future:  Isomorphic javascript applications
Back to the future: Isomorphic javascript applicationsLuciano Colosio
 
Getting Started with Angular JS
Getting Started with Angular JSGetting Started with Angular JS
Getting Started with Angular JSAkshay Mathur
 
AngularJS performance & production tips
AngularJS performance & production tipsAngularJS performance & production tips
AngularJS performance & production tipsNir Kaufman
 
Understanding angular js
Understanding angular jsUnderstanding angular js
Understanding angular jsAayush Shrestha
 
Scrum bad smells (codemotion 2014)
Scrum bad smells (codemotion 2014)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#PlatziConf - El camino para ser un Pro en JavaScript
#PlatziConf - El camino para ser un Pro en JavaScriptCarlos Azaustre
 
React + Redux Introduction
React + Redux IntroductionReact + Redux Introduction
React + Redux IntroductionNikolaus Graf
 
React JS and why it's awesome
React JS and why it's awesomeReact JS and why it's awesome
React JS and why it's awesomeAndrew Hull
 
2015 Upload Campaigns Calendar - SlideShare
2015 Upload Campaigns Calendar - SlideShare2015 Upload Campaigns Calendar - SlideShare
2015 Upload Campaigns Calendar - SlideShareSlideShare
 
What to Upload to SlideShare
What to Upload to SlideShareWhat to Upload to SlideShare
What to Upload to SlideShareSlideShare
 

Viewers also liked (20)

Kế hoạch thi HK2 2015-2016
Kế hoạch thi HK2 2015-2016Kế hoạch thi HK2 2015-2016
Kế hoạch thi HK2 2015-2016
 
Jquery react angular
Jquery react angularJquery react angular
Jquery react angular
 
Building a dashboard using AngularJS
Building a dashboard using AngularJSBuilding a dashboard using AngularJS
Building a dashboard using AngularJS
 
Codemotion 2014 - Hackathones - de 0 a produccion en 24 horas
Codemotion 2014 - Hackathones - de 0 a produccion en 24 horasCodemotion 2014 - Hackathones - de 0 a produccion en 24 horas
Codemotion 2014 - Hackathones - de 0 a produccion en 24 horas
 
Mejora tus retrospectivas (codemotion 2014)
Mejora tus retrospectivas (codemotion 2014)Mejora tus retrospectivas (codemotion 2014)
Mejora tus retrospectivas (codemotion 2014)
 
Understanding Native, Hybrid, and Web Mobile Architectures
Understanding Native, Hybrid, and Web Mobile ArchitecturesUnderstanding Native, Hybrid, and Web Mobile Architectures
Understanding Native, Hybrid, and Web Mobile Architectures
 
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 frameworkAngular 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
 
Pieter De Baets - An introduction to React Native
Pieter De Baets - An introduction to React NativePieter De Baets - An introduction to React Native
Pieter De Baets - An introduction to React Native
 
Stateless token-based authentication for pure front-end applications
Stateless token-based authentication for pure front-end applicationsStateless token-based authentication for pure front-end applications
Stateless token-based authentication for pure front-end applications
 
Back to the future: Isomorphic javascript applications
Back to the future:  Isomorphic javascript applicationsBack to the future:  Isomorphic javascript applications
Back to the future: Isomorphic javascript applications
 
Getting Started with Angular JS
Getting Started with Angular JSGetting Started with Angular JS
Getting Started with Angular JS
 
AngularJS performance & production tips
AngularJS performance & production tipsAngularJS performance & production tips
AngularJS performance & production tips
 
Understanding angular js
Understanding angular jsUnderstanding angular js
Understanding angular js
 
Scrum bad smells (codemotion 2014)
Scrum bad smells (codemotion 2014)Scrum bad smells (codemotion 2014)
Scrum bad smells (codemotion 2014)
 
#PlatziConf - El camino para ser un Pro en JavaScript
#PlatziConf - El camino para ser un Pro en JavaScript#PlatziConf - El camino para ser un Pro en JavaScript
#PlatziConf - El camino para ser un Pro en JavaScript
 
React + Redux Introduction
React + Redux IntroductionReact + Redux Introduction
React + Redux Introduction
 
React JS and why it's awesome
React JS and why it's awesomeReact JS and why it's awesome
React JS and why it's awesome
 
Atomic design
Atomic designAtomic design
Atomic design
 
2015 Upload Campaigns Calendar - SlideShare
2015 Upload Campaigns Calendar - SlideShare2015 Upload Campaigns Calendar - SlideShare
2015 Upload Campaigns Calendar - SlideShare
 
What to Upload to SlideShare
What to Upload to SlideShareWhat to Upload to SlideShare
What to Upload to SlideShare
 

Similar to Combining Angular and React Together

React - Start learning today
React - Start learning today React - Start learning today
React - Start learning today Nitin Tyagi
 
react-slides.pdf gives information about react library
react-slides.pdf gives information about react libraryreact-slides.pdf gives information about react library
react-slides.pdf gives information about react libraryjanet736113
 
React & Redux for noobs
React & Redux for noobsReact & Redux for noobs
React & Redux for noobs[T]echdencias
 
Intro to React - Featuring Modern JavaScript
Intro to React - Featuring Modern JavaScriptIntro to React - Featuring Modern JavaScript
Intro to React - Featuring Modern JavaScriptjasonsich
 
React - An Introduction
React - An IntroductionReact - An Introduction
React - An IntroductionTyler Johnston
 
Introduction to React JS for beginners
Introduction to React JS for beginners Introduction to React JS for beginners
Introduction to React JS for beginners Varun Raj
 
React JS: A Secret Preview
React JS: A Secret PreviewReact JS: A Secret Preview
React JS: A Secret Previewvaluebound
 
React on Rails - RailsConf 2017 (Phoenix)
 React on Rails - RailsConf 2017 (Phoenix) React on Rails - RailsConf 2017 (Phoenix)
React on Rails - RailsConf 2017 (Phoenix)Jo Cranford
 
A full introductory guide to React
A full introductory guide to ReactA full introductory guide to React
A full introductory guide to ReactJean Carlo Emer
 
Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]GDSC UofT Mississauga
 

Similar to Combining Angular and React Together (20)

React - Start learning today
React - Start learning today React - Start learning today
React - Start learning today
 
ReactJS
ReactJSReactJS
ReactJS
 
react-slides.pptx
react-slides.pptxreact-slides.pptx
react-slides.pptx
 
Introduction to React
Introduction to ReactIntroduction to React
Introduction to React
 
react-slides.pdf
react-slides.pdfreact-slides.pdf
react-slides.pdf
 
react-slides.pdf gives information about react library
react-slides.pdf gives information about react libraryreact-slides.pdf gives information about react library
react-slides.pdf gives information about react library
 
React/Redux
React/ReduxReact/Redux
React/Redux
 
React & Redux for noobs
React & Redux for noobsReact & Redux for noobs
React & Redux for noobs
 
BackboneJS + ReactJS
BackboneJS + ReactJSBackboneJS + ReactJS
BackboneJS + ReactJS
 
Intro to React - Featuring Modern JavaScript
Intro to React - Featuring Modern JavaScriptIntro to React - Featuring Modern JavaScript
Intro to React - Featuring Modern JavaScript
 
React - An Introduction
React - An IntroductionReact - An Introduction
React - An Introduction
 
Intro react js
Intro react jsIntro react js
Intro react js
 
React and redux
React and reduxReact and redux
React and redux
 
React js
React jsReact js
React js
 
Introduction to React JS for beginners
Introduction to React JS for beginners Introduction to React JS for beginners
Introduction to React JS for beginners
 
React JS: A Secret Preview
React JS: A Secret PreviewReact JS: A Secret Preview
React JS: A Secret Preview
 
React on Rails - RailsConf 2017 (Phoenix)
 React on Rails - RailsConf 2017 (Phoenix) React on Rails - RailsConf 2017 (Phoenix)
React on Rails - RailsConf 2017 (Phoenix)
 
A full introductory guide to React
A full introductory guide to ReactA full introductory guide to React
A full introductory guide to React
 
Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]
 
React native
React nativeReact native
React native
 

Recently uploaded

Cybersecurity Threats and Cybersecurity Best Practices
Cybersecurity Threats and Cybersecurity Best PracticesCybersecurity Threats and Cybersecurity Best Practices
Cybersecurity Threats and Cybersecurity Best PracticesLumiverse Solutions Pvt Ltd
 
SCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is prediSCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is predieusebiomeyer
 
IP addressing and IPv6, presented by Paul Wilson at IETF 119
IP addressing and IPv6, presented by Paul Wilson at IETF 119IP addressing and IPv6, presented by Paul Wilson at IETF 119
IP addressing and IPv6, presented by Paul Wilson at IETF 119APNIC
 
TRENDS Enabling and inhibiting dimensions.pptx
TRENDS Enabling and inhibiting dimensions.pptxTRENDS Enabling and inhibiting dimensions.pptx
TRENDS Enabling and inhibiting dimensions.pptxAndrieCagasanAkio
 
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书rnrncn29
 
ETHICAL HACKING dddddddddddddddfnandni.pptx
ETHICAL HACKING dddddddddddddddfnandni.pptxETHICAL HACKING dddddddddddddddfnandni.pptx
ETHICAL HACKING dddddddddddddddfnandni.pptxNIMMANAGANTI RAMAKRISHNA
 
Unidad 4 – Redes de ordenadores (en inglés).pptx
Unidad 4 – Redes de ordenadores (en inglés).pptxUnidad 4 – Redes de ordenadores (en inglés).pptx
Unidad 4 – Redes de ordenadores (en inglés).pptxmibuzondetrabajo
 
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书rnrncn29
 
Company Snapshot Theme for Business by Slidesgo.pptx
Company Snapshot Theme for Business by Slidesgo.pptxCompany Snapshot Theme for Business by Slidesgo.pptx
Company Snapshot Theme for Business by Slidesgo.pptxMario
 

Recently uploaded (9)

Cybersecurity Threats and Cybersecurity Best Practices
Cybersecurity Threats and Cybersecurity Best PracticesCybersecurity Threats and Cybersecurity Best Practices
Cybersecurity Threats and Cybersecurity Best Practices
 
SCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is prediSCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is predi
 
IP addressing and IPv6, presented by Paul Wilson at IETF 119
IP addressing and IPv6, presented by Paul Wilson at IETF 119IP addressing and IPv6, presented by Paul Wilson at IETF 119
IP addressing and IPv6, presented by Paul Wilson at IETF 119
 
TRENDS Enabling and inhibiting dimensions.pptx
TRENDS Enabling and inhibiting dimensions.pptxTRENDS Enabling and inhibiting dimensions.pptx
TRENDS Enabling and inhibiting dimensions.pptx
 
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
 
ETHICAL HACKING dddddddddddddddfnandni.pptx
ETHICAL HACKING dddddddddddddddfnandni.pptxETHICAL HACKING dddddddddddddddfnandni.pptx
ETHICAL HACKING dddddddddddddddfnandni.pptx
 
Unidad 4 – Redes de ordenadores (en inglés).pptx
Unidad 4 – Redes de ordenadores (en inglés).pptxUnidad 4 – Redes de ordenadores (en inglés).pptx
Unidad 4 – Redes de ordenadores (en inglés).pptx
 
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
 
Company Snapshot Theme for Business by Slidesgo.pptx
Company Snapshot Theme for Business by Slidesgo.pptxCompany Snapshot Theme for Business by Slidesgo.pptx
Company Snapshot Theme for Business by Slidesgo.pptx
 

Combining Angular and React Together

Editor's Notes

  1. The V in the MVC React is just for views React don’t provide router, model and event layers
  2. The V in the MVC React is just for views React don’t provide router, model and event layers
  3. 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
  4. The V in the MVC React is just for views React don’t provide router, model and event layers
  5. Components are reusable. Components are composable. Components are unit testable. Sample_1_HelloWorld
  6. JSX is a JavaScript syntax extension that looks similar to XML. You can use a simple JSX syntactic transform with React.
  7. 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
  8. Very clear life-cycle
  9. 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
  10. Want to use ”Components” – Directives? $digest – bad usage of ng-repeat
  11. 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
  12. 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
  13. 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)
  14. 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>