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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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は4年分のCompose移行を再現できるのか?実プロダクト279件のXMLで探る自動化の境界線
makun
0
820
Streamlitで実現する自然言語データアプリ開発
ayumu_yamaguchi
0
260
Swift愛好会と私(ウホーイ) / Swift Fan Club and Uhooi
uhooi
0
150
From 6 People Classroom Meetup to 100 People Regional Conference / FOSS4G Hiroshima 2026
furukawayasuto
0
190
新卒PdEのリアル
ryu1013
1
490
Java 27新機能 / Java 27 new features
kishida
2
120
DroidKaigi 2026 「個人開発という実験場: Android エンジニアが手にする4つの自由」
slashnephy
0
230
フロントエンドUIフレームワークのこれまでとこれから
ssssota
5
2.6k
Jetpack Compose メカニズム
skydoves
0
370
技術的負債を組織課題として解く-増えすぎたマイクロサービスとの戦い-
reimaru
1
1.3k
App Intentsのビルドプロセスを支える技術
kntkymt
0
350
[DroidKaigi 2026] Bring your own phones to Gradle Managed Devices
f2lk
0
120
Featured
See All Featured
YesSQL, Process and Tooling at Scale
rocio
174
15k
Ethics towards AI in product and experience design
skipperchong
2
370
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
580
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.9k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.3k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
280
The Art of Programming - Codeland 2020
erikaheidi
57
14k
Skip the Path - Find Your Career Trail
mkilby
1
230
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.6k
Speed Design
sergeychernyshev
33
2.1k
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)͔ΒͷऔಘΛએݴతʹ هड़Ͱ͖ͦ͏