Professional Documents
Culture Documents
Introduction
Speakers
Type
Attributes
Children
UI Elements
Browser DOM
Server HTML
UI Elements
Browser DOM
Server HTML
iOS Apps UIView
Android Apps Android.View
UI Elements
Browser DOM
Server HTML
iOS Apps UIView
Android Apps Android.View
Virtual Reality 3D Scene Graph
React Elements
React DOM DOM
HTML
React Native UIView
Android.View
React VR 3D Scene Graph
3. React is adopted incrementally
Great for whole applications
Or small portions of the screen
Introduce React “Bottom up”
Lifecycle Hooks:
componentDidMount()
componentWillReceiveProps()
componentWillUnmount()
React’s “Escape Hatch”
Use your existing
frameworks and code with React
1. React is not MVC
Component-based UI with functions instead of templates.
NAV COMPONENT
SALE COMPONENT
PRODUCT COMPONENTS
APP COMPONENT
Application Composition
PRODUCT COMPONENT
BUTTON COMPONENT
Application Composition
NAV COMPONENT
SALE COMPONENT
PRODUCT COMPONENTS
BUTTON COMPONENTS
APP COMPONENT
Components
Metadata
=
HTML CSS Class
<> + [] + {}
Templates
Standard HTML
HTML
app/hero-list.component.html
<h2>Hero List</h2>
Interpolation
HTML
[propertyName] = “expression”
Property & One Way Binding
Event Binding (eventName) = “statement”
Event Binding
Component DOM
[(ngModel)] = “property”
Two Way Binding
app/hero-list.component.html
…
<li *ngFor="let hero of heroes" (click)="selectHero(hero)">
{{hero.name}}
</li>
…
<hero-detail *ngIf="selectedHero" [hero]="selectedHero></hero-detail>
Templates
Structural
HTML app/hero-list.component.html
…
Attribute
app/hero-detail.component.html
<input [(ngModel)]="hero.name">
Templates
app/hero-list.component.html
<h2>Hero List</h2>
Component Class
Directives
app/hero-list.component.ts
Component export class HeroListComponent implements OnInit {
heroes: Hero[];
selectedHero: Hero;
Just A Class
Service Composition
app/hero.service.ts
@Injectable()
export class HeroService {
constructor (
private http: Http,
private errorHandler: HttpErrorHandler) { }
getHeroes () {
return this.http.get('app/heroes')
.map(res => res.json().data)
.catch(this.errorHandler.handle);
}
}
Component Architecture
app/hero-list.component.html
constructor(
private heroService: HeroService
) { }
Component Architecture
app/hero-list.component.html
constructor(
private heroService: HeroService
) { }
Component Architecture
app/hero-list.component.html
constructor(
private heroService: HeroService,
private powerService: PowerService
) { }
Component Architecture
app/app.module.ts
Service Composition
app/app.component.ts
Service Composition
import { Component } from '@angular/core';
Service Composition
Dependency Injection
Routing
Angular Everywhere
Scenarios
PWA
Superset of Javascript
Because Types!!
Readability
Familiarity
Tooling
Angular 1: Interpreted Templates
HTML
Template Change
CSS Renderer
Compiler Detection
JavaScript
Change
DI View
detection
Runtime Runtime
Runtime
Angular 2: Compiler Generates Code
HTML
CSS Compiler Views
JavaScript
Just In Time (JIT) Compilation
HTML
JIT
CSS Views
Compiler
JavaScript
Just In Time (JIT) Compilation
Change detection
10x faster!
Angular 2 Compiler Perf Improvement
6
5.7
4.5
Ratio
1.5
1.5
1.0
0
By Hand Angular 2 Angular 1
Ahead of Time (AoT) Compilation
Build Step
HTML
AoT
CSS Views
Compiler
JavaScript
Ahead of Time (AoT) Compilation
No in-browser parsing
or compilation
400
300 335
JIT
200
AoT
144
100 130
49
0
Load time Size
(ms) (kb, gzipped)
Ahead-of-time template compiler
AOT
compiler
● Ease integration
● Complete solutions
● Primitives
● Experimental & Deprecated features
3. Comprehensive Tooling
Ember CLI
If you are faced with building a single-page application (SPA) and trying to
choose a framework to build with, Ember.js has emerged as a leading choice....
The Ember CLI build tooling is a haven in the storm of JavaScript build tools,
and the Ember core team and community are highly active and responsive.
https://www.thoughtworks.com/radar/languages-and-frameworks/ember-js
Frontend Frameworks
Panel Discussion