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
760
上手に付き合うコンポーネントテスト
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
大喜利で理解するLLM as a Judge / Understanding LLM-as-a-Judge through Ogiri
rockname
0
100
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
370
マイコン向けの軽量Ruby「PicoRuby」で各種デバイスを制御するネイティブアプリの実現手法
bash0c7
0
390
From 6 People Classroom Meetup to 100 People Regional Conference / FOSS4G Hiroshima 2026
furukawayasuto
0
200
Claude Codeを組織的に動かして月400PRを実現した話
happy_ryo
0
280
AWS Step Functions 大規模並列の壁を越える / jaws-sonic-2026-niigata-step-functions
kasacchiful
PRO
1
460
[DroidKaigi 2026] Bring your own phones to Gradle Managed Devices
f2lk
0
120
ゲームコントローラやキーボードのファームウェアをSwiftで書く
kishikawakatsumi
1
240
速習iPhone Duo対応
yuukiw00w
1
280
iOSDC Japan 2026 - Swiftで作って学ぼう!データベース自作入門
kaseken
2
160
海上で動くGoサーバー: goroutineとchannelでさばく航行データストリーム
atsuki_seo
0
690
20260828_品質と開発生産性を両立させる、AI時代のE2Eテストの考え方
magicpod
0
210
Featured
See All Featured
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
410
The Pragmatic Product Professional
lauravandoore
37
7.4k
ラッコキーワード サービス紹介資料
rakko
1
4.9M
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2.1k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
520
Tell your own story through comics
letsgokoyo
1
1.1k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.3k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
74
42k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
232
55k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.6k
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)͔ΒͷऔಘΛએݴతʹ هड़Ͱ͖ͦ͏