Transcript
Page 1: React vs angular (mobile first battle)

ANGULAR VS REACTMOBILE FIRST BATTLEMichael Haberman

Page 2: React vs angular (mobile first battle)

AGENDA

Angular VS React

Hybrid solution (Ionic)

Native solution (react-native)

Compare

Page 3: React vs angular (mobile first battle)

ANGULAR 1.X

All around framework by Google

MVC based

Using dirty check to allow two way binding

Page 4: React vs angular (mobile first battle)

MVC

Controller

View

Model

Controller

View

Model

Service

Timer

Page 5: React vs angular (mobile first battle)

MVC - OVER RENDERING

item #1

item #2

item #3

item #4

item #5

item #6

item #7

ng-repeat=‘item in items’

$scope.items[2].name= “newValue”

Page 6: React vs angular (mobile first battle)

ANGULAR 2.X

All around framework by Google

You can choose your architecture

MV*, Flux, Redux…

Component based

No more performance limit due to dirty check

Page 7: React vs angular (mobile first battle)

REACT

Library by Facebook

JS, JSX and styles

Handle View only

Component based

Unidirectional data flow (NOT one way binding)

Flux

Redux

Page 8: React vs angular (mobile first battle)

COMPONENT BASED?

Both Angular 2.x & React

Page 9: React vs angular (mobile first battle)

COMPONENTS

Component

Component

Component

Page 10: React vs angular (mobile first battle)

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 11: React vs angular (mobile first battle)

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 12: React vs angular (mobile first battle)

COMPONENTS RENDERING

item #1

item #2

item #3

item #4

item #5

item #6

item #7

props.items.map(…)

props.items[2].name= “newValue”

Page 13: React vs angular (mobile first battle)

COMPONENT BASED?

Component is view layer only

What about all the rest?

Page 14: React vs angular (mobile first battle)

UNIDIRECTIONAL

Actions Dispatcher Stores Component

Component

ComponentBackend

Page 15: React vs angular (mobile first battle)

AGENDA

Angular VS React

Hybrid solution (Ionic)

Native solution (react-native)

Compare

Page 16: React vs angular (mobile first battle)

GOING TO MOBILE

Mobile Device

Browser

Your website

Responsive

Mobile Device

Hybrid

Native App

Native WebViewYour website

Page 17: React vs angular (mobile first battle)

GOING TO MOBILE

Hybrid:

Download from store / play (store approval)

Allow access to native APIs

Page 18: React vs angular (mobile first battle)

GOING TO MOBILE

Javascript

Cordova

Ionic

Page 19: React vs angular (mobile first battle)

IONIC - FEATURES (ECO SYSTEM)

UI components

Native API’s

Push notification

Deployment

Ionic view

Package

Analytics

Database

Feedback

Auth

Page 20: React vs angular (mobile first battle)

IONIC - UI COMPONENTS

http://ionicframework.com/docs/components

http://ionicframework.com/docs/api/

Cross platform UI components

Page 21: React vs angular (mobile first battle)

IONIC - NATIVE APIS

https://market.ionic.io

Based on plug-ins

Community

Create your own

Page 22: React vs angular (mobile first battle)

IONIC - DEPLOY

Deployment is problematic

Native package contains all resources (web & native)

Native package contains native & index.html

How to support update?

How to avoid previous versions

Page 23: React vs angular (mobile first battle)

IONIC - VIEW

Let other people get your app

They should install ionic view

Your app is available through ionic view

Great for QA teams

Page 24: React vs angular (mobile first battle)

IONIC - WHY

Rich UI

Easy to learn - previous angular knowledge

Shared code with website

Remote deploy

Page 25: React vs angular (mobile first battle)

IONIC - WHY NOT

Limited native API access

Performance limits (Angular 1.x even worth)

Might not feel “native”

Page 26: React vs angular (mobile first battle)

AGENDA

Angular VS React

Hybrid solution (Ionic)

Native solution (react-native)

Compare

Page 27: React vs angular (mobile first battle)

REACT NATIVE

Javascript framework

Compiles into native app

Uses React as view layer

“Learn once - write anywhere”

Page 28: React vs angular (mobile first battle)

REACT NATIVE

Mobile Device

React Native

Native App

Page 29: React vs angular (mobile first battle)

REACT NATIVE

Components

Native API

Styles

Touch

Network

Animation

Page 30: React vs angular (mobile first battle)

REACT NATIVE - COMPONENTS

Not HTML - platform specific

Let’s see the list

Page 31: React vs angular (mobile first battle)

REACT NATIVE - APIS

API are platform specific

API are async

use async / await pattern

TCP based

Page 32: React vs angular (mobile first battle)

REACT NATIVE - APIS

Page 33: React vs angular (mobile first battle)

REACT WHY

Native!

No performance limit

Javascript - libraries

Page 34: React vs angular (mobile first battle)

REACT WHY NOT

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

Learning curve

Duplicate coding

Not HTML / CSS

Page 35: React vs angular (mobile first battle)

AGENDA

Angular VS React

Hybrid solution (Ionic)

Native solution (react-native)

Compare

Page 36: React vs angular (mobile first battle)

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 37: React vs angular (mobile first battle)

COMPARE

IONIC REACT NATIVE

UIHTML-CSS

Easy to implement common uiGets difficult with animation

JSX-STYLESGreat experience

Harder implementation

NATIVE APIPlug-in based TCP based

Page 38: React vs angular (mobile first battle)

COMPARE

IONIC REACT NATIVE

DEPLOYMENTWeb based +

store Store only *

DEBUG Within browser & deviceEasy to setup

Device OnlyMore complicated

Page 39: React vs angular (mobile first battle)

AGENDA

Angular VS React

Hybrid solution (Ionic)

Native solution (react-native)

Compare

Page 40: React vs angular (mobile first battle)

QUESTIONS


Top Related