Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
falcor-with-react
Search
Yosuke Kurami
April 25, 2016
Programming
460
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
falcor-with-react
Yosuke Kurami
April 25, 2016
More Decks by Yosuke Kurami
See All by Yosuke Kurami
TypeScript LSP の今までとこれから
quramy
1
2.2k
フロントエンドテストの育て方
quramy
12
3.9k
App Router 悲喜交々
quramy
8
770
上手に付き合うコンポーネントテスト
quramy
6
2.4k
Patched fetch did not work
quramy
6
810
GraphQL あるいは React における自律的なデータ取得について
quramy
18
6k
Next.js App Router
quramy
15
4k
Fragment Composition of GraphQL
quramy
17
4.9k
reg-viz VRT tools
quramy
4
1.8k
Other Decks in Programming
See All in Programming
Security issues being discussed on Web Platforms
petamoriken
0
1.4k
更なる可用性を求めて、5年間運用したKotlinのアプリケーションをGoでリプレイスする話
ken_tunc
0
440
GitHubハンズオン講座 — 実務レベルのチーム開発のフローを身につけよう
junhat6
0
120
Herb in Rails 8.2: Your ERB views, now HTML-aware @ Rails World 2026, Austin, Texas
marcoroth
0
190
AWS CDKのカスタムリソースでContinuum(旧Security Agent)を実装した話 | Implementing Continuum (formerly Security Agent) via AWS CDK Custom Resource
akihisaikeda
2
140
Atomic Design, Enforced: Scaling Mobile Design Systems (next.app devCon / droidCon Berlin 2026)
steliosf
PRO
0
130
Agents on Rails - Rails at Scale 2026
irinanazarova
0
340
動作中のプログラムの中身をリアルタイムに覗く / Realtime Debugger for CSharp with Roslyn
prota
1
1.8k
すこし踏み込む CancellationToken
htkym
2
1.6k
[Rails World 2026] Durable orchestration on Rails: from continuation to workflow
palkan
1
480
パーソナライズPodcastを作った話
repunit11
0
120
MVNOの申込からeSIM開通までをiOSアプリでつなぐ- 本人確認・MNP・通信事業者基盤をまたぐ実装
satotakeshi
0
540
Featured
See All Featured
Designing Powerful Visuals for Engaging Learning
tmiket
1
590
Music & Morning Musume
bryan
48
7.4k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
2
6.3k
Reality Check: Gamification 10 Years Later
codingconduct
0
2.3k
WENDY [Excerpt]
tessaabrams
14
40k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
540
Measuring & Analyzing Core Web Vitals
bluesmoon
9
1k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
610
Utilizing Notion as your number one productivity tool
mfonobong
4
610
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
210
SEO for Brand Visibility & Recognition
aleyda
0
4.8k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
74
42k
Transcript
Falcor + React.js @Quramy 2016.04.25
About me • @Quramy (Yosuke Kurami) • Frontend Web Developer
at WACUL INC. • develop SPA with Angular(1 and 2) • झຯͰTypeScript༻ͷVimϓϥΪϯ։ൃͯ͠·͢ • http://vimawesome.com/plugin/tsuquyomi
I ♥ TypeScript falcor.d.ts was merged into Definitely Typed .
Why Falcor ?
SPAͷ՝(RIA, Mobile͖ͬͱҰॹ) • Frontend(UI)ͷཉٻ: • ࠷খݶͷϦΫΤετͰը໘ʹඞཁॆͳ ใ͕ཉ͍͠ • Backend(API)ͷཉٻ: •
Serviceͷઃܭͱ࣮ʹઐ೦͍ͨ͠
ݱ࣮… • ʮը໘ʹ࠷దԽͨ͠APIʹ͢Δͥʂʯ ˠ API endpoint͕ը໘ຖʹͭ͘ΔӋʹ • ʮͲͷը໘͔Β͑ΔAPI࡞ͬͨͥʂʯ ˠ ͦͷը໘Ͱඞཁͱ͠ͳ͍ଐੑΛେྔʹ
ؚΜͩJSON͕ฦ٫͞ΕΔ
Կ͔ղܾࡦແ͍ͷ͔…
ͦ͏ͩʂBFFͩʂ
Backends For Frontends (BFF) The BFF is tightly coupled to
a specific user experience, and will typically be maintained by the same team as the user interface. http://samnewman.io/patterns/architectural/bff/#bff
BFFʹد͍ͤͯΔظ • ServiceυϝΠϯʹ߹ΘͤͯendpointΛެ ։͢ΕΑ͍ • UIͷҰ࣍తͳཁٻBFF͕ड͚͚Δ ݸผServiceͷ͍߹Θͤ݁ՌΛUIʹ࠷దԽ ͯ͠ฦ٫͢Δ
What Falcor does Resources for UI (JSON Graph) Services BFF
! http://netflix.github.io/falcor/starter/what-is-falcor.html#one-model-everywhere
Falcor is one of BFF implementation Sam Newman refers: http://samnewman.io/patterns/architectural/bff/#comment-2386306596
Falcor is Universal Falcor.ModelΛར༻͢Δίʔυ Browser/Node.js྆ํͰಈ͘ ˠ testSSRͰ͑ͦ͏
How to use Falcor with React.js
Async MVC http://netflix.github.io/falcor/starter/what-is-falcor.html#bind-to-the-cloud
Ͳ͔ͬͰݟͨ͜ͱ͋Δͧɻɻ
React + Flux https://github.com/facebook/flux#flux
૬ੑྑͦ͞͏ͳͷͰͬͯΈͨ https://github.com/Quramy/react-falcor-demo#inetgrated-with-flux
Falcor.Model as store import {Model} from 'falcor'; import {Store} from
'../../../lib/built'; /*** Store ***/ export const store = Store.createFromModel(new Model({ cache: { count: 0 } }));
React.Component as View // Component export class App extends React.Component<{count:
number, dispatch: (action: Action<any>) => void}, {}> { render() { const {count} = this.props; const countUp = this.countUp.bind(this); return ( <div> <p>This is simple demonstation of Falcor, React and flux.</p> <button onClick={countUp}>Click + 1</button> <span>{count}</span> </div> ); } countUp() { this.props.dispatch(countUpAction(this.props.count + 1)); } }
Connect them import * as React from 'react'; import {render}
from 'react-dom'; import {connectModel} from '../../../lib/built'; // App Container const AppContainer = connectModel(App, store, { // Component’s property < - > Path of JSON Graph count: 'count' }); /*** Bootstrap ***/ render(<AppContainer dispatch={dispatcher.dispatch.bind(dispatcher)}/>, document.getElementById('app'));
ͬͨ͜ͱ1 • Falcor.ModelͷonChangeΛhookͯ͠ ObservableͳStoreΛ࡞Δ • Store(JSON Graph)ͷมߋΛView subscribe͢ΔΈ
ͬͨ͜ͱ2 • React.ComponentΛड͚ͱͬͯComponentΛฦؔ͢ (=connectModel)Λ࡞ • ReactͷLifecycle hook + StoreͷonChangeʹͯ JSON
Graph͔ΒstateΛੜɺҾComponentͷ props٧ΊࠐΉ • ʮComponent͔ΒContainerΛ࡞Δʯ ˠ ReduxRelayΛࢀߟʹ͍ͯ͠Δ
·ͱΊ • FalcorBFFج൫ͱͯ͑ͦ͠͏ • Store(ͷେ)ΛFalcor.ModelͰӅṭ͢Δ • ContainerؔΛࣗ࡞͢Δ͜ͱͰɺ Falcor(JSON Graph)͔ΒͷऔಘΛએݴతʹ هड़Ͱ͖ͦ͏