react vs-angular-mobile

27
ANGULAR VS REACT - MOBILE Michael Haberman Freelancer

Upload: michael-haberman

Post on 09-Jan-2017

569 views

Category:

Engineering


0 download

TRANSCRIPT

Page 1: React vs-angular-mobile

ANGULAR VS REACT - MOBILEMichael HabermanFreelancer

Page 2: React vs-angular-mobile

AGENDA

Angular VS React

Hybrid solution (Ionic)

Native solution (react-native)

Compare

Page 3: React vs-angular-mobile

ANGULAR

All around framework

MVC based

Routing

MVCs sync by services / events / root scope

Two way binding via dirty checking

A lot of re-rendering

Page 4: React vs-angular-mobile

ANGULAR DIAGRAM

Controller

View

Model

Controller

View

Model

Service

Timer

Page 5: React vs-angular-mobile

REACT

Library and not a framework

Handle View only (virtual DOM)

Component based

Unidirectional data flow (NOT one way binding)

Flux

No official router

Page 6: React vs-angular-mobile

REACT COMPONENTS

var toggleButton = React.createClass({ getInitialState: function() { return {toggled: false}; }, handleClick: function(event) { this.setState({toggled: !this.state.toggled}); }, render: function() { return ( <p onClick={this.handleClick}> {this.state.toggled} . </p> ); }});

ReactDOM.render( <toggleButton />, document.getElementById('example'));

Page 7: React vs-angular-mobile

REACT COMPONENTS

var container = React.createClass({ render: function() { return ( {this.props.containerData} <child childData ={this.props.childData}/> ); }});

var child = React.createClass({ render: function() { return ( {this.props.childData} ); }});

ReactDOM.render( <container containerData=“c” childData=“d" />, document.getElementById('example'));

Page 8: React vs-angular-mobile

REACT

setState cause re-render

Virtual DOM: better performance

Page 9: React vs-angular-mobile

REACT - FLUX

Actions Dispatcher Stores Component

Component

ComponentBackend

Page 10: React vs-angular-mobile

AGENDA

Angular VS React

Hybrid solution (Ionic)

Native solution (react-native)

Compare

Page 11: React vs-angular-mobile

GOING TO MOBILE

Mobile Device

Browser

Your App

Responsive

Mobile Device

Hybrid

Native App

Native WebViewYour App

Page 12: React vs-angular-mobile

GOING TO MOBILE

Hybrid:

Download from store / play

Allow access to native APIs

Store approval

Page 13: React vs-angular-mobile

GOING TO MOBILE

Access to native APIs

Performance

Native look and feel (cross platform)

Touch

Offline

App Store / Google Play

Navigation is harder

Multi devices

Page 14: React vs-angular-mobile

IONIC

Framework based on angular

Native plugins

Native look and feel

Allow platform-specific specifications

Page 15: React vs-angular-mobile

IONIC

Demo

Page 16: React vs-angular-mobile

IONIC - WHY

Rich UI

Easy to learn

Shared code with website

Remote deploy

No special learning

Easy development tools

Page 17: React vs-angular-mobile

IONIC - WHY NOT

Limited native API access

Performance limits

Lock-in with Ionic and Angular

Page 18: React vs-angular-mobile

AGENDA

Angular VS React

Hybrid solution (Ionic)

Native solution (react-native)

Compare

Page 19: React vs-angular-mobile

REACT NATIVE

Javascript framework

Compiles into native app

Uses React as view layer

Special components (translated into native)

Component per platform

“Learn once - write anywhere”

Page 20: React vs-angular-mobile

REACT NATIVE

Demo

Page 21: React vs-angular-mobile

REACT WHY

Native!

No performance limit

Javascript - libraries

Page 22: React vs-angular-mobile

REACT WHY NOT

Less shared code with web (and must be in react as well)

Learning curve

Duplicate coding

Not HTML / CSS

Page 23: React vs-angular-mobile

AGENDA

Angular VS React

Hybrid solution (Ionic)

Native solution (react-native)

Compare

Page 24: React vs-angular-mobile

COMPARE

IONIC REACT NATIVE

WEB REUSE Most of the code Some of the code

LEARNING Small curve Large curve

PLATFORM SPECIFIC

Minimal (if any) Most of the code

PERFORMANCE Limited As native

NATIVE API Limited UnlimitedPERVIOUS

KOWNLEDGE

Page 25: React vs-angular-mobile

AGENDA

Angular VS React

Hybrid solution (Ionic)

Native solution (react-native)

Compare

Page 26: React vs-angular-mobile

QUESTIONS